代码提交
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" />
|
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="deptResult" type="SysDept">
|
<resultMap id="deptResult" type="SysDept">
|
||||||
<id property="deptId" column="dept_id" />
|
<id property="deptId" column="dept_id" />
|
||||||
<result property="parentId" column="parent_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="leader" column="leader" />
|
||||||
<result property="status" column="dept_status" />
|
<result property="status" column="dept_status" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="RoleResult" type="SysRole">
|
<resultMap id="RoleResult" type="SysRole">
|
||||||
<id property="roleId" column="role_id" />
|
<id property="roleId" column="role_id" />
|
||||||
<result property="roleName" column="role_name" />
|
<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="dataScope" column="data_scope" />
|
||||||
<result property="status" column="role_status" />
|
<result property="status" column="role_status" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<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,
|
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
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||||
from sys_user u
|
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_user_role ur on u.user_id = ur.user_id
|
||||||
left join sys_role r on r.role_id = ur.role_id
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<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
|
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
|
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">
|
<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">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
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
|
from sys_user u
|
||||||
|
|
@ -101,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
<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
|
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
|
from sys_user u
|
||||||
|
|
@ -119,29 +117,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{userName} and u.del_flag = '0'
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_id = #{userId}
|
where u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
<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 user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
|
@ -173,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateUser" parameterType="SysUser">
|
<update id="updateUser" parameterType="SysUser">
|
||||||
update sys_user
|
update sys_user
|
||||||
<set>
|
<set>
|
||||||
|
|
@ -193,28 +191,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</set>
|
</set>
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateUserStatus" parameterType="SysUser">
|
<update id="updateUserStatus" parameterType="SysUser">
|
||||||
update sys_user set status = #{status} where user_id = #{userId}
|
update sys_user set status = #{status} where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateUserAvatar" parameterType="SysUser">
|
<update id="updateUserAvatar" parameterType="SysUser">
|
||||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="resetUserPwd" parameterType="SysUser">
|
<update id="resetUserPwd" parameterType="SysUser">
|
||||||
update sys_user set password = #{password} where user_name = #{userName}
|
update sys_user set password = #{password} where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteUserById" parameterType="Long">
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteUserByIds" parameterType="Long">
|
<delete id="deleteUserByIds" parameterType="Long">
|
||||||
update sys_user set del_flag = '2' where user_id in
|
update sys_user set del_flag = '2' where user_id in
|
||||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</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.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));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 领用记录
|
// 领用记录
|
||||||
|
|
|
||||||
|
|
@ -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删除
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,30 +13,28 @@
|
||||||
|
|
||||||
|
|
||||||
<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>
|
<if test="deviceType != null and deviceType != ''">
|
||||||
<if test="deviceType != null and deviceType != ''">
|
device_type = #{deviceType},
|
||||||
device_type = #{deviceType},
|
</if>
|
||||||
</if>
|
<if test="deviceCode != null and deviceCode != ''">
|
||||||
<if test="deviceCode != null and deviceCode != ''">
|
device_code = #{deviceCode},
|
||||||
device_code = #{deviceCode},
|
</if>
|
||||||
</if>
|
<if test="userId != null">
|
||||||
<if test="userId != null">
|
user_id = #{userId},
|
||||||
user_id = #{userId},
|
</if>
|
||||||
</if>
|
<if test="status != null and status != ''">
|
||||||
<if test="status != null and status != ''">
|
status = #{status},
|
||||||
status = #{status},
|
</if>
|
||||||
</if>
|
<if test="remark != null and remark != ''">
|
||||||
<if test="remark != null and remark != ''">
|
remark = #{remark},
|
||||||
remark = #{remark},
|
</if>
|
||||||
</if>
|
</set>
|
||||||
</trim>
|
WHERE id = #{id}
|
||||||
</set>
|
|
||||||
WHERE id = #{id}
|
|
||||||
</update>
|
</update>
|
||||||
<update id="updateStatus">
|
<update id="updateStatus">
|
||||||
update tb_device set status = #{status} where id = #{deviceId}
|
update tb_device set status = #{status} where id = #{deviceId}
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue