代码提交

This commit is contained in:
liang.chao 2025-11-11 18:10:08 +08:00
parent 3d45c677f4
commit 1b17a81eeb
7 changed files with 95 additions and 67 deletions

View File

@ -81,8 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">

View File

@ -2,7 +2,9 @@ package com.bonus.waterdesign.controller.water;
import com.bonus.common.core.controller.BaseController; import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.domain.entity.SysUser;
import com.bonus.common.core.page.TableDataInfo; import com.bonus.common.core.page.TableDataInfo;
import com.bonus.system.service.ISysUserService;
import com.bonus.waterdesign.domain.DeviceDto; import com.bonus.waterdesign.domain.DeviceDto;
import com.bonus.waterdesign.domain.DeviceRecord; import com.bonus.waterdesign.domain.DeviceRecord;
import com.bonus.waterdesign.domain.SelectDto; import com.bonus.waterdesign.domain.SelectDto;
@ -36,6 +38,11 @@ public class DeviceController extends BaseController {
List<SelectDto> list = deviceService.getDeviceType(); List<SelectDto> list = deviceService.getDeviceType();
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@GetMapping("/getDeviceKeepUser")
public AjaxResult getDeviceKeepUser() {
List<SelectDto> list = deviceService.getDeviceKeepUser();
return AjaxResult.success(list);
}
@PreAuthorize("@ss.hasPermi('device:add')") @PreAuthorize("@ss.hasPermi('device:add')")
@PostMapping("/add") @PostMapping("/add")
@ -77,8 +84,8 @@ public class DeviceController extends BaseController {
// 领用状态下 查询最后一次领用人和领用日期 // 领用状态下 查询最后一次领用人和领用日期
@GetMapping("/getLastUse") @GetMapping("/getLastUse")
public AjaxResult getLastUse() { public AjaxResult getLastUse(DeviceRecord dto) {
return AjaxResult.success(deviceService.getLastUse()); return AjaxResult.success(deviceService.getLastUse(dto));
} }
// 领用记录 // 领用记录

View File

@ -14,10 +14,14 @@ public class DeviceDto {
private String deviceName; private String deviceName;
// 设备类型 // 设备类型
private String deviceType; private String deviceType;
// 设备类型名称
private String deviceTypeName;
// 设备编码 // 设备编码
private String deviceCode; private String deviceCode;
// 设备管理人 // 设备管理人
private Integer userId; private Integer userId;
// 设备管理人
private String userName;
//设备状态0闲置1在用 //设备状态0闲置1在用
private String status; private String status;
// 删除状态0正常1删除 // 删除状态0正常1删除

View File

@ -21,9 +21,11 @@ public interface DeviceMapper {
int updateReturnRecord(DeviceRecord dto); int updateReturnRecord(DeviceRecord dto);
DeviceRecord getLastUse(); DeviceRecord getLastUse(DeviceRecord dto);
List<DeviceRecord> getRecordList(); List<DeviceRecord> getRecordList();
int getCount(DeviceDto model); int getCount(DeviceDto model);
List<SelectDto> getDeviceKeepUser();
} }

View File

@ -24,7 +24,9 @@ public interface DeviceService {
AjaxResult returnDevice(DeviceRecord dto); AjaxResult returnDevice(DeviceRecord dto);
DeviceRecord getLastUse(); DeviceRecord getLastUse(DeviceRecord dto);
List<DeviceRecord> getRecordList(); List<DeviceRecord> getRecordList();
List<SelectDto> getDeviceKeepUser();
} }

View File

@ -98,12 +98,17 @@ public class DeviceServiceImpl implements DeviceService {
} }
@Override @Override
public DeviceRecord getLastUse() { public DeviceRecord getLastUse(DeviceRecord dto) {
return deviceMapper.getLastUse(); return deviceMapper.getLastUse(dto);
} }
@Override @Override
public List<DeviceRecord> getRecordList() { public List<DeviceRecord> getRecordList() {
return deviceMapper.getRecordList(); return deviceMapper.getRecordList();
} }
@Override
public List<SelectDto> getDeviceKeepUser() {
return deviceMapper.getDeviceKeepUser();
}
} }

View File

@ -15,7 +15,6 @@
<update id="update"> <update id="update">
UPDATE tb_device UPDATE tb_device
<set> <set>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''"> <if test="deviceName != null and deviceName != ''">
device_name = #{deviceName}, device_name = #{deviceName},
</if> </if>
@ -34,7 +33,6 @@
<if test="remark != null and remark != ''"> <if test="remark != null and remark != ''">
remark = #{remark}, remark = #{remark},
</if> </if>
</trim>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@ -63,22 +61,27 @@
<select id="list" resultType="com.bonus.waterdesign.domain.DeviceDto"> <select id="list" resultType="com.bonus.waterdesign.domain.DeviceDto">
select select
device_name as deviceName, td.id,
device_type as deviceType, td.device_name as deviceName,
device_code as deviceCode, td.device_type as deviceType,
user_id as userId, tdt.type_name as deviceTypeName,
status, td.device_code as deviceCode,
remark td.user_id as userId,
from tb_device su.nick_name as userName,
where del_flag = 0 td.status,
td.remark
from tb_device td
left join tb_device_type tdt on td.device_type = tdt.id
left join sys_user su on td.user_id = su.user_id
where td.del_flag = 0
<if test="deviceCode != null and deviceCode != ''"> <if test="deviceCode != null and deviceCode != ''">
and device_code like concat ('%',#{deviceCode},'%') and td.device_code like concat ('%',#{deviceCode},'%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and status = #{status} and td.status = #{status}
</if> </if>
<if test="deviceType != null and deviceType != ''"> <if test="deviceType != null and deviceType != ''">
and device_type = #{deviceType} and td.device_type = #{deviceType}
</if> </if>
</select> </select>
@ -93,7 +96,7 @@
tdr.start_time as startTime tdr.start_time as startTime
from tb_device_record tdr from tb_device_record tdr
left join sys_user su on tdr.user_id = su.user_id left join sys_user su on tdr.user_id = su.user_id
where tdr.device_id = #{deviceId} and start_time is not null where tdr.device_id = #{deviceId} and start_time is not null and end_time is null
order by id desc limit 1 order by id desc limit 1
</select> </select>
<select id="getRecordList" resultType="com.bonus.waterdesign.domain.DeviceRecord"> <select id="getRecordList" resultType="com.bonus.waterdesign.domain.DeviceRecord">
@ -120,7 +123,7 @@
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and tdr.end_time = #{endTime} and tdr.end_time = #{endTime}
</if> </if>
order by id desc order by tdr.id desc
</select> </select>
<select id="getCount" resultType="java.lang.Integer"> <select id="getCount" resultType="java.lang.Integer">
select count(1) from tb_device select count(1) from tb_device
@ -129,4 +132,11 @@
and id != #{id} and id != #{id}
</if> </if>
</select> </select>
<select id="getDeviceKeepUser" resultType="com.bonus.waterdesign.domain.SelectDto">
select
user_id as id,
nick_name as name
from sys_user
where del_flag = 0 and status = 0 and user_id not in (1,2)
</select>
</mapper> </mapper>