Ver código fonte

-添加人员权限

jiangbiao 2 anos atrás
pai
commit
7876b4f325
36 arquivos alterados com 473 adições e 157 exclusões
  1. 29 0
      master/src/main/java/com/ruoyi/common/annotation/DataScopePlant.java
  2. 7 2
      master/src/main/java/com/ruoyi/common/enums/BusinessType.java
  3. 169 0
      master/src/main/java/com/ruoyi/framework/aspectj/DataScopePlantAspect.java
  4. 28 1
      master/src/main/java/com/ruoyi/project/base/controller/TBasePlantController.java
  5. 3 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBaseDeviceMapper.java
  6. 7 1
      master/src/main/java/com/ruoyi/project/base/mapper/TBasePlantMapper.java
  7. 3 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBasePointMapper.java
  8. 3 0
      master/src/main/java/com/ruoyi/project/base/mapper/TBaseRegionMapper.java
  9. 1 1
      master/src/main/java/com/ruoyi/project/base/service/impl/TBasePlantServiceImpl.java
  10. 2 2
      master/src/main/java/com/ruoyi/project/check/controller/TCheckCheckpointsController.java
  11. 2 0
      master/src/main/java/com/ruoyi/project/check/mapper/TCheckCheckpointsMapper.java
  12. 3 0
      master/src/main/java/com/ruoyi/project/check/mapper/TCheckEnvironmentMapper.java
  13. 2 0
      master/src/main/java/com/ruoyi/project/check/mapper/TCheckRepairpointsMapper.java
  14. 2 0
      master/src/main/java/com/ruoyi/project/check/mapper/TCheckStandardgasesMapper.java
  15. 6 0
      master/src/main/java/com/ruoyi/project/statistics/mapper/StatisticsMapper.java
  16. 3 0
      master/src/main/java/com/ruoyi/project/task/mapper/TTaskInspectionMapper.java
  17. 2 0
      master/src/main/java/com/ruoyi/project/task/mapper/TTaskInspectionPlanMapper.java
  18. 2 0
      master/src/main/java/com/ruoyi/project/task/mapper/TTaskRepairMapper.java
  19. 3 1
      master/src/main/resources/mybatis/base/TBaseDeviceMapper.xml
  20. 9 1
      master/src/main/resources/mybatis/base/TBasePlantMapper.xml
  21. 9 3
      master/src/main/resources/mybatis/base/TBasePointMapper.xml
  22. 2 0
      master/src/main/resources/mybatis/base/TBaseRegionMapper.xml
  23. 8 43
      master/src/main/resources/mybatis/check/TCheckCheckpointsMapper.xml
  24. 2 0
      master/src/main/resources/mybatis/check/TCheckEnvironmentMapper.xml
  25. 6 2
      master/src/main/resources/mybatis/check/TCheckInstrumentMapper.xml
  26. 123 80
      master/src/main/resources/mybatis/check/TCheckRepairpointsMapper.xml
  27. 4 1
      master/src/main/resources/mybatis/check/TCheckStandardgasesMapper.xml
  28. 7 1
      master/src/main/resources/mybatis/statistics/StatisticsMapper.xml
  29. 2 0
      master/src/main/resources/mybatis/task/TTaskInspectionMapper.xml
  30. 2 0
      master/src/main/resources/mybatis/task/TTaskInspectionPlanMapper.xml
  31. 2 0
      master/src/main/resources/mybatis/task/TTaskRepairMapper.xml
  32. 1 1
      ui/src/api/check/checkpoints.js
  33. 10 11
      ui/src/views/statistics/index.vue
  34. 3 2
      ui/src/views/statistics/pie/jplPieChart.vue
  35. 3 2
      ui/src/views/statistics/pie/pflPieChart.vue
  36. 3 2
      ui/src/views/statistics/pie/xllPieChart.vue

+ 29 - 0
master/src/main/java/com/ruoyi/common/annotation/DataScopePlant.java

@@ -0,0 +1,29 @@
+package com.ruoyi.common.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 数据权限过滤注解
+ *
+ * @author ruoyi
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface DataScopePlant
+{
+    /**
+     * 部门表的别名
+     */
+    public String deptAlias() default "";
+
+    /**
+     * 用户表的别名
+     */
+    public String userAlias() default "";
+
+    /**
+     * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
+     */
+    public String permission() default "";
+}

+ 7 - 2
master/src/main/java/com/ruoyi/common/enums/BusinessType.java

@@ -2,7 +2,7 @@ package com.ruoyi.common.enums;
 
 /**
  * 业务操作类型
- * 
+ *
  * @author ruoyi
  */
 public enum BusinessType
@@ -51,9 +51,14 @@ public enum BusinessType
      * 生成代码
      */
     GENCODE,
-    
+
     /**
      * 清空数据
      */
     CLEAN,
+
+    /**
+     * 审核
+     */
+    APPROVE,
 }

+ 169 - 0
master/src/main/java/com/ruoyi/framework/aspectj/DataScopePlantAspect.java

@@ -0,0 +1,169 @@
+package com.ruoyi.framework.aspectj;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.annotation.DataScopePlant;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.context.PermissionContextHolder;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 数据过滤处理
+ *
+ * @author ruoyi
+ */
+@Aspect
+@Component
+public class DataScopePlantAspect
+{
+    /**
+     * 全部数据权限
+     */
+    public static final String DATA_SCOPE_ALL = "1";
+
+    /**
+     * 自定数据权限
+     */
+    public static final String DATA_SCOPE_CUSTOM = "2";
+
+    /**
+     * 部门数据权限
+     */
+    public static final String DATA_SCOPE_DEPT = "3";
+
+    /**
+     * 部门及以下数据权限
+     */
+    public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
+
+    /**
+     * 仅本人数据权限
+     */
+    public static final String DATA_SCOPE_SELF = "5";
+
+    /**
+     * 数据权限过滤关键字
+     */
+    public static final String DATA_SCOPE = "dataScopePlant";
+
+    @Before("@annotation(controllerDataScope)")
+    public void doBefore(JoinPoint point, DataScopePlant controllerDataScope) throws Throwable
+    {
+        clearDataScope(point);
+        handleDataScope(point, controllerDataScope);
+    }
+
+    protected void handleDataScope(final JoinPoint joinPoint, DataScopePlant controllerDataScope)
+    {
+        // 获取当前的用户
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (StringUtils.isNotNull(loginUser))
+        {
+            SysUser currentUser = loginUser.getUser();
+            // 如果是超级管理员,则不过滤数据
+            if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
+            {
+                String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext());
+                dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
+                        controllerDataScope.userAlias(), permission);
+            }
+        }
+    }
+
+    /**
+     * 数据范围过滤
+     *
+     * @param joinPoint 切点
+     * @param user 用户
+     * @param deptAlias 部门别名
+     * @param userAlias 用户别名
+     * @param permission 权限字符
+     */
+    public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
+    {
+        StringBuilder sqlString = new StringBuilder();
+        List<String> conditions = new ArrayList<String>();
+
+        for (SysRole role : user.getRoles())
+        {
+            String dataScope = role.getDataScope();
+            if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope))
+            {
+                continue;
+            }
+            if (StringUtils.isNotEmpty(permission) && StringUtils.isNotEmpty(role.getPermissions())
+                    && !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
+            {
+                continue;
+            }
+            if (DATA_SCOPE_ALL.equals(dataScope))
+            {
+                sqlString = new StringBuilder();
+                break;
+            }
+            else if (DATA_SCOPE_CUSTOM.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(
+                        " OR {}.plant_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
+                        role.getRoleId()));
+            }
+            else if (DATA_SCOPE_DEPT.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(" OR {}.plant_id = {} ", deptAlias, user.getDeptId()));
+            }
+            else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(
+                        " OR {}.plant_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
+                        deptAlias, user.getDeptId(), user.getDeptId()));
+            }
+            else if (DATA_SCOPE_SELF.equals(dataScope))
+            {
+                if (StringUtils.isNotBlank(userAlias))
+                {
+                    sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
+                }
+                else
+                {
+                    // 数据权限为仅本人且没有userAlias别名不查询任何数据
+                    sqlString.append(StringUtils.format(" OR {}.plant_id = 0 ", deptAlias));
+                }
+            }
+            conditions.add(dataScope);
+        }
+
+        if (StringUtils.isNotBlank(sqlString.toString()))
+        {
+            Object params = joinPoint.getArgs()[0];
+            if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
+            {
+                BaseEntity baseEntity = (BaseEntity) params;
+                baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
+            }
+        }
+    }
+
+    /**
+     * 拼接权限sql前先清空params.dataScope参数防止注入
+     */
+    private void clearDataScope(final JoinPoint joinPoint)
+    {
+        Object params = joinPoint.getArgs()[0];
+        if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
+        {
+            BaseEntity baseEntity = (BaseEntity) params;
+            baseEntity.getParams().put(DATA_SCOPE, "");
+        }
+    }
+}

+ 28 - 1
master/src/main/java/com/ruoyi/project/base/controller/TBasePlantController.java

@@ -3,6 +3,10 @@ package com.ruoyi.project.base.controller;
 import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.system.service.ISysDeptService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,6 +39,9 @@ public class TBasePlantController extends BaseController
     @Autowired
     private ITBasePlantService tBasePlantService;
 
+    @Autowired
+    private ISysDeptService deptService;
+
     /**
      * 查询装置列表
      */
@@ -121,6 +128,26 @@ public class TBasePlantController extends BaseController
     @PutMapping("/handleApprove")
     public AjaxResult handleApprove(@RequestBody TBasePlant tBasePlant){
         tBasePlant.setApproveTime(new Date());
-        return toAjax(tBasePlantService.updateTBasePlantByPlantIds(tBasePlant));
+        int i = tBasePlantService.updateTBasePlantByPlantIds(tBasePlant);
+        if (i >0){
+            for (Long plantId : tBasePlant.getPlantIds()) {
+                TBasePlant plant = tBasePlantService.selectTBasePlantById(plantId);
+                List<SysDept> sysDepts = deptService.selectDeptList(new SysDept());
+                SysDept dept = new SysDept();
+                dept.setDeptId(plantId);
+                dept.setParentId(100L);
+                dept.setDeptName(plant.getPlantName());
+                dept.setOrderNum(sysDepts.size());
+                dept.setStatus("0");
+                if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+                {
+                    return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+                }
+                dept.setCreateBy(getUsername());
+                deptService.insertDept(dept);
+            }
+
+        }
+        return AjaxResult.success();
     }
 }

+ 3 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBaseDeviceMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.base.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.base.domain.TBaseDevice;
 import com.ruoyi.project.base.domain.TBasePoint;
 
@@ -29,6 +31,7 @@ public interface TBaseDeviceMapper
      * @param tBaseDevice 设备/管线
      * @return 设备/管线集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TBaseDevice> selectTBaseDeviceList(TBaseDevice tBaseDevice);
     public List<TBaseDevice> selectAllDeviceByRegionId(Long regionId);
 

+ 7 - 1
master/src/main/java/com/ruoyi/project/base/mapper/TBasePlantMapper.java

@@ -1,6 +1,9 @@
 package com.ruoyi.project.base.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.base.domain.TBasePlant;
 
 /**
@@ -26,8 +29,11 @@ public interface TBasePlantMapper
      * @param tBasePlant 装置
      * @return 装置集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TBasePlant> selectTBasePlantList(TBasePlant tBasePlant);
-    public List<TBasePlant> selectAllPlantName();
+
+    @DataScopePlant(deptAlias = "d")
+    public List<TBasePlant> selectAllPlantName(TBasePlant tBasePlant);
 
     /**
      * 新增装置

+ 3 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBasePointMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.base.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.base.domain.TBasePoint;
 import org.apache.ibatis.annotations.Param;
 
@@ -29,8 +30,10 @@ public interface TBasePointMapper extends BaseMapper<TBasePoint>
      * @param tBasePoint 密封点
      * @return 密封点集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TBasePoint> selectTBasePointList(TBasePoint tBasePoint);
 
+    @DataScopePlant(deptAlias = "d")
     public List<TBasePoint> selectTBasePointListByPlan(TBasePoint tBasePoint);
     public List<TBasePoint> selectTBasePointListNotInPlan(TBasePoint tBasePoint);
 

+ 3 - 0
master/src/main/java/com/ruoyi/project/base/mapper/TBaseRegionMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.base.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.base.domain.TBaseRegion;
 import org.apache.ibatis.annotations.Param;
 
@@ -27,6 +29,7 @@ public interface TBaseRegionMapper
      * @param tBaseRegion 区域
      * @return 区域集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TBaseRegion> selectTBaseRegionList(TBaseRegion tBaseRegion);
     public List<TBaseRegion> selectAllRegionByPlantId(Long plantId);
 

+ 1 - 1
master/src/main/java/com/ruoyi/project/base/service/impl/TBasePlantServiceImpl.java

@@ -51,7 +51,7 @@ public class TBasePlantServiceImpl implements ITBasePlantService
 @Override
     public List<TBasePlant> selectAllPlantName()
     {
-        return tBasePlantMapper.selectAllPlantName();
+        return tBasePlantMapper.selectAllPlantName(new TBasePlant());
     }
 
     /**

+ 2 - 2
master/src/main/java/com/ruoyi/project/check/controller/TCheckCheckpointsController.java

@@ -132,14 +132,14 @@ public class TCheckCheckpointsController extends BaseController {
 
     @PreAuthorize("@ss.hasPermi('check:checkpoints:edit')")
     @Log(title = "审核检测结果", businessType = BusinessType.UPDATE)
-    @PutMapping("/toApprove")
+    @PostMapping("/toApprove")
     public AjaxResult toApprove(@RequestBody TCheckCheckpoints tCheckCheckpoints) {
         return tCheckCheckpointsService.toApprove(tCheckCheckpoints);
     }
 
     @PreAuthorize("@ss.hasPermi('check:checkpoints:edit')")
     @Log(title = "审核检测结果", businessType = BusinessType.UPDATE)
-    @PutMapping("/approveAll")
+    @PostMapping("/approveAll")
     public AjaxResult approveAll(@RequestBody TCheckCheckpoints tCheckCheckpoints) {
         return tCheckCheckpointsService.approveAll(tCheckCheckpoints);
     }

+ 2 - 0
master/src/main/java/com/ruoyi/project/check/mapper/TCheckCheckpointsMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.check.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.base.domain.TBasePoint;
 import com.ruoyi.project.check.domain.TCheckCheckpoints;
 
@@ -28,6 +29,7 @@ public interface TCheckCheckpointsMapper  extends BaseMapper<TCheckCheckpoints>
      * @param tCheckCheckpoints 检测点
      * @return 检测点集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TCheckCheckpoints> selectTCheckCheckpointsList(TCheckCheckpoints tCheckCheckpoints);
     public TCheckCheckpoints selectTCheckCheckpointByEntity(TCheckCheckpoints tCheckCheckpoints);
     public List<TCheckCheckpoints> selectPointsByIds(Long[] ids);

+ 3 - 0
master/src/main/java/com/ruoyi/project/check/mapper/TCheckEnvironmentMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.check.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.check.domain.TCheckEnvironment;
 
 /**
@@ -25,6 +27,7 @@ public interface TCheckEnvironmentMapper
      * @param tCheckEnvironment 环境本底值记录
      * @return 环境本底值记录集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TCheckEnvironment> selectTCheckEnvironmentList(TCheckEnvironment tCheckEnvironment);
 
     /**

+ 2 - 0
master/src/main/java/com/ruoyi/project/check/mapper/TCheckRepairpointsMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.check.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.check.domain.TCheckCheckpoints;
 import com.ruoyi.project.check.domain.TCheckRepairpoints;
 
@@ -28,6 +29,7 @@ public interface TCheckRepairpointsMapper  extends BaseMapper<TCheckRepairpoints
      * @param tCheckRepairpoints 维修点
      * @return 维修点集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TCheckRepairpoints> selectTCheckRepairpointsList(TCheckRepairpoints tCheckRepairpoints);
 
     public List<TCheckRepairpoints> selectTCheckRepairpointsByIds(Long[] ids);

+ 2 - 0
master/src/main/java/com/ruoyi/project/check/mapper/TCheckStandardgasesMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.check.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.check.domain.TCheckStandardgases;
 
 /**

+ 6 - 0
master/src/main/java/com/ruoyi/project/statistics/mapper/StatisticsMapper.java

@@ -1,10 +1,13 @@
 package com.ruoyi.project.statistics.mapper;
 
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.statistics.domain.Statistics;
 
 import java.util.List;
 
 public interface StatisticsMapper {
+
+    @DataScopePlant(deptAlias = "d")
     public List<Statistics> countPlant(Statistics statistics);
 
     public Statistics countDevice(Statistics statistics);
@@ -13,6 +16,9 @@ public interface StatisticsMapper {
 
     public List<Statistics> countXlcd(Statistics statistics);
 
+    @DataScopePlant(deptAlias = "d")
     public List<Statistics> countPfl(Statistics statistics);
+
+    @DataScopePlant(deptAlias = "d")
     public List<Statistics> countXlcdByPoint(Statistics statistics);
 }

+ 3 - 0
master/src/main/java/com/ruoyi/project/task/mapper/TTaskInspectionMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.task.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.task.domain.TTaskInspection;
 
 /**
@@ -25,6 +27,7 @@ public interface TTaskInspectionMapper
      * @param tTaskInspection 检测任务
      * @return 检测任务集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TTaskInspection> selectTTaskInspectionList(TTaskInspection tTaskInspection);
 
     /**

+ 2 - 0
master/src/main/java/com/ruoyi/project/task/mapper/TTaskInspectionPlanMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.task.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.task.domain.TTaskInspectionPlan;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -29,6 +30,7 @@ public interface TTaskInspectionPlanMapper extends BaseMapper<TTaskInspectionPla
      * @param tTaskInspectionPlan 检测计划
      * @return 检测计划集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TTaskInspectionPlan> selectTTaskInspectionPlanList(TTaskInspectionPlan tTaskInspectionPlan);
     public List<TTaskInspectionPlan> selectAllPlan();
 

+ 2 - 0
master/src/main/java/com/ruoyi/project/task/mapper/TTaskRepairMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.task.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.annotation.DataScopePlant;
 import com.ruoyi.project.task.domain.TTaskRepair;
 
 /**
@@ -27,6 +28,7 @@ public interface TTaskRepairMapper extends BaseMapper<TTaskRepair>
      * @param tTaskRepair 维修任务
      * @return 维修任务集合
      */
+    @DataScopePlant(deptAlias = "d")
     public List<TTaskRepair> selectTTaskRepairList(TTaskRepair tTaskRepair);
 
     /**

+ 3 - 1
master/src/main/resources/mybatis/base/TBaseDeviceMapper.xml

@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTBaseDeviceVo">
-        select dev_id, plant_id, region_id, `dev_code`, `dev_describe`, remarks, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate,material,material_status,response_factor,response_factor_from from t_base_device
+        select d.dev_id, d.plant_id, d.region_id, d.`dev_code`, d.`dev_describe`, d.remarks, d.approve_status, d.approve_time, d.dept_id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate,d.material,d.material_status,d.response_factor,d.response_factor_from from t_base_device d
     </sql>
 
     <select id="selectTBaseDeviceList" parameterType="TBaseDevice" resultMap="TBaseDeviceResult">
@@ -53,6 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
             and d.del_flag=0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectAllDeviceByRegionId" parameterType="long" resultMap="TBaseDeviceResult">

+ 9 - 1
master/src/main/resources/mybatis/base/TBasePlantMapper.xml

@@ -28,7 +28,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectAllPlantName" resultMap="TBasePlantResult">
-        select d.company,d.plant_id,d.plant_name,d.plant_type from t_base_plant d where del_flag=0 and approve_status=2
+        select d.company,d.plant_id,d.plant_name,d.plant_type from t_base_plant d
+        <where>
+            and del_flag=0
+            and approve_status=2
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTBasePlantList" parameterType="TBasePlant" resultMap="TBasePlantResult">
@@ -51,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and updatedate = #{updatedate}</if>
             and d.del_flag=0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTBasePlantById" parameterType="Long" resultMap="TBasePlantResult">

+ 9 - 3
master/src/main/resources/mybatis/base/TBasePointMapper.xml

@@ -102,6 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
             and d.del_flag=0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTBasePointListByPlan" parameterType="TBasePoint" resultMap="TBasePointResult">
@@ -111,9 +113,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              left join t_base_plant bp on bp.plant_id = d.plant_id
              left join t_base_region br on br.region_id = d.region_id
              left join t_base_device bd on bd.dev_id = d.dev_id
-    where point_id in (select point_id
-                       from t_check_checkpoints
-                       where plan_id = #{planId})
+        <where>
+            and point_id in (select point_id
+            from t_check_checkpoints
+            where plan_id = #{planId})
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTBasePointListNotInPlan" parameterType="TBasePoint" resultMap="TBasePointResult">

+ 2 - 0
master/src/main/resources/mybatis/base/TBaseRegionMapper.xml

@@ -48,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
             and d.del_flag=0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
     <select id="selectAllRegionByPlantId" parameterType="long"  resultMap="TBaseRegionResult">
         select d.region_id, d.region_code, d.region_name from t_base_region d where d.plant_id=#{plantId} and d.del_flag=0 and d.approve_status=2

+ 8 - 43
master/src/main/resources/mybatis/check/TCheckCheckpointsMapper.xml

@@ -120,6 +120,8 @@
             <if test="planId != null">and d.plan_id=#{planId}</if>
             and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
 
@@ -142,50 +144,13 @@
         d.creater_code, d.createdate, d.updater_code, d.updatedate,br.region_name,bd.dev_code,bd.dev_describe as
         dev_name from t_check_checkpoints d
         left join t_base_region br on d.region_id = br.region_id
-        left join t_base_device bd on d.dev_id = bd.dev_id where d.check_id in
-        <foreach item="checkId" collection="array" open="(" separator="," close=")">
-            #{checkId}
-        </foreach>
-        and d.approve_status=2
-    </select>
-
-    <select id="selectPointsByPlantNameGroupCodeAndExtendCode" parameterType="TCheckCheckpoints"
-            resultMap="TCheckCheckpointsResult">
-        select *from t_check_checkpoints d
+        left join t_base_device bd on d.dev_id = bd.dev_id
         <where>
-            <if test="instrumentId != null ">and d.instrument_id = #{instrumentId}</if>
-            <if test="inspectionId != null ">and d.inspection_id = #{inspectionId}</if>
-            <if test="testValue != null  and testValue != ''">and d.test_value = #{testValue}</if>
-            <if test="netTestValue != null  and netTestValue != ''">and d.net_test_value = #{netTestValue}</if>
-            <if test="plantId != null  and plantId != ''">and d.plant_id = #{plantId}</if>
-            <if test="plantName != null  and plantName != ''">and d.plant_name like concat('%', #{plantName}, '%')</if>
-            <if test="regionId != null  and regionId != ''">and d.region_id= #{regionId}</if>
-            <if test="regionName != null  and regionName != ''">and d.region_name like concat('%', #{regionName}, '%')
-            </if>
-            <if test="layer != null  and layer != ''">and d.layer = #{layer}</if>
-            <if test="devId != null  and devId != ''">and d.dev_id = #{devId}</if>
-            <if test="devName != null  and devName != ''">and d.dev_name like concat('%', #{devName}, '%')</if>
-            <if test="devCode != null  and devCode != ''">and d.dev_code = #{devCode}</if>
-            <if test="groupCode != null  and groupCode != ''">and d.group_code = #{groupCode}</if>
-            <if test="extendCode != null  and extendCode != ''">and d.extend_code = #{extendCode}</if>
-            <if test="pointType != null  and pointType != ''">and d.point_type = #{pointType}</if>
-            <if test="instrumentCode != null  and instrumentCode != ''">and d.instrument_code = #{instrumentCode}</if>
-            <if test="leakagePosition != null  and leakagePosition != ''">and d.leakage_position = #{leakagePosition}
-            </if>
-            <if test="checker != null  and checker != ''">and d.checker = #{checker}</if>
-            <if test="checkDate != null  and checkDate != ''">and d.check_date = #{checkDate}</if>
-            <if test="leakageDegree != null  and leakageDegree != ''">and d.leakage_degree = #{leakageDegree}</if>
-            <if test="remarks != null  and remarks != ''">and d.remarks = #{remarks}</if>
-            <if test="approveStatus != null ">and d.approve_status = #{approveStatus}</if>
-            <if test="approveTime != null ">and d.approve_time = #{approveTime}</if>
-            <if test="deptId != null ">and d.dept_id = #{deptId}</if>
-            <if test="createrCode != null ">and d.creater_code = #{createrCode}</if>
-            <if test="createdate != null ">and d.createdate = #{createdate}</if>
-            <if test="updaterCode != null ">and d.updater_code = #{updaterCode}</if>
-            <if test="updatedate != null ">and d.updatedate = #{updatedate}</if>
-            <if test="choose != null ">and d.inspection_id is null</if>
-            <if test="planId != null">and d.plan_id=#{planId}</if>
-            and d.del_flag = 0
+            and d.check_id in
+            <foreach item="checkId" collection="array" open="(" separator="," close=")">
+                #{checkId}
+            </foreach>
+            and d.approve_status=2
         </where>
     </select>
 

+ 2 - 0
master/src/main/resources/mybatis/check/TCheckEnvironmentMapper.xml

@@ -62,6 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="plantName != null "> and bp.plant_name = #{plantName}</if>
         and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTCheckEnvironmentListByYear" parameterType="TCheckEnvironment" resultMap="TCheckEnvironmentResult">

+ 6 - 2
master/src/main/resources/mybatis/check/TCheckInstrumentMapper.xml

@@ -53,8 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
     <select id="selectAllInstrument" parameterType="Long" resultMap="TCheckInstrumentResult">
-        select id, `code`, concat(`code`, '_' ,`name`)`name`, model, principle, linear_range, `range`, factory, remarks, dept_id, del_flag, creater_code, createdate, updater_code, updatedate from t_check_instrument
-        where del_flag=0 order by createdate desc
+        select d.id, d.`code`, concat(d.`code`, '_' ,d.`name`) `name`, d.model, d.principle, d.linear_range, d.`range`, d.factory, d.remarks, d.dept_id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate
+        from t_check_instrument d
+                 left join sys_dept s on d.dept_id = s.dept_id
+        <where>AND d.del_flag = 0
+        </where>
+        order by createdate desc
     </select>
 
     <insert id="insertTCheckInstrument" parameterType="TCheckInstrument" useGeneratedKeys="true" keyProperty="id">

+ 123 - 80
master/src/main/resources/mybatis/check/TCheckRepairpointsMapper.xml

@@ -1,90 +1,128 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.project.check.mapper.TCheckRepairpointsMapper">
 
     <resultMap type="TCheckRepairpoints" id="TCheckRepairpointsResult">
-        <result property="checkId"    column="check_id"    />
-        <result property="pointId"    column="point_id"    />
-        <result property="repairId"    column="repair_id"    />
-        <result property="netTestValue"    column="net_test_value"    />
-        <result property="repairFunc"    column="repair_func"    />
-        <result property="repairType"    column="repair_type"    />
-        <result property="repairCount"    column="repair_count"    />
-        <result property="plantName"    column="plant_name"    />
-        <result property="regionName"    column="region_name"    />
-        <result property="layer"    column="layer"    />
-        <result property="devName"    column="dev_name"    />
-        <result property="devCode"    column="dev_code"    />
-        <result property="groupCode"    column="group_code"    />
-        <result property="extendCode"    column="extend_code"    />
-        <result property="pointType"    column="point_type"    />
-        <result property="instrumentCode"    column="instrument_code"    />
-        <result property="leakagePosition"    column="leakage_position"    />
-        <result property="repairer"    column="repairer"    />
-        <result property="repairDate"    column="repair_date"    />
-        <result property="leakageDegree"    column="leakage_degree"    />
-        <result property="remarks"    column="remarks"    />
-        <result property="approveStatus"    column="approve_status"    />
-        <result property="approveTime"    column="approve_time"    />
-        <result property="deptId"    column="dept_id"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="createrCode"    column="creater_code"    />
-        <result property="createdate"    column="createdate"    />
-        <result property="updaterCode"    column="updater_code"    />
-        <result property="updatedate"    column="updatedate"    />
-        <result property="plantId"    column="plant_id"    />
-        <result property="regionId"    column="region_id"    />
-        <result property="devId"    column="dev_id"    />
-        <result property="instrumentId"    column="instrument_id"    />
-        <result property="plantType"    column="plant_type"    />
-        <result property="mediumType"    column="medium_type"    />
+        <result property="checkId" column="check_id"/>
+        <result property="pointId" column="point_id"/>
+        <result property="repairId" column="repair_id"/>
+        <result property="netTestValue" column="net_test_value"/>
+        <result property="repairFunc" column="repair_func"/>
+        <result property="repairType" column="repair_type"/>
+        <result property="repairCount" column="repair_count"/>
+        <result property="plantName" column="plant_name"/>
+        <result property="regionName" column="region_name"/>
+        <result property="layer" column="layer"/>
+        <result property="devName" column="dev_name"/>
+        <result property="devCode" column="dev_code"/>
+        <result property="groupCode" column="group_code"/>
+        <result property="extendCode" column="extend_code"/>
+        <result property="pointType" column="point_type"/>
+        <result property="instrumentCode" column="instrument_code"/>
+        <result property="leakagePosition" column="leakage_position"/>
+        <result property="repairer" column="repairer"/>
+        <result property="repairDate" column="repair_date"/>
+        <result property="leakageDegree" column="leakage_degree"/>
+        <result property="remarks" column="remarks"/>
+        <result property="approveStatus" column="approve_status"/>
+        <result property="approveTime" column="approve_time"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createrCode" column="creater_code"/>
+        <result property="createdate" column="createdate"/>
+        <result property="updaterCode" column="updater_code"/>
+        <result property="updatedate" column="updatedate"/>
+        <result property="plantId" column="plant_id"/>
+        <result property="regionId" column="region_id"/>
+        <result property="devId" column="dev_id"/>
+        <result property="instrumentId" column="instrument_id"/>
+        <result property="plantType" column="plant_type"/>
+        <result property="mediumType" column="medium_type"/>
     </resultMap>
 
     <sql id="selectTCheckRepairpointsVo">
-        select check_id, point_id, repair_id, net_test_value, repair_func, repair_type, repair_count, plant_name, region_name, layer, dev_name, dev_code, group_code, extend_code, point_type, instrument_code, leakage_position, repairer, repair_date, leakage_degree, remarks, approve_status, approve_time, dept_id, del_flag, creater_code, createdate, updater_code, updatedate, plant_id, region_id, dev_id, instrument_id, plant_type, medium_type from t_check_repairpoints
+        select d.check_id,
+               d.point_id,
+               d.repair_id,
+               d.net_test_value,
+               d.repair_func,
+               d.repair_type,
+               d.repair_count,
+               d.plant_name,
+               d.region_name,
+               d.layer,
+               d.dev_name,
+               d.dev_code,
+               d.group_code,
+               d.extend_code,
+               d.point_type,
+               d.instrument_code,
+               d.leakage_position,
+               d.repairer,
+               d.repair_date,
+               d.leakage_degree,
+               d.remarks,
+               d.approve_status,
+               d.approve_time,
+               d.dept_id,
+               d.del_flag,
+               d.creater_code,
+               d.createdate,
+               d.updater_code,
+               d.updatedate,
+               d.plant_id,
+               d.region_id,
+               d.dev_id,
+               d.instrument_id,
+               d.plant_type,
+               d.medium_type
+        from t_check_repairpoints d
     </sql>
 
     <select id="selectTCheckRepairpointsList" parameterType="TCheckRepairpoints" resultMap="TCheckRepairpointsResult">
         <include refid="selectTCheckRepairpointsVo"/>
         <where>
-            <if test="pointId != null "> and point_id = #{pointId}</if>
-            <if test="repairId != null "> and repair_id = #{repairId}</if>
-            <if test="netTestValue != null  and netTestValue != ''"> and net_test_value = #{netTestValue}</if>
-            <if test="repairFunc != null  and repairFunc != ''"> and repair_func = #{repairFunc}</if>
-            <if test="repairType != null  and repairType != ''"> and repair_type = #{repairType}</if>
-            <if test="repairCount != null  and repairCount != ''"> and repair_count = #{repairCount}</if>
-            <if test="plantName != null  and plantName != ''"> and plant_name like concat('%', #{plantName}, '%')</if>
-            <if test="regionName != null  and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
-            <if test="layer != null  and layer != ''"> and layer = #{layer}</if>
-            <if test="devName != null  and devName != ''"> and dev_name like concat('%', #{devName}, '%')</if>
-            <if test="devCode != null  and devCode != ''"> and dev_code = #{devCode}</if>
-            <if test="groupCode != null  and groupCode != ''"> and group_code = #{groupCode}</if>
-            <if test="extendCode != null  and extendCode != ''"> and extend_code = #{extendCode}</if>
-            <if test="pointType != null  and pointType != ''"> and point_type = #{pointType}</if>
-            <if test="instrumentCode != null  and instrumentCode != ''"> and instrument_code = #{instrumentCode}</if>
-            <if test="leakagePosition != null  and leakagePosition != ''"> and leakage_position = #{leakagePosition}</if>
-            <if test="repairer != null  and repairer != ''"> and repairer = #{repairer}</if>
-            <if test="repairDate != null "> and repair_date = #{repairDate}</if>
-            <if test="leakageDegree != null  and leakageDegree != ''"> and leakage_degree = #{leakageDegree}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
-            <if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
-            <if test="approveTime != null "> and approve_time = #{approveTime}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
-            <if test="createrCode != null "> and creater_code = #{createrCode}</if>
-            <if test="createdate != null "> and createdate = #{createdate}</if>
-            <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
-            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
-            <if test="plantId != null "> and plant_id = #{plantId}</if>
-            <if test="regionId != null "> and region_id = #{regionId}</if>
-            <if test="devId != null "> and dev_id = #{devId}</if>
-            <if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
-            <if test="plantType != null  and plantType != ''"> and plant_type = #{plantType}</if>
-            <if test="mediumType != null  and mediumType != ''"> and medium_type = #{mediumType}</if>
-            <if test="choose != null "> and repair_id is null</if>
-        and del_flag = 0
+            <if test="pointId != null ">and d.point_id = #{pointId}</if>
+            <if test="repairId != null ">and d.repair_id = #{repairId}</if>
+            <if test="netTestValue != null  and netTestValue != ''">and d.net_test_value = #{netTestValue}</if>
+            <if test="repairFunc != null  and repairFunc != ''">and d.repair_func = #{repairFunc}</if>
+            <if test="repairType != null  and repairType != ''">and d.repair_type = #{repairType}</if>
+            <if test="repairCount != null  and repairCount != ''">and d.repair_count = #{repairCount}</if>
+            <if test="plantName != null  and plantName != ''">and d.plant_name like concat('%', #{plantName}, '%')</if>
+            <if test="regionName != null  and regionName != ''">and d.region_name like concat('%', #{regionName}, '%')
+            </if>
+            <if test="layer != null  and layer != ''">and d.layer = #{layer}</if>
+            <if test="devName != null  and devName != ''">and d.dev_name like concat('%', #{devName}, '%')</if>
+            <if test="devCode != null  and devCode != ''">and d.dev_code = #{devCode}</if>
+            <if test="groupCode != null  and groupCode != ''">and d.group_code = #{groupCode}</if>
+            <if test="extendCode != null  and extendCode != ''">and d.extend_code = #{extendCode}</if>
+            <if test="pointType != null  and pointType != ''">and d.point_type = #{pointType}</if>
+            <if test="instrumentCode != null  and instrumentCode != ''">and d.instrument_code = #{instrumentCode}</if>
+            <if test="leakagePosition != null  and leakagePosition != ''">and d.leakage_position = #{leakagePosition}</if>
+            <if test="repairer != null  and repairer != ''">and d.repairer = #{repairer}</if>
+            <if test="repairDate != null ">and d.repair_date = #{repairDate}</if>
+            <if test="leakageDegree != null  and leakageDegree != ''">and d.leakage_degree = #{leakageDegree}</if>
+            <if test="remarks != null  and remarks != ''">and d.remarks = #{remarks}</if>
+            <if test="approveStatus != null ">and d.approve_status = #{approveStatus}</if>
+            <if test="approveTime != null ">and d.approve_time = #{approveTime}</if>
+            <if test="deptId != null ">and d.dept_id = #{deptId}</if>
+            <if test="createrCode != null ">and d.creater_code = #{createrCode}</if>
+            <if test="createdate != null ">and d.createdate = #{createdate}</if>
+            <if test="updaterCode != null ">and d.updater_code = #{updaterCode}</if>
+            <if test="updatedate != null ">and d.updatedate = #{updatedate}</if>
+            <if test="plantId != null ">and d.plant_id = #{plantId}</if>
+            <if test="regionId != null ">and rd.egion_id = #{regionId}</if>
+            <if test="devId != null ">and d.dev_id = #{devId}</if>
+            <if test="instrumentId != null ">and d.instrument_id = #{instrumentId}</if>
+            <if test="plantType != null  and plantType != ''">and d.plant_type = #{plantType}</if>
+            <if test="mediumType != null  and mediumType != ''">and d.medium_type = #{mediumType}</if>
+            <if test="choose != null ">and d.repair_id is null</if>
+            and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTCheckRepairpointsByCheckId" parameterType="Long" resultMap="TCheckRepairpointsResult">
@@ -98,14 +136,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectTCheckRepairpointsByIds" parameterType="Long" resultMap="TCheckRepairpointsResult">
-        <include refid="selectTCheckRepairpointsVo"/> where check_id in
+        <include refid="selectTCheckRepairpointsVo"/>
+        where check_id in
         <foreach item="checkId" collection="array" open="(" separator="," close=")">
             #{checkId}
         </foreach>
         and approve_status=2
     </select>
 
-    <insert id="insertTCheckRepairpoints" parameterType="TCheckRepairpoints" useGeneratedKeys="true" keyProperty="checkId">
+    <insert id="insertTCheckRepairpoints" parameterType="TCheckRepairpoints" useGeneratedKeys="true"
+            keyProperty="checkId">
         insert into t_check_repairpoints
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="pointId != null">point_id,</if>
@@ -142,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="instrumentId != null">instrument_id,</if>
             <if test="plantType != null">plant_type,</if>
             <if test="mediumType != null">medium_type,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="pointId != null">#{pointId},</if>
             <if test="repairId != null">#{repairId},</if>
@@ -178,7 +218,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="instrumentId != null">#{instrumentId},</if>
             <if test="plantType != null">#{plantType},</if>
             <if test="mediumType != null">#{mediumType},</if>
-         </trim>
+        </trim>
     </insert>
 
     <insert id="insertTCheckRepairpointsByList" parameterType="TCheckRepairpoints">
@@ -208,7 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             instrument_id,
             plant_type,
             medium_type,
-         </trim>
+        </trim>
         values
         <foreach collection="list" index="index" separator="," item="item">
             <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -292,7 +332,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="approveStatus != null">approve_status = #{approveStatus},</if>
             <if test="remarks != null">remarks = #{remarks},</if>
         </trim>
-        where plant_name=#{plantName} and group_code=#{groupCode} and extend_code=#{extendCode} and repair_id=#{repairId} and (approve_status is null or approve_status=0)
+        where plant_name=#{plantName} and group_code=#{groupCode} and extend_code=#{extendCode} and
+        repair_id=#{repairId} and (approve_status is null or approve_status=0)
     </update>
 
     <update id="updateApproveStatusByIds" parameterType="TCheckCheckpoints">
@@ -318,7 +359,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <delete id="deleteTCheckRepairpointsByCheckId" parameterType="Long">
-        update t_check_repairpoints set del_flag=1 where check_id = #{checkId}
+        update t_check_repairpoints
+        set del_flag=1
+        where check_id = #{checkId}
     </delete>
 
     <delete id="deleteTCheckRepairpointsByCheckIds" parameterType="String">

+ 4 - 1
master/src/main/resources/mybatis/check/TCheckStandardgasesMapper.xml

@@ -48,7 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectAllStandardgases"  resultMap="TCheckStandardgasesResult">
-        select d.*,concat(d.name, '_',d.code) `describe` from t_check_standardgases d where d.del_flag = 0
+        select d.*,concat(d.name, '_',d.code) `describe`
+        from t_check_standardgases d
+        left join sys_dept s on d.dept_id = s.dept_id
+        <where> and d.del_flag = 0</where>
     </select>
 
     <select id="selectTCheckStandardgasesById" parameterType="Long" resultMap="TCheckStandardgasesResult">

+ 7 - 1
master/src/main/resources/mybatis/statistics/StatisticsMapper.xml

@@ -16,12 +16,14 @@
 
     <select id="countPlant" parameterType="Statistics" resultMap="StatisticsResult">
         select plant_name, plant_id, count(1) num
-        from t_base_plant
+        from t_base_plant d
         <where>
             and approve_status = 2
             and del_flag = 0
             <if test="company!=null and company!=''">and company like concat('%',#{company},'%')</if>
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
         group by plant_name;
     </select>
 
@@ -63,6 +65,8 @@
             and leakage_degree is not null
             <if test="company!=null and company!=''">and bp.company like concat('%',#{company},'%')</if>
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
         ORDER BY d.plant_id,d.point_type,d.point_id,d.check_date;
     </select>
 
@@ -76,6 +80,8 @@
             and YEAR(check_date) = #{year}
             <if test="company!=null and company!=''">and bp.company like concat('%',#{company},'%')</if>
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
         group by point_type,leakage_degree
         order by point_type;
     </select>

+ 2 - 0
master/src/main/resources/mybatis/task/TTaskInspectionMapper.xml

@@ -58,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
         and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTTaskInspectionById" parameterType="Long" resultMap="TTaskInspectionResult">

+ 2 - 0
master/src/main/resources/mybatis/task/TTaskInspectionPlanMapper.xml

@@ -54,6 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="planCode != null "> and d.plan_code = #{planCode}</if>
             and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectAllPlan" resultMap="TTaskInspectionPlanResult">

+ 2 - 0
master/src/main/resources/mybatis/task/TTaskRepairMapper.xml

@@ -54,6 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
         and d.del_flag = 0
         </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScopePlant}
     </select>
 
     <select id="selectTTaskRepairById" parameterType="Long" resultMap="TTaskRepairResult">

+ 1 - 1
ui/src/api/check/checkpoints.js

@@ -56,7 +56,7 @@ export function approveCheckpoints(data) {
 export function approveCheckpointsAll(data) {
   return request({
     url: '/check/checkpoints/approveAll',
-    method: 'put',
+    method: 'post',
     data: data
   })
 }

+ 10 - 11
ui/src/views/statistics/index.vue

@@ -34,9 +34,9 @@
       </el-card>
     </el-row>
     <el-row>
-      <el-card style="height: 600px">
+      <el-card>
         <div class="bt"><span><i class="el-icon-coin i"></i> 基本信息统计</span></div>
-        <el-table :data="statisticsList" border height="540">
+        <el-table :data="statisticsList" border>
           <el-table-column type="index" align="center" width="50"/>
           <el-table-column label="装置名称" align="center" prop="plantName" width="130" :show-overflow-tooltip="true"/>
           <el-table-column label="装置(个)" align="center" prop="plantCount" width="80" :show-overflow-tooltip="true"/>
@@ -85,27 +85,27 @@
       <el-card style="height: 570px;">
         <div class="bt"><span><i class="el-icon-coin i"></i> 泄露程度统计</span></div>
         <el-col :span="12">
-          <el-card style="margin-top:0; margin-left:0;margin-bottom:0" shadow="hover">
+          <el-card style="margin-top:0; margin-left:0;margin-bottom:0;height: 500px" shadow="hover">
             <plant-count-chart v-if="show" :statistics="statisticsList"></plant-count-chart>
           </el-card>
         </el-col>
         <el-col :span="12">
-          <el-card style="margin-top:0; margin-right:0;margin-bottom:0" shadow="hover">
+          <el-card style="margin-top:0; margin-right:0;margin-bottom:0;height: 500px" shadow="hover">
             <pt-count-chart v-if="show" :queryParams="queryParams"></pt-count-chart>
           </el-card>
         </el-col>
       </el-card>
     </el-row>
     <el-row>
-      <el-card>
+      <el-card style="height: 500px">
         <div class="bt"><span><i class="el-icon-coin i"></i> 排放信息统计</span></div>
         <pfl-of-year-chart v-if="show" :statistics="statisticsList"></pfl-of-year-chart>
       </el-card>
     </el-row>
     <el-row>
       <el-col :span="6">
-        <el-card>
-          <el-table :data="statisticsList" border height="470" @row-click="selectRow">
+        <el-card style="height: 525px">
+          <el-table :data="statisticsList" border height="495" @row-click="selectRow">
             <el-table-column label="装置" align="center" prop="plantName"
                              :show-overflow-tooltip="true" width="80" />
             <el-table-column label="泄漏量(t/a)" align="center" prop="xll"
@@ -118,17 +118,17 @@
         </el-card>
       </el-col>
       <el-col :span="6">
-        <el-card>
+        <el-card style="height: 525px">
           <pfl-pie-chart v-if="showPoint" :pointList="pointCountList" :plant-name="plantName"></pfl-pie-chart>
         </el-card>
       </el-col>
       <el-col :span="6">
-        <el-card>
+        <el-card style="height: 525px">
           <xll-pie-chart v-if="showPoint" :pointList="pointCountList" :plant-name="plantName"></xll-pie-chart>
         </el-card>
       </el-col>
       <el-col :span="6">
-        <el-card>
+        <el-card style="height: 525px">
           <jpl-pie-chart v-if="showPoint" :pointList="pointCountList" :plant-name="plantName"></jpl-pie-chart>
         </el-card>
       </el-col>
@@ -211,7 +211,6 @@ export default {
 <style scoped>
 .el-card {
   margin: 5px;
-  height: 500px;
 }
 
 .bt {

+ 3 - 2
ui/src/views/statistics/pie/jplPieChart.vue

@@ -41,8 +41,9 @@ export default {
           formatter: '{a} <br/>{b} : {c} ({d}%)'
         },
         legend: {
-          orient: 'vertical',
-          left: 'left',
+          orient: 'horizontal',
+          x: 'left',
+          y:'bottom',
           data: []
         },
         toolbox: {

+ 3 - 2
ui/src/views/statistics/pie/pflPieChart.vue

@@ -41,8 +41,9 @@ export default {
           formatter: '{a} <br/>{b} : {c} ({d}%)'
         },
         legend: {
-          orient: 'vertical',
-          left: 'left',
+          orient: 'horizontal',
+          x: 'left',
+          y:'bottom',
           data: []
         },
         toolbox: {

+ 3 - 2
ui/src/views/statistics/pie/xllPieChart.vue

@@ -41,8 +41,9 @@ export default {
           formatter: '{a} <br/>{b} : {c} ({d}%)'
         },
         legend: {
-          orient: 'vertical',
-          left: 'left',
+          orient: 'horizontal',
+          x: 'left',
+          y:'bottom',
           data: []
         },
         toolbox: {