Pārlūkot izejas kodu

2024/1/5 预案执行记录添加权限过滤查询

chaiyunlong 2 gadi atpakaļ
vecāks
revīzija
47a5cb8c9f

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

@@ -33,6 +33,9 @@ public class LabRiskPlanAbnormalLogVO extends LabRiskPlanAbnormalLog {
     @ApiModelProperty(value = "实验室管理员id")
     private Long adminId;
 
+    @ApiModelProperty(value = "登录人id")
+    private Long loginUserId;
+
     @ApiModelProperty(value = "风险级别")
     private Long typeId;
 
@@ -100,6 +103,14 @@ public class LabRiskPlanAbnormalLogVO extends LabRiskPlanAbnormalLog {
         this.adminId = adminId;
     }
 
+    public Long getLoginUserId() {
+        return loginUserId;
+    }
+
+    public void setLoginUserId(Long loginUserId) {
+        this.loginUserId = loginUserId;
+    }
+
     public Long getTypeId() {
         return typeId;
     }

+ 9 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalLogServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.zd.algorithm.api.alarm.entity.AlarmLog;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.redis.RedisService;
+import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.laboratory.config.HardwareFunctionStatusConfig;
@@ -48,6 +49,9 @@ public class LabRiskPlanAbnormalLogServiceImpl implements ILabRiskPlanAbnormalLo
     @Autowired
     private RedisService redisService;
 
+    @Autowired
+    private TokenService tokenService;
+
     /**
      * 查询风险异常日志
      *
@@ -405,7 +409,11 @@ public class LabRiskPlanAbnormalLogServiceImpl implements ILabRiskPlanAbnormalLo
     @Override
     @DataScope(deptAlias = "t", userAlias = "t", subAdmin = true)
     public List<SubDiyAppVO> adminSubByRiskPlan(LabRiskPlanAbnormalLogVO labRiskPlanAbnormalLogVo) {
-        labRiskPlanAbnormalLogVo.setAdminId(SecurityUtils.getUserId());
+        //查询登录人管理的实验室列表
+        if(!tokenService.getLoginUser().getUsername().equals("admin")){
+            labRiskPlanAbnormalLogVo.setLoginUserId(tokenService.getLoginUser().getUserid());
+        }
+//        labRiskPlanAbnormalLogVo.setAdminId(SecurityUtils.getUserId());
         labRiskPlanAbnormalLogVo.setRiskStatus(1L);
         List<LabRiskPlanAbnormalLogVO> riskPlanLogList = labRiskPlanAbnormalLogMapper.adminSubByRiskPlan(labRiskPlanAbnormalLogVo);
         List<SubDiyAppVO> subRiskPlanList = new ArrayList();

+ 3 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalLogMapper.xml

@@ -278,6 +278,9 @@
             <!--<if test="adminId != null ">-->
                 <!--and s.`admin_id` = ${adminId}-->
             <!--</if>-->
+            <if test="loginUserId != null ">
+                and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+            </if>
             <if test="typeId != null ">
                 and t.`level` = ${typeId}
             </if>

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

@@ -321,7 +321,7 @@
             <if test="isDel != null ">and is_del = #{isDel}</if>
             <if test="userId != null ">and user_id = #{userId}</if>
             <if test="loginUserId != null ">
-                (`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},`safe_user_id`))
+                and (`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},`safe_user_id`))
             </if>
             <!-- 数据范围过滤 -->
             ${params.dataScope}
@@ -398,7 +398,7 @@
                 or t.room like concat('%', #{searchValue}, '%'))
             </if>
             <if test="loginUserId != null ">
-                (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+                and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
             </if>
             <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>
             <if test="adminName != null  and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>
@@ -488,7 +488,7 @@
                 or t.room like concat('%', #{searchValue}, '%'))
             </if>
             <if test="loginUserId != null ">
-                (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+                and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
             </if>
             <if test="name != null  and name != ''">and t.name like concat('%', #{name}, '%')</if>
             <if test="adminName != null  and adminName != ''">and su.nick_name like concat('%', #{adminName}, '%')</if>