瀏覽代碼

权限功能补充

liubo 3 年之前
父節點
當前提交
ffc1d34f02
共有 18 個文件被更改,包括 60 次插入32 次删除
  1. 6 1
      zd-modules/zd-exam/src/main/java/com/zd/exam/controller/ElAIOController.java
  2. 4 1
      zd-modules/zd-exam/src/main/java/com/zd/exam/controller/ElCategoryController.java
  3. 1 1
      zd-modules/zd-exam/src/main/java/com/zd/exam/service/IElCategoryService.java
  4. 6 5
      zd-modules/zd-exam/src/main/java/com/zd/exam/service/impl/ElCategoryServiceImpl.java
  5. 1 1
      zd-modules/zd-exam/src/main/resources/mapper/exam/LabCertificateMapper.xml
  6. 2 7
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabGradeManageRecordServiceImpl.java
  7. 1 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMessageContentServiceImpl.java
  8. 1 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMoldServiceImpl.java
  9. 3 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSafeClassifiedServiceImpl.java
  10. 3 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSafeClasstypeServiceImpl.java
  11. 2 2
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabMessageContentMapper.xml
  12. 2 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSafeClassifiedMapper.xml
  13. 2 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSafeClasstypeMapper.xml
  14. 2 12
      zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysDeptController.java
  15. 2 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/mapper/SysDeptMapper.java
  16. 2 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/ISysDeptService.java
  17. 7 0
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysDeptServiceImpl.java
  18. 13 0
      zd-modules/zd-modules-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 6 - 1
zd-modules/zd-exam/src/main/java/com/zd/exam/controller/ElAIOController.java

@@ -67,7 +67,12 @@ public class ElAIOController extends BaseController {
         if(id == null){
         if(id == null){
             return R.fail("ID 不能为空!");
             return R.fail("ID 不能为空!");
         }
         }
-        return R.ok(elCategoryService.treeList(id, 2));
+
+        ElCategory elCategory = new ElCategory();
+        elCategory.setType(2);
+        elCategory.setParentId(id);
+
+        return R.ok(elCategoryService.treeList(elCategory));
     }
     }
 
 
     /**
     /**

+ 4 - 1
zd-modules/zd-exam/src/main/java/com/zd/exam/controller/ElCategoryController.java

@@ -56,7 +56,10 @@ public class ElCategoryController extends BaseController {
         if(id == null){
         if(id == null){
             return error("ID 不能为空!");
             return error("ID 不能为空!");
         }
         }
-        return AjaxResult.success(elCategoryService.treeList(id, type));
+        ElCategory elCategory = new ElCategory();
+        elCategory.setType(type);
+        elCategory.setParentId(id);
+        return AjaxResult.success(elCategoryService.treeList(elCategory));
     }
     }
 
 
     /**
     /**

+ 1 - 1
zd-modules/zd-exam/src/main/java/com/zd/exam/service/IElCategoryService.java

@@ -59,5 +59,5 @@ public interface IElCategoryService {
      */
      */
     public int deleteElCategoryById(Long id);
     public int deleteElCategoryById(Long id);
 
 
-    List<ElCategory>  treeList(Long id, Integer type);
+    List<ElCategory>  treeList(ElCategory elCategory);
 }
 }

+ 6 - 5
zd-modules/zd-exam/src/main/java/com/zd/exam/service/impl/ElCategoryServiceImpl.java

@@ -125,17 +125,18 @@ public class ElCategoryServiceImpl implements IElCategoryService {
 
 
     /**
     /**
      * 获取学习分类树状结构
      * 获取学习分类树状结构
-     * @param type 1 资源,2 课程
      */
      */
     @Override
     @Override
-    public List<ElCategory> treeList(Long id, Integer type) {
-        ElCategory elCategory = new ElCategory();
-        elCategory.setType(type);
+    @DataScope(deptAlias = "t" , userAlias = "t" , permi = PerPrefix.EXAM_EL_COURSE)
+    public List<ElCategory> treeList(ElCategory elCategory) {
+        Long parentId = elCategory.getParentId();
+        elCategory.setParentId(null);
+
         List<ElCategory> chapterList = elCategoryMapper.selectElCategoryList(elCategory);
         List<ElCategory> chapterList = elCategoryMapper.selectElCategoryList(elCategory);
 
 
         List<ElCategory> chapters = new ArrayList<>();
         List<ElCategory> chapters = new ArrayList<>();
         for (ElCategory category : chapterList) {
         for (ElCategory category : chapterList) {
-            if(category.getParentId().equals(id)){
+            if(category.getParentId().equals(parentId)){
                 getChildPerms(chapterList, category);
                 getChildPerms(chapterList, category);
                 chapters.add(category);
                 chapters.add(category);
             }
             }

+ 1 - 1
zd-modules/zd-exam/src/main/resources/mapper/exam/LabCertificateMapper.xml

@@ -54,7 +54,7 @@
             <if test="deptName != null  and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
             <if test="deptName != null  and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
             <if test="userId != null ">and user_id = #{userId}</if>
             <if test="userId != null ">and user_id = #{userId}</if>
             <!-- 数据范围过滤 -->
             <!-- 数据范围过滤 -->
-            <!--${params.dataScope}-->
+            ${params.dataScope}
         </where>
         </where>
     </select>
     </select>
 
 

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

@@ -695,10 +695,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
         if(labManageWorkChartVo.getType() == 1){
         if(labManageWorkChartVo.getType() == 1){
             list = new ArrayList<>();
             list = new ArrayList<>();
-
-            SysDept sysDept = new SysDept();
-            sysDept.setParentId(100L);
-            R r = remoteDeptService.getDeptList(sysDept);
+            R r = remoteDeptService.getDeptList(new SysDept());
             List<SysDept> deptList = (List<SysDept>) r.getData();
             List<SysDept> deptList = (List<SysDept>) r.getData();
 
 
             LabManageWorkChartVo workChartVo ;
             LabManageWorkChartVo workChartVo ;
@@ -864,9 +861,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
         List<LabManageWorkChartVo> list = new ArrayList<>();
         List<LabManageWorkChartVo> list = new ArrayList<>();
         if(labManageWorkChartVo.getType() == 1){
         if(labManageWorkChartVo.getType() == 1){
-            SysDept sysDept = new SysDept();
-            sysDept.setParentId(100L);
-            R r = remoteDeptService.getDeptList(sysDept);
+            R r = remoteDeptService.getDeptList(new SysDept());
             List<SysDept> deptList = (List<SysDept>) r.getData();
             List<SysDept> deptList = (List<SysDept>) r.getData();
 
 
             LabManageWorkChartVo workChartVo ;
             LabManageWorkChartVo workChartVo ;

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

@@ -117,7 +117,7 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
      * @return 消息发布
      * @return 消息发布
      */
      */
     @Override
     @Override
-//    @DataScope(deptAlias = "s" , permi = PerPrefix.LABORATORY_CONTENT)
+    @DataScope(deptAlias = "s" , permi = PerPrefix.LABORATORY_CONTENT)
     public List<LabMessageContentVO> selectLabMessageContentVOList(LabMessageContentListQuery labMessageContent) {
     public List<LabMessageContentVO> selectLabMessageContentVOList(LabMessageContentListQuery labMessageContent) {
         return labMessageContentMapper.selectLabMessageContentVOList(labMessageContent);
         return labMessageContentMapper.selectLabMessageContentVOList(labMessageContent);
     }
     }

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

@@ -43,7 +43,7 @@ public class LabMoldServiceImpl implements ILabMoldService {
      * @return 实验室类型
      * @return 实验室类型
      */
      */
     @Override
     @Override
-    @DataScope(permi = PerPrefix.LAB_MOLD, deptAlias = "t", userAlias = "t")
+    @DataScope(permi = PerPrefix.LABORATORY_CLASSTYPE, deptAlias = "t", userAlias = "t")
     public List<LabMold> selectLabMoldList(LabMold labMold) {
     public List<LabMold> selectLabMoldList(LabMold labMold) {
         return labMoldMapper.selectLabMoldList(labMold);
         return labMoldMapper.selectLabMoldList(labMold);
     }
     }

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

@@ -1,7 +1,9 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.laboratory.domain.LabSafeClassified;
 import com.zd.laboratory.domain.LabSafeClassified;
 import com.zd.laboratory.mapper.LabSafeClassifiedMapper;
 import com.zd.laboratory.mapper.LabSafeClassifiedMapper;
@@ -42,6 +44,7 @@ public class LabSafeClassifiedServiceImpl implements ILabSafeClassifiedService
      * @return 安全分级
      * @return 安全分级
      */
      */
     @Override
     @Override
+    @DataScope(deptAlias = "t" , permi = PerPrefix.LABORATORY_CLASSTYPE)
     public List<LabSafeClassified> selectLabSafeClassifiedList(LabSafeClassified labSafeClassified)
     public List<LabSafeClassified> selectLabSafeClassifiedList(LabSafeClassified labSafeClassified)
     {
     {
         return labSafeClassifiedMapper.selectLabSafeClassifiedList(labSafeClassified);
         return labSafeClassifiedMapper.selectLabSafeClassifiedList(labSafeClassified);

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

@@ -1,7 +1,9 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.laboratory.domain.LabSafeClasstype;
 import com.zd.laboratory.domain.LabSafeClasstype;
 import com.zd.laboratory.mapper.LabSafeClasstypeMapper;
 import com.zd.laboratory.mapper.LabSafeClasstypeMapper;
@@ -42,6 +44,7 @@ public class LabSafeClasstypeServiceImpl implements ILabSafeClasstypeService
      * @return 安全分级类型
      * @return 安全分级类型
      */
      */
     @Override
     @Override
+    @DataScope(deptAlias = "t" , permi = PerPrefix.LABORATORY_CLASSTYPE)
     public List<LabSafeClasstype> selectLabSafeClasstypeList(LabSafeClasstype labSafeClasstype)
     public List<LabSafeClasstype> selectLabSafeClasstypeList(LabSafeClasstype labSafeClasstype)
     {
     {
         return labSafeClasstypeMapper.selectLabSafeClasstypeList(labSafeClasstype);
         return labSafeClasstypeMapper.selectLabSafeClasstypeList(labSafeClasstype);

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

@@ -118,8 +118,8 @@
             <if test="sendRange != null ">and t.send_range = #{sendRange}</if>
             <if test="sendRange != null ">and t.send_range = #{sendRange}</if>
             <if test="sendName != null  and sendName != ''">and s.nick_name like concat('%', #{sendName}, '%')</if>
             <if test="sendName != null  and sendName != ''">and s.nick_name like concat('%', #{sendName}, '%')</if>
             <if test="startDate != null ">and t.create_time BETWEEN #{startDate} AND #{endDate}</if>
             <if test="startDate != null ">and t.create_time BETWEEN #{startDate} AND #{endDate}</if>
-            <!-- 数据范围过滤
-            ${params.dataScope}-->
+            <!-- 数据范围过滤-->
+            ${params.dataScope}
         </where>
         </where>
         order by t.create_time desc
         order by t.create_time desc
     </select>
     </select>

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

@@ -33,6 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null "> and t.dept_id = #{deptId}</if>
             <if test="deptId != null "> and t.dept_id = #{deptId}</if>
             <if test="userId != null "> and t.user_id = #{userId}</if>
             <if test="userId != null "> and t.user_id = #{userId}</if>
             <if test="classifiedName != null  and classifiedName != ''"> and t.classified_name like concat('%', #{classifiedName}, '%')</if>
             <if test="classifiedName != null  and classifiedName != ''"> and t.classified_name like concat('%', #{classifiedName}, '%')</if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         </where>
         order by t.create_time desc
         order by t.create_time desc
     </select>
     </select>

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

@@ -33,6 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptName != null  and deptName != ''"> and t.dept_name like concat('%', #{deptName}, '%')</if>
             <if test="deptName != null  and deptName != ''"> and t.dept_name like concat('%', #{deptName}, '%')</if>
             <if test="deptId != null "> and t.dept_id = #{deptId}</if>
             <if test="deptId != null "> and t.dept_id = #{deptId}</if>
             <if test="userId != null "> and t.user_id = #{userId}</if>
             <if test="userId != null "> and t.user_id = #{userId}</if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         </where>
         order by t.create_time desc
         order by t.create_time desc
     </select>
     </select>

+ 2 - 12
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysDeptController.java

@@ -55,7 +55,7 @@ public class SysDeptController extends BaseController {
 
 
     @PostMapping("/listOption")
     @PostMapping("/listOption")
     public AjaxResult listOption(@RequestBody SysDept dept) {
     public AjaxResult listOption(@RequestBody SysDept dept) {
-        List<SysDept> depts = deptService.selectDeptList(dept);
+        List<SysDept> depts = deptService.selectDeptListByCollege(dept);
         return AjaxResult.success(depts);
         return AjaxResult.success(depts);
     }
     }
 
 
@@ -75,10 +75,7 @@ public class SysDeptController extends BaseController {
     @ApiOperation("获取院系列表-不分页(按目前的需求约定第二级组织机构为院系)-应用数据权限")
     @ApiOperation("获取院系列表-不分页(按目前的需求约定第二级组织机构为院系)-应用数据权限")
     @GetMapping("/departments/list")
     @GetMapping("/departments/list")
     public AjaxResult departments() {
     public AjaxResult departments() {
-        //为了方便查二级节点,这里约定根节点的ID为100。
-        SysDept sysDept = new SysDept();
-        sysDept.setParentId(100L);
-        List<SysDept> depts = deptService.selectDeptList(sysDept);
+        List<SysDept> depts = deptService.selectDeptListByCollege(new SysDept());
         return AjaxResult.success(depts);
         return AjaxResult.success(depts);
     }
     }
 
 
@@ -99,11 +96,6 @@ public class SysDeptController extends BaseController {
     @ApiOperation("获取楼栋列表-不分页(按目前的需求约定第三级组织机构为楼栋)-切勿应用数据权限")
     @ApiOperation("获取楼栋列表-不分页(按目前的需求约定第三级组织机构为楼栋)-切勿应用数据权限")
     @GetMapping("/{deptId}/building/list")
     @GetMapping("/{deptId}/building/list")
     public AjaxResult building(@PathVariable("deptId") Long deptId) {
     public AjaxResult building(@PathVariable("deptId") Long deptId) {
-        //为了方便查楼栋级节点,这里约定根节点的ID为100。
-        SysDept sysDept1 = deptService.selectDeptById(deptId);
-        if (!sysDept1.getDeptId().equals(100L)) {
-            AjaxResult.success();
-        }
         SysDept sysDept = new SysDept();
         SysDept sysDept = new SysDept();
         sysDept.setParentId(deptId);
         sysDept.setParentId(deptId);
         //这里不要有数据权限
         //这里不要有数据权限
@@ -263,10 +255,8 @@ public class SysDeptController extends BaseController {
      */
      */
     @GetMapping("/filterDept")
     @GetMapping("/filterDept")
     public AjaxResult filterDept() {
     public AjaxResult filterDept() {
-        //为了方便查楼栋级节点,这里约定根节点的ID为100。
         SysDept sysDept1 = deptService.selectDeptById(tokenService.getLoginUser().getSysUser().getDeptId());
         SysDept sysDept1 = deptService.selectDeptById(tokenService.getLoginUser().getSysUser().getDeptId());
         if(sysDept1.getParentId()==0){
         if(sysDept1.getParentId()==0){
-            //为了方便查二级节点,这里约定根节点的ID为100。
             SysDept sysDept = new SysDept();
             SysDept sysDept = new SysDept();
             sysDept.setParentId(sysDept1.getDeptId());
             sysDept.setParentId(sysDept1.getDeptId());
             List<SysDept> depts = deptService.selectDeptList(sysDept);
             List<SysDept> depts = deptService.selectDeptList(sysDept);

+ 2 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/mapper/SysDeptMapper.java

@@ -159,4 +159,6 @@ public interface SysDeptMapper {
     int selectLevelByUserId(Long userId);
     int selectLevelByUserId(Long userId);
 
 
     String queryDeptSignByUserId(Long userId);
     String queryDeptSignByUserId(Long userId);
+
+    List<SysDept> selectDeptListByCollege(SysDept dept);
 }
 }

+ 2 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/ISysDeptService.java

@@ -150,4 +150,6 @@ public interface ISysDeptService {
     SysDept updateDeptSign(SysDept dept);
     SysDept updateDeptSign(SysDept dept);
 
 
     Map<String, Object> queryDeptSignByUserId(Long userId);
     Map<String, Object> queryDeptSignByUserId(Long userId);
+
+    List<SysDept> selectDeptListByCollege(SysDept sysDept);
 }
 }

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

@@ -430,6 +430,13 @@ public class SysDeptServiceImpl implements ISysDeptService {
         return map;
         return map;
     }
     }
 
 
+
+    @Override
+    @DataScope(deptAlias = "d", permi = PerPrefix.SYSTEM_DEPT)
+    public List<SysDept> selectDeptListByCollege(SysDept dept) {
+        return deptMapper.selectDeptListByCollege(dept);
+    }
+
     /**
     /**
      * 递归列表
      * 递归列表
      */
      */

+ 13 - 0
zd-modules/zd-modules-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -177,6 +177,19 @@
                  where dept_id = (select dept_id from sys_user where user_id = #{userId})
                  where dept_id = (select dept_id from sys_user where user_id = #{userId})
              )a
              )a
     </select>
     </select>
+    <select id="selectDeptListByCollege" resultType="com.zd.system.api.domain.SysDept">
+        <include refid="selectDeptVo"/>
+        where d.del_flag = '0' AND parent_id in (select dept_id from sys_dept where parent_id = 0)
+        <if test="deptName != null and deptName != ''">
+            AND dept_name like concat('%', #{deptName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by d.parent_id, d.order_num
+    </select>
 
 
     <insert id="insertDept" parameterType="com.zd.system.api.domain.SysDept">
     <insert id="insertDept" parameterType="com.zd.system.api.domain.SysDept">
         insert into sys_dept(
         insert into sys_dept(