代码提交
This commit is contained in:
parent
3d45c677f4
commit
1b17a81eeb
|
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
|
|
@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="leader" column="leader" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="RoleResult" type="SysRole">
|
||||
<id property="roleId" column="role_id" />
|
||||
<result property="roleName" column="role_name" />
|
||||
|
|
@ -45,9 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
|
|
@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
|
@ -81,10 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<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) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
|
|
@ -101,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
|
|
@ -119,29 +117,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
|
|
@ -173,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
<set>
|
||||
|
|
@ -193,28 +191,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="resetUserPwd" parameterType="SysUser">
|
||||
update sys_user set password = #{password} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.bonus.waterdesign.controller.water;
|
|||
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
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.system.service.ISysUserService;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
|
|
@ -36,6 +38,11 @@ public class DeviceController extends BaseController {
|
|||
List<SelectDto> list = deviceService.getDeviceType();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
@GetMapping("/getDeviceKeepUser")
|
||||
public AjaxResult getDeviceKeepUser() {
|
||||
List<SelectDto> list = deviceService.getDeviceKeepUser();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('device:add')")
|
||||
@PostMapping("/add")
|
||||
|
|
@ -77,8 +84,8 @@ public class DeviceController extends BaseController {
|
|||
|
||||
// 领用状态下 查询最后一次领用人和领用日期
|
||||
@GetMapping("/getLastUse")
|
||||
public AjaxResult getLastUse() {
|
||||
return AjaxResult.success(deviceService.getLastUse());
|
||||
public AjaxResult getLastUse(DeviceRecord dto) {
|
||||
return AjaxResult.success(deviceService.getLastUse(dto));
|
||||
}
|
||||
|
||||
// 领用记录
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ public class DeviceDto {
|
|||
private String deviceName;
|
||||
// 设备类型
|
||||
private String deviceType;
|
||||
// 设备类型名称
|
||||
private String deviceTypeName;
|
||||
// 设备编码
|
||||
private String deviceCode;
|
||||
// 设备管理人
|
||||
private Integer userId;
|
||||
// 设备管理人
|
||||
private String userName;
|
||||
//设备状态0:闲置,1:在用
|
||||
private String status;
|
||||
// 删除状态,0正常1删除
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ public interface DeviceMapper {
|
|||
|
||||
int updateReturnRecord(DeviceRecord dto);
|
||||
|
||||
DeviceRecord getLastUse();
|
||||
DeviceRecord getLastUse(DeviceRecord dto);
|
||||
|
||||
List<DeviceRecord> getRecordList();
|
||||
|
||||
int getCount(DeviceDto model);
|
||||
|
||||
List<SelectDto> getDeviceKeepUser();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ public interface DeviceService {
|
|||
|
||||
AjaxResult returnDevice(DeviceRecord dto);
|
||||
|
||||
DeviceRecord getLastUse();
|
||||
DeviceRecord getLastUse(DeviceRecord dto);
|
||||
|
||||
List<DeviceRecord> getRecordList();
|
||||
|
||||
List<SelectDto> getDeviceKeepUser();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,12 +98,17 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DeviceRecord getLastUse() {
|
||||
return deviceMapper.getLastUse();
|
||||
public DeviceRecord getLastUse(DeviceRecord dto) {
|
||||
return deviceMapper.getLastUse(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceRecord> getRecordList() {
|
||||
return deviceMapper.getRecordList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectDto> getDeviceKeepUser() {
|
||||
return deviceMapper.getDeviceKeepUser();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,30 +13,28 @@
|
|||
|
||||
|
||||
<update id="update">
|
||||
UPDATE tb_device
|
||||
<set>
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
device_name = #{deviceName},
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
device_type = #{deviceType},
|
||||
</if>
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
device_code = #{deviceCode},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
UPDATE tb_device
|
||||
<set>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
device_name = #{deviceName},
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
device_type = #{deviceType},
|
||||
</if>
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
device_code = #{deviceCode},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateStatus">
|
||||
update tb_device set status = #{status} where id = #{deviceId}
|
||||
|
|
@ -63,22 +61,27 @@
|
|||
|
||||
<select id="list" resultType="com.bonus.waterdesign.domain.DeviceDto">
|
||||
select
|
||||
device_name as deviceName,
|
||||
device_type as deviceType,
|
||||
device_code as deviceCode,
|
||||
user_id as userId,
|
||||
status,
|
||||
remark
|
||||
from tb_device
|
||||
where del_flag = 0
|
||||
td.id,
|
||||
td.device_name as deviceName,
|
||||
td.device_type as deviceType,
|
||||
tdt.type_name as deviceTypeName,
|
||||
td.device_code as deviceCode,
|
||||
td.user_id as userId,
|
||||
su.nick_name as userName,
|
||||
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 != ''">
|
||||
and device_code like concat ('%',#{deviceCode},'%')
|
||||
and td.device_code like concat ('%',#{deviceCode},'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
and td.status = #{status}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
and device_type = #{deviceType}
|
||||
and td.device_type = #{deviceType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -93,7 +96,7 @@
|
|||
tdr.start_time as startTime
|
||||
from tb_device_record tdr
|
||||
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
|
||||
</select>
|
||||
<select id="getRecordList" resultType="com.bonus.waterdesign.domain.DeviceRecord">
|
||||
|
|
@ -120,7 +123,7 @@
|
|||
<if test="endTime != null and endTime != ''">
|
||||
and tdr.end_time = #{endTime}
|
||||
</if>
|
||||
order by id desc
|
||||
order by tdr.id desc
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_device
|
||||
|
|
@ -129,4 +132,11 @@
|
|||
and id != #{id}
|
||||
</if>
|
||||
</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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue