xuxiaofei лет назад: 2
Родитель
Сommit
3bc1e204c0
15 измененных файлов с 425 добавлено и 110 удалено
  1. 11 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpDutyController.java
  2. 9 9
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabSubject.java
  3. 14 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/XxpUserAuth.java
  4. 11 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabSubjectVO.java
  5. 20 4
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectServiceImpl.java
  6. 8 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/XxpCardInfoServiceImpl.java
  7. 2 2
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml
  8. 1 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpClassifySubjectMapper.xml
  9. 1 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpInspectionMapper.xml
  10. 12 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpUserAuthMapper.xml
  11. 11 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysUserController.java
  12. 7 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/mapper/SysUserMapper.java
  13. 7 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/ISysUserService.java
  14. 11 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUserServiceImpl.java
  15. 300 94
      zd-modules/zd-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 11 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpDutyController.java

@@ -4,6 +4,7 @@ import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
 import com.zd.common.core.log.BusinessType;
 import com.zd.common.core.security.TokenService;
+import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.ExcelUtil;
 import com.zd.common.core.utils.FileConfigUtils;
 import com.zd.common.core.utils.StringUtils;
@@ -210,4 +211,14 @@ public class LabXxpDutyController extends BaseController
                 });
         return ResultData.success(list);
     }
+
+    /***
+     *
+     * 获取当前时间
+     */
+    @GetMapping(value = "/getDate")
+    public ResultData getDate()
+    {
+        return ResultData.success(DateUtils.getDate());
+    }
 }

+ 9 - 9
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabSubject.java

@@ -223,17 +223,17 @@ public class LabSubject extends BaseEntity implements QCInterface {
     /***
      *巡查人员,穿戴检查可跳过(0 否,1 是)
      */
-    private String inspectSkipped;
+    private Integer inspectSkipped;
 
     /***
      *巡查人员,穿戴检查识别上限
      */
-    private String inspectCheckCount;
+    private Integer inspectCheckCount;
 
     /***
      *巡查人员,签到有效时间
      */
-    private String inspectSignTime;
+    private Integer inspectSignTime;
 
     /***
      *实验室详情
@@ -580,27 +580,27 @@ public class LabSubject extends BaseEntity implements QCInterface {
         this.inspectCheckIn = inspectCheckIn;
     }
 
-    public String getInspectSkipped() {
+    public Integer getInspectSkipped() {
         return inspectSkipped;
     }
 
-    public void setInspectSkipped(String inspectSkipped) {
+    public void setInspectSkipped(Integer inspectSkipped) {
         this.inspectSkipped = inspectSkipped;
     }
 
-    public String getInspectCheckCount() {
+    public Integer getInspectCheckCount() {
         return inspectCheckCount;
     }
 
-    public void setInspectCheckCount(String inspectCheckCount) {
+    public void setInspectCheckCount(Integer inspectCheckCount) {
         this.inspectCheckCount = inspectCheckCount;
     }
 
-    public String getInspectSignTime() {
+    public Integer getInspectSignTime() {
         return inspectSignTime;
     }
 
-    public void setInspectSignTime(String inspectSignTime) {
+    public void setInspectSignTime(Integer inspectSignTime) {
         this.inspectSignTime = inspectSignTime;
     }
 

+ 14 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/XxpUserAuth.java

@@ -90,6 +90,20 @@ public class XxpUserAuth extends BaseEntity {
     private String deptName;
 
     /**
+     * 指纹
+     */
+    @Excel(name = "指纹 ")
+    @ApiModelProperty(value = "指纹 ")
+    private String finger;
+
+    /**
+     * 密码
+     */
+    @Excel(name = "密码")
+    @ApiModelProperty(value = "密码")
+    private String userPassword;
+
+    /**
      * 硬件id
      */
     @Excel(name = "硬件id")

+ 11 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabSubjectVO.java

@@ -118,6 +118,9 @@ public class LabSubjectVO extends LabSubject {
     @ApiModelProperty(name = "位置")
     private String posi;
 
+    @ApiModelProperty(name = "电子信息牌Id")
+    private Integer xxpCardInfoId;
+
     public String getSenseState() {
         return senseState;
     }
@@ -399,4 +402,12 @@ public class LabSubjectVO extends LabSubject {
     public void setPosi(String posi) {
         this.posi = posi;
     }
+
+    public Integer getXxpCardInfoId() {
+        return xxpCardInfoId;
+    }
+
+    public void setXxpCardInfoId(Integer xxpCardInfoId) {
+        this.xxpCardInfoId = xxpCardInfoId;
+    }
 }

+ 20 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectServiceImpl.java

@@ -229,17 +229,33 @@ public class LabSubjectServiceImpl implements ILabSubjectService {
 //        }
 
         //安全类目信息修改
-        List<XxpClassifySubject> classifySubjectList = labSubject.getClassifySubjectList();
+       /* List<XxpClassifySubject> classifySubjectList = labSubject.getClassifySubjectList();
         if(classifySubjectList!=null && classifySubjectList.size()>0){
+            //删除关系
+            classifySubjectService.deleteBySubjectId(labSubject.getId());
             //安全类目关系入库
             for (XxpClassifySubject cs:classifySubjectList) {
-                XxpClassifySubject classifySubject = classifySubjectService.selectClassifySubjectById(cs.getId());
-                if(classifySubject==null){
+                //XxpClassifySubject classifySubject = classifySubjectService.selectClassifySubjectById(cs.getId());
                     classifySubjectService.insertClassifySubject(cs);
+
+            }
+        }*/
+
+        //实验室类目信息处理
+        List<XxpClassify> classifyList = labSubject.getClassifyList();
+        if(classifyList!=null && classifyList.size()>0){
+            //删除关系
+            classifySubjectService.deleteBySubjectId(labSubject.getId());
+            for (XxpClassify cfl:classifyList ) {
+                for (XxpClassifyDetailVO detailVo:cfl.getPrivateDetailList()) {
+                    XxpClassifySubject subject = new XxpClassifySubject();
+                    subject.setClassifyId(cfl.getId());
+                    subject.setClassifyDetailId(detailVo.getId());
+                    subject.setSubjectId(labSubject.getId());
+                    classifySubjectService.insertClassifySubject(subject);
                 }
             }
         }
-
         return labSubjectMapper.updateLabSubject(labSubject);
     }
 

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/XxpCardInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zd.laboratory.service.impl;
 
+import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.laboratory.domain.XxpCardInfo;
@@ -61,6 +62,13 @@ public class XxpCardInfoServiceImpl implements IXxpCardInfoService
      */
     @Override
     public int insertXxpCardInfo(XxpCardInfo xxpCardInfo) {
+        //一实验室只能存在一个电子信息牌
+        XxpCardInfo info = new XxpCardInfo();
+        info.setSubjectId(xxpCardInfo.getSubjectId());
+        List<XxpCardInfo> list = xxpCardInfoMapper.selectXxpCardInfoList(info);
+        if(list.size()>0){
+            throw  new ServiceException("该实验室已配置信息牌!");
+        }
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         xxpCardInfo.setCreateBy(sysUser.getNickName());
         xxpCardInfo.setCreateTime(new Date());

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml

@@ -256,6 +256,7 @@
                t.inspect_check_count,
                t.inspect_sign_time,
                t.details,
+               (select i.id from xxp_card_info i where i.subJect_id=t.id LIMIT 1)         xxpCardInfoId,
                CONCAT(su.nick_name, '@', su.phonenumber)                      AS          adminNameAndPhone,
 
                (select d.dept_name from sys_dept d where t.build_id = d.dept_id)          buildName,
@@ -423,7 +424,7 @@
         select t.id,
         t.name,
         t.floor_id,
-        lb.room,
+        t.room,
         t.dept_id,
         IFNULL(su.user_id,-1) admin_id,
         t.is_del,
@@ -465,7 +466,6 @@
         from lab_subject t
         left join sys_user su on su.user_id = t.admin_id AND su.`del_flag`=0
         left join sys_dept sd on sd.dept_id = t.dept_id
-        left join lab_subject_layout lb on lb.id = t.layout_id
         left join lab_safe_classified cf on cf.id = t.level
         <where>
             <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpClassifySubjectMapper.xml

@@ -75,7 +75,7 @@
     <delete id="deleteBySubjectId">
         delete
         from xxp_classify_subject
-        where subject_id = #{SubjectId}
+        where subject_id = #{subjectId}
     </delete>
 
 </mapper>

+ 1 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpInspectionMapper.xml

@@ -165,6 +165,7 @@
         where sign_in is not null
         and sign_in &gt;= #{beginTime}
         and sign_in &lt;= #{endTime}
+        and date_format(sign_in, '%Y-%m-%d') != date_format(NOW(), '%Y-%m-%d')
         <if test="deptId != null ">and ( i.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId}
             ,ancestors )) or i.dept_id = #{deptId} )
         </if>

+ 12 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpUserAuthMapper.xml

@@ -15,6 +15,8 @@
         <result property="hardwareId" column="hardware_id"/>
         <result property="deptId" column="dept_id"/>
         <result property="deptName" column="dept_name"/>
+        <result property="finger" column="finger"/>
+        <result property="userPassword" column="user_password"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="createBy" column="create_by"/>
@@ -32,6 +34,8 @@
                hardware_id,
                dept_id,
                dept_name,
+               finger,
+               user_password,
                create_by,
                create_time,
                update_by,
@@ -54,6 +58,8 @@
                 find_in_set(#{deptId} ,ancestors )) or t.dept_id = #{deptId} )
             </if>
             <if test="deptName != null ">and t.dept_name = #{deptName}</if>
+            <if test="finger != null ">and t.finger = #{finger}</if>
+            <if test="userPassword != null ">and t.user_password = #{userPassword}</if>
             <if test="createBy != null  ">and t.create_by =#{createBy}</if>
             <if test="createTime != null  ">and t.create_time =#{createTime}</if>
             <if test="updateBy != null  ">and t.update_by =#{updateBy}</if>
@@ -90,6 +96,8 @@
             <if test="hardwareId != null">hardware_id,</if>
             <if test="deptId != null">dept_id,</if>
             <if test="deptName != null">dept_name,</if>
+            <if test="finger != null">finger,</if>
+            <if test="userPassword != null">user_password,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
         </trim>
@@ -103,6 +111,8 @@
             <if test="hardwareId != null">#{hardwareId},</if>
             <if test="deptId != null">#{deptId},</if>
             <if test="deptName != null">#{deptName},</if>
+            <if test="finger != null">#{finger},</if>
+            <if test="userPassword != null">#{userPassword},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
         </trim>
@@ -120,6 +130,8 @@
             <if test="hardwareId != null">hardware_id = #{hardwareId},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="finger != null">finger = #{finger},</if>
+            <if test="userPassword != null">user_password = #{userPassword},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 11 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysUserController.java

@@ -120,6 +120,17 @@ public class SysUserController extends BaseController {
     }
 
     /**
+     * 值班人员列表
+     */
+    @ApiOperation("值班人员列表")
+    @GetMapping("/getUserDutyList")
+    public TableDataInfo getUserDutyList(SysUser user) {
+        startPage();
+        List<SysUser> list = userService.selectUserDutyList(user);
+        return getDataTable(list);
+    }
+
+    /**
      * 根据电话号码查询用户信息
      */
     @ApiOperation("根据电话号码查询用户信息")

+ 7 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/mapper/SysUserMapper.java

@@ -288,4 +288,11 @@ public interface SysUserMapper {
      * @return 用户信息集合信息
      */
     public List<SysUser> oldCheckNewCard();
+
+    /****
+     * 值班人员列表
+     * @param sysUser
+     * @return
+     */
+    public List<SysUser> selectUserDutyList(SysUser sysUser);
 }

+ 7 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/ISysUserService.java

@@ -357,4 +357,11 @@ public interface ISysUserService {
      * @return 用户信息集合信息
      */
     public void oldCheckNewCard();
+
+    /****
+     * 值班人员列表
+     * @param sysUser
+     * @return
+     */
+    public List<SysUser> selectUserDutyList(SysUser sysUser);
 }

+ 11 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUserServiceImpl.java

@@ -1186,4 +1186,15 @@ public class SysUserServiceImpl implements ISysUserService {
         }
 
     }
+
+    /****
+     * 值班人员列表
+     * @param sysUser
+     * @return
+     */
+    @Override
+    @DataScope(deptAlias = "d", userAlias = "u")
+    public List<SysUser> selectUserDutyList(SysUser sysUser) {
+        return userMapper.selectUserDutyList(sysUser);
+    }
 }

+ 300 - 94
zd-modules/zd-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -73,26 +73,105 @@
 
     <!--2.6弃用-->
     <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,u.user_type,
-        d.dept_id, d.parent_id, 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,
-        u.major,u.major_id, u.grade, u.category, u.tutor_user_id, u.position, u.nature, u.signature,
-       u.card_num,u.wechat_id,u.education,u.nationality,u.addr,u.work_status,u.date_birth,
-        ut.nick_name tutorUserName,u.is_check
+        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,
+               u.user_type,
+               d.dept_id,
+               d.parent_id,
+               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,
+               u.major,
+               u.major_id,
+               u.grade,
+               u.category,
+               u.tutor_user_id,
+               u.position,
+               u.nature,
+               u.signature,
+               u.card_num,
+               u.wechat_id,
+               u.education,
+               u.nationality,
+               u.addr,
+               u.work_status,
+               u.date_birth,
+               ut.nick_name tutorUserName,
+               u.is_check
         from sys_user u
-		    left join sys_dept d on u.dept_id = d.dept_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_user ut on ut.user_id = u.tutor_user_id
+                 left join sys_dept d on u.dept_id = d.dept_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_user ut on ut.user_id = u.tutor_user_id
     </sql>
 
     <sql id="selectUserNewVo">
-        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,u.user_type,
-               d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
-               sm.`major_name` major, u.grade, u.category, u.tutor_user_id, u.position, u.nature, u.signature,
-               u.card_num,u.card_num_simple,u.wechat_id,u.education,u.nationality,u.addr,u.work_status,u.date_birth,
-               ut.nick_name tutorUserName,u.is_check,
-               uf.face_img,sc.class_name,u.major_id,u.signature,pt.`post_name` positionName
+        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,
+               u.user_type,
+               d.dept_id,
+               d.parent_id,
+               d.dept_name,
+               d.order_num,
+               d.leader,
+               d.status as     dept_status,
+               sm.`major_name` major,
+               u.grade,
+               u.category,
+               u.tutor_user_id,
+               u.position,
+               u.nature,
+               u.signature,
+               u.card_num,
+               u.card_num_simple,
+               u.wechat_id,
+               u.education,
+               u.nationality,
+               u.addr,
+               u.work_status,
+               u.date_birth,
+               ut.nick_name    tutorUserName,
+               u.is_check,
+               uf.face_img,
+               sc.class_name,
+               u.major_id,
+               u.signature,
+               pt.`post_name`  positionName
         from sys_user u
                  left join sys_dept d on u.dept_id = d.dept_id
                  left join sys_user ut on ut.user_id = u.tutor_user_id
@@ -178,7 +257,7 @@
             AND u.major like concat('%', #{major}, '%')
         </if>
         <if test="majorId != null and majorId != ''">
-            AND u.major_id  = #{majorId}
+            AND u.major_id = #{majorId}
         </if>
         <if test="searchValue != null and searchValue != ''">
             AND
@@ -201,16 +280,16 @@
             AND u.category like concat('%', #{category}, '%')
         </if>
         <if test="tutorUserId != null">
-            AND u.tutor_user_id  = #{tutorUserId}
+            AND u.tutor_user_id = #{tutorUserId}
         </if>
         <if test="nature != null and nature != ''">
-            AND u.nature  = #{nature}
+            AND u.nature = #{nature}
         </if>
         <if test="position != null and position != ''">
-            AND u.position  = #{position}
+            AND u.position = #{position}
         </if>
         <if test="isCheck != null">
-            AND u.is_check  = #{isCheck}
+            AND u.is_check = #{isCheck}
         </if>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
@@ -221,22 +300,23 @@
         u.create_time DESC
     </select>
 
-    <select id="selectUserListByDeptIds"  resultMap="SysUserResult">
+    <select id="selectUserListByDeptIds" resultMap="SysUserResult">
         select u.user_id, u.dept_id, u.nick_name, u.user_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,
         u.card_num,u.wechat_id,u.education,u.nationality,u.addr,u.work_status,u.date_birth
         from
         sys_user u
         where u.del_flag = '0'
-            and u.status = '0'
-            and  u.dept_id in
-            <foreach collection="array" item="deptId" open="(" separator="," close=")">
-                #{deptId}
-            </foreach>
+        and u.status = '0'
+        and u.dept_id in
+        <foreach collection="array" item="deptId" open="(" separator="," close=")">
+            #{deptId}
+        </foreach>
     </select>
 
     <select id="selectAllocatedList" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">
-        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.email, u.phonenumber, u.status, u.create_time, d.`dept_name`,
+        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.email, u.phonenumber, u.status,
+        u.create_time, d.`dept_name`,
         u.card_num,u.wechat_id,u.education,u.nationality,u.addr,u.work_status,u.date_birth
         from sys_user u
         left join sys_dept d on u.dept_id = d.dept_id
@@ -299,19 +379,54 @@
     </select>
 
     <select id="selectUserCenterByUserName" parameterType="String" resultMap="SysUserResult">
-        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,u.user_type,
-               d.dept_id, d.parent_id,
-               CASE WHEN u.user_type='22' THEN d.dept_name ELSE concat(if((SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = d.parent_id) is null ,'',
-               (SELECT concat(dt.dept_name,'-') FROM sys_dept dt WHERE dt.dept_id = d.parent_id)),d.dept_name) end dept_name,
-               d.order_num, d.leader, d.status AS dept_status,
-               CASE WHEN u.user_type='22' THEN sm.`major_name` else pt.`post_name` end major,
-               u.grade,dd.`dict_label` category, u.tutor_user_id, u.position, u.nature, u.signature,
-               u.card_num,u.wechat_id,
-               case when u.user_type='22' then ed.`dict_label` else dd.`dict_label` end education,
-               u.nationality,u.addr,u.work_status,u.date_birth,
-               ut.nick_name tutorUserName,u.is_check,
-               uf.face_img,sc.class_name,u.major_id,u.signature,pt.`post_name` positionName
+        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,
+               u.user_type,
+               d.dept_id,
+               d.parent_id,
+               CASE
+                   WHEN u.user_type = '22' THEN d.dept_name
+                   ELSE concat(if((SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = d.parent_id) is null, '',
+                                  (SELECT concat(dt.dept_name, '-') FROM sys_dept dt WHERE dt.dept_id = d.parent_id)),
+                               d.dept_name) end                                           dept_name,
+               d.order_num,
+               d.leader,
+               d.status AS                                                                dept_status,
+               CASE WHEN u.user_type = '22' THEN sm.`major_name` else pt.`post_name` end  major,
+               u.grade,
+               dd.`dict_label`                                                            category,
+               u.tutor_user_id,
+               u.position,
+               u.nature,
+               u.signature,
+               u.card_num,
+               u.wechat_id,
+               case when u.user_type = '22' then ed.`dict_label` else dd.`dict_label` end education,
+               u.nationality,
+               u.addr,
+               u.work_status,
+               u.date_birth,
+               ut.nick_name                                                               tutorUserName,
+               u.is_check,
+               uf.face_img,
+               sc.class_name,
+               u.major_id,
+               u.signature,
+               pt.`post_name`                                                             positionName
         FROM sys_user u
                  LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
                  LEFT JOIN sys_user ut ON ut.user_id = u.tutor_user_id
@@ -319,9 +434,10 @@
                  LEFT JOIN sys_class sc ON sc.id = u.grade
                  LEFT JOIN sys_major sm ON sm.id = u.major_id
                  LEFT JOIN sys_post pt ON pt.`post_id` = u.`position`
-                 LEFT JOIN sys_dict_data dd ON dd.`dict_value` = u.category  AND dd.`dict_type`='professional'
-                 LEFT JOIN sys_dict_data ed ON ed.`dict_value` = u.education AND ed.`dict_type`='education'
-        where u.user_name = #{userName} and u.del_flag = 0
+                 LEFT JOIN sys_dict_data dd ON dd.`dict_value` = u.category AND dd.`dict_type` = 'professional'
+                 LEFT JOIN sys_dict_data ed ON ed.`dict_value` = u.education AND ed.`dict_type` = 'education'
+        where u.user_name = #{userName}
+          and u.del_flag = 0
     </select>
 
     <select id="selectUserByNickName" parameterType="String" resultMap="SysUserResult">
@@ -340,32 +456,54 @@
     </select>
 
     <select id="checkUserNameUnique" parameterType="String" resultType="int">
-		select count(1) from sys_user where user_name = #{userName} and del_flag=0 limit 1
-	</select>
+        select count(1)
+        from sys_user
+        where user_name = #{userName}
+          and del_flag = 0 limit 1
+    </select>
 
     <select id="checkUserNameUniqueNotOwn" parameterType="com.zd.model.entity.SysUser" resultType="int">
-		select count(1) from sys_user where user_name = #{userName} and del_flag=0 and user_id != #{userId} limit 1
-	</select>
+        select count(1)
+        from sys_user
+        where user_name = #{userName}
+          and del_flag = 0
+          and user_id != #{userId} limit 1
+    </select>
 
     <select id="checkCardUnique" parameterType="com.zd.model.entity.SysUser" resultType="int">
-		select count(1) from sys_user where card_num = #{cardNum} and del_flag=0 limit 1
-	</select>
+        select count(1)
+        from sys_user
+        where card_num = #{cardNum}
+          and del_flag = 0 limit 1
+    </select>
 
     <select id="checkCardSimpleUnique" parameterType="com.zd.model.entity.SysUser" resultType="int">
-		select count(1) from sys_user where card_num_simple = #{cardNumSimple} and del_flag=0 and user_id != #{userId} limit 1
-	</select>
+        select count(1)
+        from sys_user
+        where card_num_simple = #{cardNumSimple}
+          and del_flag = 0
+          and user_id != #{userId} 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 user_id, phonenumber
+        from sys_user
+        where phonenumber = #{phonenumber}
+          and del_flag = 0 limit 1
+    </select>
 
     <select id="checkPhoneUniqueNotOwn" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">
-		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and user_name != #{userName} limit 1
-	</select>
+        select user_id, phonenumber
+        from sys_user
+        where phonenumber = #{phonenumber}
+          and user_name != #{userName} limit 1
+    </select>
 
     <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, email from sys_user where email = #{email} limit 1
-	</select>
+        select user_id, email
+        from sys_user
+        where email = #{email} limit 1
+    </select>
 
     <select id="selectOption" resultType="java.util.Map">
         select user_id userId, nick_name nickName,user_name userName from sys_user
@@ -438,14 +576,14 @@
             AND u.category like concat('%', #{category}, '%')
         </if>
         <if test="tutorUserId != null">
-            AND u.tutor_user_id  = #{tutorUserId}
+            AND u.tutor_user_id = #{tutorUserId}
         </if>
         <if test="nature != null and nature != ''">
-            AND u.nature  = #{nature}
+            AND u.nature = #{nature}
         </if>
 
         <if test="isCheck != null">
-            AND u.is_check  = #{isCheck}
+            AND u.is_check = #{isCheck}
         </if>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
@@ -643,16 +781,22 @@
     </update>
 
     <update id="updateUserAvatar" parameterType="com.zd.model.entity.SysUser">
- 		update sys_user set avatar = #{avatar} where user_name = #{userName}
-	</update>
+        update sys_user
+        set avatar = #{avatar}
+        where user_name = #{userName}
+    </update>
 
     <update id="resetUserPwd" parameterType="com.zd.model.entity.SysUser">
- 		update sys_user set password = #{password} where user_name = #{userName}
-	</update>
+        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>
+        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
@@ -661,7 +805,7 @@
         </foreach>
     </delete>
     <select id="queryPhoneByIds" resultType="string">
-        select  phonenumber from sys_user
+        select phonenumber from sys_user
         where user_id in
         <foreach collection="array" item="id" open="(" separator="," close=")">
             #{id}
@@ -670,7 +814,7 @@
     </select>
 
     <select id="queryCardNumByIds" resultType="com.zd.model.entity.SysUser">
-        select  * from sys_user
+        select * from sys_user
         where card_num_simple in
         <foreach collection="array" item="cardNums" open="(" separator="," close=")">
             #{cardNums}
@@ -738,16 +882,16 @@
             AND u.category like concat('%', #{category}, '%')
         </if>
         <if test="tutorUserId != null">
-            AND u.tutor_user_id  = #{tutorUserId}
+            AND u.tutor_user_id = #{tutorUserId}
         </if>
         <if test="nature != null and nature != ''">
-            AND u.nature  = #{nature}
+            AND u.nature = #{nature}
         </if>
         <if test="position != null and position != ''">
-            AND u.position  = #{position}
+            AND u.position = #{position}
         </if>
         <if test="isCheck != null">
-            AND u.is_check  = #{isCheck}
+            AND u.is_check = #{isCheck}
         </if>
 
     </select>
@@ -793,7 +937,7 @@
             AND u.user_id IN
             <foreach item="item" collection="ids" separator="," open="(" close=")" index="">'${item}'</foreach>
         </if>
-        <if test="deptIds !=null and  deptIds.size >0" >
+        <if test="deptIds !=null and  deptIds.size >0">
             AND u.dept_id IN
             <foreach item="item" collection="deptIds" separator="," open="(" close=")" index="">'${item}'</foreach>
         </if>
@@ -807,22 +951,25 @@
             AND u.category like concat('%', #{category}, '%')
         </if>
         <if test="tutorUserId != null">
-            AND u.tutor_user_id  = #{tutorUserId}
+            AND u.tutor_user_id = #{tutorUserId}
         </if>
         <if test="nature != null and nature != ''">
-            AND u.nature  = #{nature}
+            AND u.nature = #{nature}
         </if>
         <if test="position != null and position != ''">
-            AND u.position  = #{position}
+            AND u.position = #{position}
         </if>
         <if test="isCheck != null">
-            AND u.is_check  = #{isCheck}
+            AND u.is_check = #{isCheck}
         </if>
 
     </select>
 
     <select id="selectUserInfoByCardNum" resultType="com.zd.model.entity.SysUser">
-        SELECT user_id,nick_name,card_num,card_num_simple FROM sys_user u WHERE u.card_num_simple = #{cardNumSimple} and u.user_id != #{userId}
+        SELECT user_id, nick_name, card_num, card_num_simple
+        FROM sys_user u
+        WHERE u.card_num_simple = #{cardNumSimple}
+          and u.user_id != #{userId}
     </select>
 
     <select id="getSafeUserList" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">
@@ -837,21 +984,80 @@
 
 
     <select id="oldCheckNewCard" resultMap="SysUserResult">
-        select u.user_id, u.dept_id, u.nick_name, u.user_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,
-        u.major_id, u.grade, u.tutor_user_id, u.position, p.post_name as positionName,
-        u.nature,(select sc.class_name from sys_class sc where sc.id = u.grade) gradeName,
-        u.card_num,u.wechat_id,u.nationality,u.addr,u.work_status,
-        u.date_birth,d.dept_name, d.leader,u.department,
-        u.education, u.user_type,sm.`major_name` major,
-        ut.nick_name tutorUserName,u.is_check,date_format(u.create_time, '%Y-%m-%d') createTimeStr
-        from
-        sys_user u
-        left join sys_dept d on u.dept_id = d.dept_id
-        left join sys_user ut on ut.user_id = u.tutor_user_id
-        left join sys_post p on u.position = p.post_id
-        LEFT JOIN sys_major sm ON sm.id = u.major_id
+        select u.user_id,
+               u.dept_id,
+               u.nick_name,
+               u.user_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,
+               u.major_id,
+               u.grade,
+               u.tutor_user_id,
+               u.position,
+               p.post_name as                                                 positionName,
+               u.nature,
+               (select sc.class_name from sys_class sc where sc.id = u.grade) gradeName,
+               u.card_num,
+               u.wechat_id,
+               u.nationality,
+               u.addr,
+               u.work_status,
+               u.date_birth,
+               d.dept_name,
+               d.leader,
+               u.department,
+               u.education,
+               u.user_type,
+               sm.`major_name`                                                major,
+               ut.nick_name                                                   tutorUserName,
+               u.is_check,
+               date_format(u.create_time, '%Y-%m-%d')                         createTimeStr
+        from sys_user u
+                 left join sys_dept d on u.dept_id = d.dept_id
+                 left join sys_user ut on ut.user_id = u.tutor_user_id
+                 left join sys_post p on u.position = p.post_id
+                 LEFT JOIN sys_major sm ON sm.id = u.major_id
         where u.del_flag = '0'
-        AND u.card_num IS NOT NULL AND u.`card_num_simple` IS NULL
+          AND u.card_num IS NOT NULL
+          AND u.`card_num_simple` IS NULL
     </select>
+
+    <!--值班人员列表-->
+    <select id="selectUserDutyList" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">
+        select u.user_id, u.dept_id,d.dept_name, u.user_name, u.nick_name,  u.avatar, u.phonenumber,  u.sex,
+        u.status, u.del_flag,u.user_type
+        from
+        (
+        select w.user_id from lab_whitelist w
+        union all
+        select a.user_id from lab_security_apply a where a.valid_end_time> NOW() and audit_status=2
+        ) t
+        LEFT JOIN sys_user u on t.user_id=u.user_id
+        LEFT JOIN sys_dept d on d.dept_id = u.dept_id
+        <where>
+        <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>
+       <if test="nickName != null and nickName != ''">
+            AND u.nick_name = #{nickName}
+        </if>
+        <if test="userType != null and userType != ''">
+            AND u.user_type = #{userType}
+        </if>
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
 </mapper>