Kaynağa Gözat

发布记录、检查项设置、安全准入权限添加

liujh 3 yıl önce
ebeveyn
işleme
4a2c6fd40d

+ 3 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabCheckRecordController.java

@@ -472,6 +472,9 @@ public class LabCheckRecordController extends BaseController {
              map.put("remark",sysUser.getUserId());
          }
 
+         //按部门查询(数据逻辑过滤)
+        map.put("deptId", sysUser.getDept().getDeptId());
+
          // TODO 白老师证号特殊处理
         if(sysUser.getUserId() == 92612){
             map.put("deptId", sysUser.getDept().getDeptId());

+ 40 - 10
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabCheckRecordRelease.java

@@ -38,7 +38,20 @@ public class LabCheckRecordRelease extends BaseEntity
     /** 创建人id */
     @Excel(name = "创建人id")
     @ApiModelProperty(value = "创建人id")
-    private Long createByid;
+    private Long userId;
+    /** 创建人 */
+    @Excel(name = "创建人")
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /** 部门ID */
+    @Excel(name = "部门ID")
+    @ApiModelProperty(value = "部门ID")
+    private Long deptId;
+    /** 部门名称 */
+    @Excel(name = "部门名称")
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -66,15 +79,30 @@ public class LabCheckRecordRelease extends BaseEntity
     {
         return releaseDescribe;
     }
-    public void setCreateByid(Long createByid)
-    {
-        this.createByid = createByid;
-    }
 
-    public Long getCreateByid()
-    {
-        return createByid;
-    }
+    @Override
+    public Long getUserId() {        return userId;    }
+
+    @Override
+    public void setUserId(Long userId) {        this.userId = userId;    }
+
+    @Override
+    public String getCreateBy() {        return createBy;    }
+
+    @Override
+    public void setCreateBy(String createBy) {        this.createBy = createBy;    }
+
+    @Override
+    public Long getDeptId() {        return deptId;    }
+
+    @Override
+    public void setDeptId(Long deptId) {        this.deptId = deptId;    }
+
+    @Override
+    public String getDeptName() {        return deptName;    }
+
+    @Override
+    public void setDeptName(String deptName) {        this.deptName = deptName;    }
 
     @Override
     public String toString() {
@@ -82,7 +110,9 @@ public class LabCheckRecordRelease extends BaseEntity
                 .append("id", getId())
                 .append("checkId", getCheckId())
                 .append("releaseDescribe", getReleaseDescribe())
-                .append("createByid", getCreateByid())
+                .append("userId", getUserId())
+                .append("deptId", getDeptId())
+                .append("deptName", getDeptName())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("remark", getRemark())

+ 50 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabSecurityMaterialData.java

@@ -1,5 +1,6 @@
 package com.zd.laboratory.domain;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import org.hibernate.validator.constraints.Length;
@@ -23,6 +24,26 @@ public class LabSecurityMaterialData extends BaseEntity
     /** 主键 */
     @ApiModelProperty(value = "${comment}")
     private Long id;
+
+    /** 创建人id */
+    @Excel(name = "创建人id")
+    @Length(message = "创建人id长度不能超过20")
+    @ApiModelProperty(value = "创建人id")
+    private Long userId;
+    /** 创建人姓名 */
+    @Excel(name = "创建人姓名")
+    @Length(message = "创建人姓名长度不能超过10")
+    @ApiModelProperty(value = "创建人姓名")
+    private String createBy;
+    @ApiModelProperty(value = "部门ID")
+    private Long deptId;
+
+    /** 部门名称*/
+    @Excel(name = "部门名称")
+    @Length(message = "部门名称长度不能超过50")
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
     /** 材料名称 */
     @Excel(name = "材料名称")
     @Length(message = "材料名称长度不能超过255")
@@ -174,6 +195,31 @@ public class LabSecurityMaterialData extends BaseEntity
     public Integer getRelationType() {        return relationType;    }
 
     public void setRelationType(Integer relationType) {        this.relationType = relationType;    }
+
+    @Override
+    public Long getUserId() {        return userId;    }
+
+    @Override
+    public void setUserId(Long userId) {        this.userId = userId;    }
+
+    @Override
+    public String getCreateBy() {        return createBy;    }
+
+    @Override
+    public void setCreateBy(String createBy) {        this.createBy = createBy;    }
+
+    @Override
+    public Long getDeptId() {        return deptId;    }
+
+    @Override
+    public void setDeptId(Long deptId) {        this.deptId = deptId;    }
+
+    @Override
+    public String getDeptName() {        return deptName;    }
+
+    @Override
+    public void setDeptName(String deptName) {        this.deptName = deptName;    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -183,8 +229,10 @@ public class LabSecurityMaterialData extends BaseEntity
                 .append("materialSuit", getMaterialSuit())
                 .append("materialType", getMaterialType())
                 .append("relationType", getRelationType())
-                .append("createUserid", getCreateUserid())
-                .append("createUsername", getCreateUsername())
+                .append("userId", getUserId())
+                .append("createBy", getCreateBy())
+                .append("deptId", getDeptId())
+                .append("deptName", getDeptName())
                 .append("createTime", getCreateTime())
                 .append("updateUserid", getUpdateUserid())
                 .append("updateUsername", getUpdateUsername())

+ 3 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckConfigServiceImpl.java

@@ -2,8 +2,10 @@ package com.zd.laboratory.service.impl;
 
 import java.util.List;
 
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 
 import org.apache.commons.collections4.CollectionUtils;
@@ -95,6 +97,7 @@ public class LabCheckConfigServiceImpl implements ILabCheckConfigService {
     }
 
     @Override
+    @DataScope(deptAlias = "d" , userAlias = "t" , permi = PerPrefix.LABORATORY_CHECKRECORD)
     public LabCheckConfig getCheckConfigInfo() {
         LabCheckConfig labCheckConfig = new LabCheckConfig();
         List<LabCheckConfig> list = labCheckConfigMapper.selectLabCheckConfigList(labCheckConfig);

+ 7 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckOptionServiceImpl.java

@@ -3,6 +3,7 @@ package com.zd.laboratory.service.impl;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.PageHelperUtil;
@@ -53,6 +54,7 @@ public class LabCheckOptionServiceImpl implements ILabCheckOptionService {
      * @return 检查项选项
      */
     @Override
+    @DataScope(deptAlias = "d" , userAlias = "t" , permi = PerPrefix.LABORATORY_CHECKOPTION)
     public List<LabCheckOption> selectLabCheckOptionList(LabCheckOption labCheckOption) {
         labCheckOption.setType(1);
         // 关键字检索,并包含检索的父结点
@@ -348,6 +350,8 @@ public class LabCheckOptionServiceImpl implements ILabCheckOptionService {
                 }
 
                 labCheckOption = new LabCheckOption();
+                //设置其他公共字段
+                SaveUtil.setCommonAttr(labCheckOption);
                 labCheckOption.setName(labCheckOptionExcelVo.getName());
                 labCheckOption.setParentId(0L);
                 labCheckOption.setType(1);
@@ -387,6 +391,8 @@ public class LabCheckOptionServiceImpl implements ILabCheckOptionService {
                     List<LabCheckOption> options = labCheckOptionMapper.selectLabCheckOptionList(labCheckOption);
                     if(options.size() == 0){
                         checkOption = new LabCheckOption();
+                        //设置其他公共字段
+                        SaveUtil.setCommonAttr(labCheckOption);
                         checkOption.setParentId(option3Id);
                         checkOption.setLevel(4);
                         checkOption.setCode("");
@@ -407,6 +413,7 @@ public class LabCheckOptionServiceImpl implements ILabCheckOptionService {
      * 查询检查项选项列表  -- 临时目录
      */
     @Override
+    @DataScope(deptAlias = "d" , userAlias = "t" , permi = PerPrefix.LABORATORY_CHECKOPTION)
     public List<LabCheckOption> selectLabCheckOptionTempList(LabCheckOption labCheckOption) {
 
         labCheckOption.setType(2);

+ 7 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordReleaseServiceImpl.java

@@ -2,7 +2,10 @@ package com.zd.laboratory.service.impl;
 
 import java.util.Date;
 import java.util.List;
+
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.service.TokenService;
 import com.zd.common.security.utils.SaveUtil;
 
@@ -96,7 +99,9 @@ public class LabCheckRecordReleaseServiceImpl implements ILabCheckRecordReleaseS
 
         //获取当前登录用户信息
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
-        labCheckRecordRelease.setCreateByid(sysUser.getUserId());
+        labCheckRecordRelease.setUserId(sysUser.getUserId());
+        labCheckRecordRelease.setDeptId(sysUser.getDeptId());
+        labCheckRecordRelease.setDeptName(sysUser.getDeptName());
         labCheckRecordRelease.setCreateTime(new Date());
 
         //数据入库操作 刷新安全检查表 发布状态
@@ -164,6 +169,7 @@ public class LabCheckRecordReleaseServiceImpl implements ILabCheckRecordReleaseS
      * @return
      */
     @Override
+    @DataScope(deptAlias = "d" , userAlias = "u" , permi = PerPrefix.LABORATORY_RELEASE)
     public List<LabCheckRecordReleaseVO> selectListByParameter(LabCheckRecordReleaseVO labCheckRecordReleaseVO) {
         return labCheckRecordReleaseMapper.selectListByParameter(labCheckRecordReleaseVO);
     }

+ 3 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordServiceImpl.java

@@ -200,7 +200,7 @@ public class LabCheckRecordServiceImpl implements ILabCheckRecordService
             LabCheckRecordRelease lcrr = new LabCheckRecordRelease();
             lcrr.setCheckId(String.valueOf(labCheckRecordVo.getId()));
             lcrr.setReleaseDescribe(labCheckRecordVo.getCheckName());
-            lcrr.setCreateByid(sysUser.getUserId());
+            lcrr.setUserId(sysUser.getUserId());
             lcrr.setCreateBy(sysUser.getNickName());
             lcrr.setCreateTime(new Date());
             iLabCheckRecordReleaseService.insertLabCheckRecordRelease(lcrr);
@@ -268,7 +268,7 @@ public class LabCheckRecordServiceImpl implements ILabCheckRecordService
             LabCheckRecordRelease lcrr = new LabCheckRecordRelease();
             lcrr.setCheckId(String.valueOf(labCheckRecordVo.getId()));
             lcrr.setReleaseDescribe(labCheckRecordVo.getCheckName());
-            lcrr.setCreateByid(sysUser.getUserId());
+            lcrr.setUserId(sysUser.getUserId());
             lcrr.setCreateBy(sysUser.getNickName());
             lcrr.setCreateTime(new Date());
             iLabCheckRecordReleaseService.insertLabCheckRecordRelease(lcrr);
@@ -340,7 +340,7 @@ public class LabCheckRecordServiceImpl implements ILabCheckRecordService
      * @return
      */
     @Override
-//    @DataScope(deptAlias = "t" , userAlias = "t" , permi = PerPrefix.LABORATORY_APPLY)
+    //@DataScope(deptAlias = "d" , userAlias = "u" , permi = PerPrefix.LABORATORY_CHECKRECORD)
     public List<LabSubjectVO> selectInfoByRoom(Map<String, Object> map) {
         logger.error("根据房间号查询实验室信息: " + map.toString());
         return labCheckRecordMapper.selectInfoByRoom(map);

+ 7 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSecurityMaterialDataServiceImpl.java

@@ -1,7 +1,10 @@
 package com.zd.laboratory.service.impl;
 
 import java.util.List;
+
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 
@@ -43,6 +46,7 @@ public class LabSecurityMaterialDataServiceImpl implements ILabSecurityMaterialD
      * @return 安全准入申请材料配置
      */
     @Override
+    @DataScope(deptAlias = "d" , userAlias = "u" , permi = PerPrefix.LABORATORY_MATERIALDATA)
     public List<LabSecurityMaterialData> selectLabSecurityMaterialDataList(LabSecurityMaterialData labSecurityMaterialData)
     {
         return labSecurityMaterialDataMapper.selectLabSecurityMaterialDataList(labSecurityMaterialData);
@@ -72,7 +76,8 @@ public class LabSecurityMaterialDataServiceImpl implements ILabSecurityMaterialD
     public int updateLabSecurityMaterialData(LabSecurityMaterialData labSecurityMaterialData)
     {
         labSecurityMaterialData.setUpdateTime(DateUtils.getNowDate());
-        labSecurityMaterialData.setUpdateBy(SecurityUtils.getUsername());
+        labSecurityMaterialData.setUpdateUsername(SecurityUtils.getUsername());
+        labSecurityMaterialData.setUpdateUserid(SecurityUtils.getUserId());
         return labSecurityMaterialDataMapper.updateLabSecurityMaterialData(labSecurityMaterialData);
     }
 
@@ -151,4 +156,4 @@ public class LabSecurityMaterialDataServiceImpl implements ILabSecurityMaterialD
     public List<LabSecurityMaterialDataVO> selectTemplateStudentList() {
         return labSecurityMaterialDataMapper.selectTemplateStudentList();
     }
-}
+}

+ 14 - 8
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckOptionMapper.xml

@@ -55,26 +55,30 @@
                t.type,
                t.level,
                u.nick_name
-        from lab_check_option as t left join sys_user u on t.user_id = u.user_id
+        from lab_check_option as t
+            left join sys_user u on t.user_id = u.user_id
+            left join sys_dept d on   t.dept_id=d.dept_id
     </sql>
     <select id="selectLabCheckOptionList" parameterType="com.zd.laboratory.domain.LabCheckOption"
             resultMap="LabCheckOptionResult">
-        <include refid="selectLabCheckOptionVo"/>
+        <include refid="selectLabCheckOptionListVo"/>
         <where>
-            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
-            <if test="parentId != null ">and parent_id = #{parentId}</if>
-            <if test="type != null ">and type = #{type}</if>
+            <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>
+            <if test="parentId != null ">and t.parent_id = #{parentId}</if>
+            <if test="type != null ">and t.type = #{type}</if>
             <if test="level != null ">
-                and level != #{level} + 1
+                and t.level != #{level} + 1
             </if>
             <if test="ids!=null and ids.size > 0">
-                AND id IN
+                AND t.id IN
                 <foreach item="item" collection="ids" separator="," open="(" close=")" index="">'${item}'</foreach>
             </if>
             <if test="pIds!=null and pIds.size > 0">
-                AND parent_id IN
+                AND t.parent_id IN
                 <foreach item="item" collection="pIds" separator="," open="(" close=")" index="">'${item}'</foreach>
             </if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         order by code
     </select>
@@ -90,6 +94,8 @@
             <if test="parentId != null ">and t.parent_id = #{parentId}</if>
             <if test="type != null ">and t.type = #{type}</if>
             <if test="userId != null ">and t.user_id = #{userId}</if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         order by t.create_time desc
     </select>

+ 7 - 7
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckRecordMapper.xml

@@ -300,7 +300,7 @@
         </foreach>
     </delete>
 
-    <select id="selectInfoByRoom" parameterType="java.util.Map" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
+    <select id="selectInfoByRoom" parameterType="com.zd.laboratory.domain.vo.LabSubjectVO" resultType="com.zd.laboratory.domain.vo.LabSubjectVO">
         select * from (
         select s.id,s.name,s.dept_id,s.dept_name,
         (select d.dept_name from sys_dept d where d.dept_id= s.build_id ) buildName,
@@ -309,10 +309,10 @@
         (select phonenumber from sys_user u where u.user_id=s.admin_id) safe_user_phone,
         s.admin_id userId,
         l.room
-        from lab_subject_layout l, lab_subject s
-        where l.id= s.layout_id and l.is_subject=1
-        <if test="deptId != null and deptId !=''"> <!-- 实验室名称-->
-            and s.dept_id = #{deptId}
+        from lab_subject_layout l INNER JOIN lab_subject s on l.id= s.layout_id
+        where  l.is_subject=1
+        <if test="deptId != null and deptId !=''"> <!-- 部门id-->
+            and ( s.dept_id in (SELECT dt.dept_id FROM sys_dept dt WHERE find_in_set(#{deptId} ,ancestors )) or s.dept_id = #{deptId} )
         </if>
         <if test="room != null "> <!-- 房间号-->
             and l.room like concat('%', #{room}, '%')
@@ -323,12 +323,12 @@
         <if test="remark != null "> <!-- 用户id-->
             and s.admin_id != #{remark}
         </if>
+        <!-- 数据范围过滤 ${params.dataScope} -->
+
         ) t  where 1=1
         <if test="userName != null "> <!-- 负责人-->
             and t.safe_user like concat('%', #{userName}, '%')
         </if>
-        <!-- 数据范围过滤 ${params.dataScope}-->
-
     </select>
 
     <select id="selectStatusList"  resultType="java.util.Map" parameterType="com.zd.laboratory.domain.vo.LabCheckRecordVO">

+ 28 - 16
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckRecordReleaseMapper.xml

@@ -8,8 +8,10 @@
         <result property="id"    column="id"    />
         <result property="checkId"    column="check_id"    />
         <result property="releaseDescribe"    column="release_describe"    />
-        <result property="createByid"    column="create_byid"    />
+        <result property="userId"    column="user_id"    />
         <result property="createBy"    column="create_by"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
         <result property="createTime"    column="create_time"    />
         <result property="remark"    column="remark"    />
     </resultMap>
@@ -18,24 +20,30 @@
         <result property="id"    column="id"    />
         <result property="checkId"    column="check_id"    />
         <result property="releaseDescribe"    column="release_describe"    />
-        <result property="createByid"    column="create_byid"    />
+        <result property="userId"    column="user_id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="remark"    column="remark"    />
     </resultMap>
 
     <sql id="selectLabCheckRecordReleaseVo">
-        select id, check_id, release_describe, create_byid, create_by, create_time, remark from lab_check_record_release
+        select id, check_id, release_describe, user_id, create_by, dept_id, dept_name, create_time, remark from lab_check_record_release
     </sql>
     <sql id="selectLabCheckRecordReleaseListVo">
-        select t.id, t.check_id, t.release_describe, t.create_byid, t.create_by, t.create_time, t.remark from lab_check_record_release as t
+        select t.id, t.check_id, t.release_describe, t.user_id, t.create_by, t.dept_id, t.dept_name, t.create_time, t.remark from lab_check_record_release as t
     </sql>
     <select id="selectLabCheckRecordReleaseList" parameterType="com.zd.laboratory.domain.LabCheckRecordRelease" resultMap="LabCheckRecordReleaseResult">
         <include refid="selectLabCheckRecordReleaseVo"/>
         <where>
             <if test="checkId != null  and checkId != ''"> and check_id = #{checkId}</if>
             <if test="releaseDescribe != null  and releaseDescribe != ''"> and release_describe = #{releaseDescribe}</if>
-            <if test="createByid != null "> and create_byid = #{createByid}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptName != null "> and dept_name = #{deptName}</if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         order by create_time desc
     </select>
@@ -53,7 +61,7 @@
 
             <if test="releaseDescribe != null">release_describe,</if>
 
-            <if test="createByid != null">create_byid,</if>
+            <if test="userId != null">user_id,</if>
 
             <if test="createBy != null">create_by,</if>
 
@@ -65,7 +73,7 @@
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="checkId != null">#{checkId},</if>
             <if test="releaseDescribe != null">#{releaseDescribe},</if>
-            <if test="createByid != null">#{createByid},</if>
+            <if test="userId != null">#{userId},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="remark != null">#{remark},</if>
@@ -77,7 +85,7 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="checkId != null">check_id = #{checkId},</if>
             <if test="releaseDescribe != null">release_describe = #{releaseDescribe},</if>
-            <if test="createByid != null">create_byid = #{createByid},</if>
+            <if test="userId != null">user_id = #{userId},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="remark != null">remark = #{remark},</if>
@@ -104,32 +112,36 @@
     <!-- 检查该实验室是否已发布-->
     <select id="selectLabCheckRecordReleaseListExist" parameterType="com.zd.laboratory.domain.LabCheckRecordRelease" resultMap="LabCheckRecordReleaseResult">
         select *  from(
-        select id, check_id, release_describe, create_byid, create_by, create_time, remark
+        select id, check_id, release_describe, user_id, create_by, create_time, remark
         from lab_check_record_release
         order by id desc limit 1
         )t where 1=1
         <if test="releaseDescribe != null  and releaseDescribe != ''"> and release_describe = #{releaseDescribe}</if>
-        <if test="createByid != null "> and create_byid = #{createByid}</if>
+        <if test="userId != null "> and user_id = #{userId}</if>
         <if test="checkId != null  and checkId != ''"> and FIND_IN_SET(#{checkId}, check_id)</if>
     </select>
 
     <!-- 额外扩充参数集合查询-->
     <select id="selectListByParameter" parameterType="com.zd.laboratory.domain.vo.LabCheckRecordReleaseVO" resultMap="LabCheckRecordReleaseResultVO">
-        select rr.*,DATE_FORMAT(create_time,'%Y-%m-%d %h:%i') strTime,
+        select rr.*,DATE_FORMAT(rr.create_time,'%Y-%m-%d %h:%i') strTime,
                (length( rr.check_id) - length(REPLACE(rr.check_id,',','' ))+1 ) laboratorNum,
                (select count(1) from lab_check_record cr,lab_check_record_details rd where cr.id in ( rr.check_id) and cr.id = rd.check_id ) laboratorYhsl,
                (select count(1) from lab_check_record cr,lab_check_record_details rd where cr.id in ( rr.check_id) and cr.id = rd.check_id and rd.is_zg=0) laboratorYzg
-        from  lab_check_record_release rr where 1=1
+        from  lab_check_record_release rr
+        LEFT JOIN   sys_dept d on   rr.dept_id=d.dept_id
+        LEFT JOIN sys_user u on  rr.user_id=u.user_id where 1=1
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
-            and create_time &gt;= str_to_date(#{beginTime},'%Y-%m-%d')
+            and rr.create_time &gt;= str_to_date(#{beginTime},'%Y-%m-%d')
         </if>
         <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-            and create_time &lt;= str_to_date(#{endTime},'%Y-%m-%d')
+            and rr.create_time &lt;= str_to_date(#{endTime},'%Y-%m-%d')
         </if>
         <if test="releaseDescribe != null  and releaseDescribe != ''">
-         and release_describe like concat('%', #{releaseDescribe}, '%')
+         and rr.release_describe like concat('%', #{releaseDescribe}, '%')
         </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
         order by rr.create_time desc
     </select>
 
-</mapper>
+</mapper>

+ 127 - 60
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSecurityMaterialDataMapper.xml

@@ -5,68 +5,118 @@
 <mapper namespace="com.zd.laboratory.mapper.LabSecurityMaterialDataMapper">
 
     <resultMap type="com.zd.laboratory.domain.LabSecurityMaterialData" id="LabSecurityMaterialDataResult">
-        <result property="id"    column="id"    />
-        <result property="materialName"    column="material_name"    />
-        <result property="materialDescribe"    column="material_describe"    />
-        <result property="materialSuit"    column="material_suit"    />
-        <result property="materialType"    column="material_type"    />
-        <result property="fileType"    column="file_type"    />
-        <result property="relationType"    column="relation_type"    />
-        <result property="createUserid"    column="create_userid"    />
-        <result property="createUsername"    column="create_username"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateUserid"    column="update_userid"    />
-        <result property="updateUsername"    column="update_username"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="remak"    column="remak"    />
+        <result property="id" column="id"/>
+        <result property="materialName" column="material_name"/>
+        <result property="materialDescribe" column="material_describe"/>
+        <result property="materialSuit" column="material_suit"/>
+        <result property="materialType" column="material_type"/>
+        <result property="fileType" column="file_type"/>
+        <result property="relationType" column="relation_type"/>
+        <result property="userId" column="user_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateUserid" column="update_userid"/>
+        <result property="updateUsername" column="update_username"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remak" column="remak"/>
     </resultMap>
 
     <resultMap type="com.zd.laboratory.domain.vo.LabSecurityMaterialDataVO" id="LabSecurityMaterialDataResultVO">
-        <result property="id"    column="id"    />
-        <result property="materialName"    column="material_name"    />
-        <result property="materialDescribe"    column="material_describe"    />
-        <result property="materialSuit"    column="material_suit"    />
-        <result property="materialType"    column="material_type"    />
-        <result property="fileType"    column="file_type"    />
-        <result property="relationType"    column="relation_type"    />
-        <result property="createUserid"    column="create_userid"    />
-        <result property="createUsername"    column="create_username"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateUserid"    column="update_userid"    />
-        <result property="updateUsername"    column="update_username"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="remak"    column="remak"    />
+        <result property="id" column="id"/>
+        <result property="materialName" column="material_name"/>
+        <result property="materialDescribe" column="material_describe"/>
+        <result property="materialSuit" column="material_suit"/>
+        <result property="materialType" column="material_type"/>
+        <result property="fileType" column="file_type"/>
+        <result property="relationType" column="relation_type"/>
+        <result property="userId" column="user_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateUserid" column="update_userid"/>
+        <result property="updateUsername" column="update_username"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remak" column="remak"/>
     </resultMap>
 
     <sql id="selectLabSecurityMaterialDataVo">
-        select id, material_name, material_describe, material_suit, material_type,file_type ,relation_type, create_userid, create_username, create_time, update_userid, update_username, update_time, remak from lab_security_material_data
+        select id,
+               material_name,
+               material_describe,
+               material_suit,
+               material_type,
+               file_type,
+               relation_type,
+               user_id,
+               create_by,
+               dept_id,
+               dept_name,
+               create_time,
+               update_userid,
+               update_username,
+               update_time,
+               remak
+        from lab_security_material_data
     </sql>
     <sql id="selectLabSecurityMaterialDataListVo">
-        select t.id, t.material_name, t.material_describe, t.material_suit, t.material_type,t.file_type ,t.relation_type, t.create_userid, t.create_username, t.create_time, t.update_userid, t.update_username, t.update_time, t.remak from lab_security_material_data as t
+        select t.id,
+               t.material_name,
+               t.material_describe,
+               t.material_suit,
+               t.material_type,
+               t.file_type,
+               t.relation_type,
+               t.user_id,
+               t.create_by,
+               t.dept_id,
+               t.dept_name,
+               t.create_time,
+               t.update_userid,
+               t.update_username,
+               t.update_time,
+               t.remak
+        from lab_security_material_data as t
+                 LEFT JOIN   sys_dept d on   t.dept_id=d.dept_id
+                 LEFT JOIN sys_user u on  t.user_id=u.user_id
     </sql>
-    <select id="selectLabSecurityMaterialDataList" parameterType="com.zd.laboratory.domain.LabSecurityMaterialData" resultMap="LabSecurityMaterialDataResult">
-        <include refid="selectLabSecurityMaterialDataVo"/>
+    <select id="selectLabSecurityMaterialDataList" parameterType="com.zd.laboratory.domain.LabSecurityMaterialData"
+            resultMap="LabSecurityMaterialDataResult">
+        <include refid="selectLabSecurityMaterialDataListVo"/>
         <where>
-            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
-            <if test="materialDescribe != null  and materialDescribe != ''"> and material_describe = #{materialDescribe}</if>
-            <if test="materialSuit != null "> and material_suit = #{materialSuit}</if>
-            <if test="materialType != null "> and material_type = #{materialType}</if>
-            <if test="materialType != null "> and relation_type = #{relationType}</if>
-            <if test="createUserid != null "> and create_userid = #{createUserid}</if>
-            <if test="createUsername != null  and createUsername != ''"> and create_username like concat('%', #{createUsername}, '%')</if>
-            <if test="updateUserid != null "> and update_userid = #{updateUserid}</if>
-            <if test="updateUsername != null  and updateUsername != ''"> and update_username like concat('%', #{updateUsername}, '%')</if>
-            <if test="remak != null  and remak != ''"> and remak = #{remak}</if>
+            <if test="materialName != null  and materialName != ''">and t.material_name like concat('%', #{materialName},
+                '%')
+            </if>
+            <if test="materialDescribe != null  and materialDescribe != ''">and t.material_describe =
+                #{materialDescribe}
+            </if>
+            <if test="materialSuit != null ">and t.material_suit = #{materialSuit}</if>
+            <if test="materialType != null ">and t.material_type = #{materialType}</if>
+            <if test="materialType != null ">and t.relation_type = #{relationType}</if>
+            <if test="userId != null ">and t.user_id = #{userId}</if>
+            <if test="createBy != null  and createBy != ''">and t.create_by like concat('%',
+                #{createBy}, '%')
+            </if>
+            <if test="updateUserid != null ">and t.update_userid = #{updateUserid}</if>
+            <if test="updateUsername != null  and updateUsername != ''">and t.update_username like concat('%',
+                #{updateUsername}, '%')
+            </if>
+            <if test="remak != null  and remak != ''">and t.remak = #{remak}</if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         order by create_time desc
     </select>
 
-    <select id="selectLabSecurityMaterialDataById"  resultMap="LabSecurityMaterialDataResult">
+    <select id="selectLabSecurityMaterialDataById" resultMap="LabSecurityMaterialDataResult">
         <include refid="selectLabSecurityMaterialDataVo"/>
         where id = #{id}
     </select>
 
-    <insert id="insertLabSecurityMaterialData" parameterType="com.zd.laboratory.domain.LabSecurityMaterialData" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertLabSecurityMaterialData" parameterType="com.zd.laboratory.domain.LabSecurityMaterialData"
+            useGeneratedKeys="true" keyProperty="id">
         insert into lab_security_material_data
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="materialName != null">material_name,</if>
@@ -81,9 +131,13 @@
 
             <if test="relationType != null">relation_type,</if>
 
-            <if test="createUserid != null">create_userid,</if>
+            <if test="userId != null">user_id,</if>
+
+            <if test="createBy != null">create_by,</if>
 
-            <if test="createUsername != null">create_username,</if>
+            <if test="deptId != null">dept_id,</if>
+
+            <if test="deptName != null">dept_name,</if>
 
             <if test="createTime != null">create_time,</if>
 
@@ -103,8 +157,10 @@
             <if test="materialType != null">#{materialType},</if>
             <if test="fileType != null">#{fileType},</if>
             <if test="relationType != null">#{relationType},</if>
-            <if test="createUserid != null">#{createUserid},</if>
-            <if test="createUsername != null">#{createUsername},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateUserid != null">#{updateUserid},</if>
             <if test="updateUsername != null">#{updateUsername},</if>
@@ -122,8 +178,10 @@
             <if test="materialType != null">material_type = #{materialType},</if>
             <if test="fileType != null">file_type = #{fileType},</if>
             <if test="relationType != null">relation_type = #{relationType},</if>
-            <if test="createUserid != null">create_userid = #{createUserid},</if>
-            <if test="createUsername != null">create_username = #{createUsername},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateUserid != null">update_userid = #{updateUserid},</if>
             <if test="updateUsername != null">update_username = #{updateUsername},</if>
@@ -133,8 +191,10 @@
         where id = #{id}
     </update>
 
-    <delete id="deleteLabSecurityMaterialDataById" >
-        delete from lab_security_material_data where id = #{id}
+    <delete id="deleteLabSecurityMaterialDataById">
+        delete
+        from lab_security_material_data
+        where id = #{id}
     </delete>
 
     <delete id="deleteLabSecurityMaterialDataByIds">
@@ -153,22 +213,29 @@
         </foreach>
     </select>
 
-    <select id="selectLabSecurityMaterialDataTeacher"  resultMap="LabSecurityMaterialDataResultVO">
+    <select id="selectLabSecurityMaterialDataTeacher" resultMap="LabSecurityMaterialDataResultVO">
         SELECT d.* FROM lab_security_material_data d, lab_security_subjectmaterial s
         WHERE d.id=s.material_id AND s.material_type in(1,2)
-        <if test="subjectId != null "> and s.subject_id = #{subjectId}</if>
+        <if test="subjectId != null ">and s.subject_id = #{subjectId}</if>
     </select>
 
-    <select id="selectLabSecurityMaterialDataStudent"  resultMap="LabSecurityMaterialDataResultVO">
+    <select id="selectLabSecurityMaterialDataStudent" resultMap="LabSecurityMaterialDataResultVO">
         SELECT d.* FROM lab_security_material_data d, lab_security_subjectmaterial s
         WHERE d.id=s.material_id AND s.material_type in(1,3)
-        <if test="subjectId != null "> and s.subject_id = #{subjectId}</if>
+        <if test="subjectId != null ">and s.subject_id = #{subjectId}</if>
     </select>
 
-    <select id="selectTemplateTeacherList" parameterType="com.zd.laboratory.domain.vo.LabSecurityMaterialDataVO" resultMap="LabSecurityMaterialDataResult">
-        SELECT * FROM lab_security_material_data md WHERE md.material_suit IN(1,2) AND (md.relation_type IS NULL OR md.relation_type!=2)
+    <select id="selectTemplateTeacherList" parameterType="com.zd.laboratory.domain.vo.LabSecurityMaterialDataVO"
+            resultMap="LabSecurityMaterialDataResult">
+        SELECT *
+        FROM lab_security_material_data md
+        WHERE md.material_suit IN (1, 2)
+          AND (md.relation_type IS NULL OR md.relation_type!=2)
     </select>
-    <select id="selectTemplateStudentList" parameterType="com.zd.laboratory.domain.vo.LabSecurityMaterialDataVO" resultMap="LabSecurityMaterialDataResult">
-        SELECT * FROM lab_security_material_data md WHERE md.material_suit IN(1,3)
+    <select id="selectTemplateStudentList" parameterType="com.zd.laboratory.domain.vo.LabSecurityMaterialDataVO"
+            resultMap="LabSecurityMaterialDataResult">
+        SELECT *
+        FROM lab_security_material_data md
+        WHERE md.material_suit IN (1, 3)
     </select>
 </mapper>