Forráskód Böngészése

2024/1/5 预案查询统计添加权限

chaiyunlong 2 éve
szülő
commit
2b19a43763

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerV2Controller.java

@@ -116,6 +116,10 @@ public class LabSubMangerV2Controller extends BaseController {
     @GetMapping("/admin/subandwran/count")
     public ResultData<AdminWranCount> querySubandwranCount() {
         LabSubject subject = new LabSubject();
+        //查询登录人管理的实验室列表
+        if(!tokenService.getLoginUser().getUsername().equals("admin")){
+            subject.setLoginUserId(tokenService.getLoginUser().getUserid());
+        }
         AdminWranCount adminWranCount = new AdminWranCount();
         //实验室数量 数据权限+业务权限
         int i = 0;
@@ -135,6 +139,10 @@ public class LabSubMangerV2Controller extends BaseController {
         adminWranCount.setAdminSubCount(i);
         // 预案执行记录 需要老柴提供
         LabRiskPlanAbnormalLogVO labRiskPlanAbnormalLogVo = new LabRiskPlanAbnormalLogVO();
+        //查询登录人管理的实验室列表
+        if(!tokenService.getLoginUser().getUsername().equals("admin")){
+            labRiskPlanAbnormalLogVo.setLoginUserId(tokenService.getLoginUser().getUserid());
+        }
         Map<String, Integer> riskPlanMap = labRiskPlanAbnormalLogService.selectLabRiskPlanAppCount(labRiskPlanAbnormalLogVo);
         String allday = riskPlanMap.get("allday") + "";
         adminWranCount.setWranDoCount(Integer.parseInt(allday));

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

@@ -222,6 +222,9 @@
         <where>
            l.`risk_status`=1
            AND DATE_FORMAT(g.`create_time`, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
+           <if test="loginUserId != null ">
+              and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+           </if>
            ${params.dataScope}
         </where>
 
@@ -232,6 +235,9 @@
         <where>
            l.`risk_status`=1
            AND DATE_FORMAT(g.`create_time`, '%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')
+           <if test="loginUserId != null ">
+               and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+           </if>
             ${params.dataScope}
         </where>
 
@@ -241,6 +247,9 @@
         INNER JOIN lab_risk_plan_abnormal_log l ON g.`id` = l.`group_id`
         <where>
            l.`risk_status`=1
+           <if test="loginUserId != null ">
+               and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+           </if>
            ${params.dataScope}
         </where>
         )xx

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

@@ -592,6 +592,9 @@
             <if test="deptId != null">
                 and dept_id = #{deptId}
             </if>
+            <if test="loginUserId != null ">
+                and (t.`admin_id` = #{loginUserId} or find_in_set(#{loginUserId},t.`safe_user_id`))
+            </if>
             <!-- 数据范围过滤 -->
             ${params.dataScope}
         </where>