浏览代码

fix 修改疫苗权限查询

Administrator 3 年之前
父节点
当前提交
8ca6ab484e

+ 5 - 3
boman-modules/boman-system/src/main/java/com/boman/system/controller/SysDeptController.java

@@ -264,13 +264,15 @@ public class SysDeptController extends BaseController
         return deptService.getByParentId(parentId);
     }
 
+    @GetMapping("/auth")
     public AjaxResult setAncestors() {
-        List<SysDept> sysDepts = deptService.selectDepts(new SysDept());
+        List<SysDept> sysDepts = deptService.selectDeptsList();
         for (SysDept sysDept : sysDepts) {
             String ancestors = sysDept.getAncestors();
             if (StringUtils.isEmpty(ancestors)) {
-                Long id = sysDept.getId();
-                SysDept parent1 = deptService.getParentById(id);
+                Long parentId = sysDept.getParentId();
+                //根据子的parentId找到对应的父对象
+                SysDept parent1 = deptService.getParentById(parentId);
                 if (parent1 == null) {
                     continue;
                 }

+ 8 - 2
boman-modules/boman-system/src/main/java/com/boman/system/mapper/SysDeptMapper.java

@@ -21,6 +21,12 @@ public interface SysDeptMapper
      */
     public List<SysDept> selectDeptList(SysDept dept);
 
+    /**
+     * 查询部门全部数据,不带权限
+     * @return
+     */
+    public List<SysDept> selectDeptsList();
+
     /**
      * 根据角色ID查询部门树信息
      * 
@@ -134,8 +140,8 @@ public interface SysDeptMapper
     /**
      * 功能描述: 只找父亲,不招爷爷
      *
-     * @param deptId deptId
+     * @param parentId parentId
      * @return com.boman.domain.SysDept
      */
-    SysDept getParentById(Long deptId);
+    SysDept getParentById(Long parentId);
 }

+ 8 - 2
boman-modules/boman-system/src/main/java/com/boman/system/service/ISysDeptService.java

@@ -29,6 +29,12 @@ public interface ISysDeptService
      */
     public List<SysDept> selectDepts(SysDept dept);
 
+    /**
+     * 查询部门全部数据,不带权限
+     * @return
+     */
+    public List<SysDept> selectDeptsList();
+
     /**
      * 构建前端所需要树结构
      * 
@@ -139,8 +145,8 @@ public interface ISysDeptService
     /**
      * 功能描述: 只找父亲,不招爷爷
      *
-     * @param deptId deptId
+     * @param parentId parentId
      * @return com.boman.domain.SysDept
      */
-    SysDept getParentById(Long deptId);
+    SysDept getParentById(Long parentId);
 }

+ 13 - 3
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysDeptServiceImpl.java

@@ -103,6 +103,16 @@ public class SysDeptServiceImpl implements ISysDeptService {
         return deptMapper.selectDeptList(dept);
     }
 
+    /**
+     *查询部门全部数据,不带权限
+     * @return
+     */
+    @Override
+    public List<SysDept> selectDeptsList() {
+        List<SysDept> sysDepts = deptMapper.selectDeptsList();
+        return sysDepts;
+    }
+
     /**
      * 构建前端所需要树结构
      *
@@ -512,11 +522,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
     /**
      * 功能描述: 只找父亲,不招爷爷
      *
-     * @param deptId deptId
+     * @param parentId deptId
      * @return com.boman.domain.SysDept
      */
     @Override
-    public SysDept getParentById(Long deptId) {
-        return deptMapper.getParentById(deptId);
+    public SysDept getParentById(Long parentId) {
+        return deptMapper.getParentById(parentId);
     }
 }

+ 8 - 1
boman-modules/boman-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -48,6 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		order by d.parent_id, d.order_num
     </select>
 
+
+	<select id="selectDeptsList"  resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.del_flag = '0'
+		order by d.parent_id, d.order_num
+	</select>
+
 	<select id="validateHasChirld" parameterType="java.util.List" resultMap="SysDeptResult">
 		SELECT a.id as id, count(1) as num FROM sys_dept a LEFT JOIN sys_dept b on a.id = b.parent_id WHERE b.parent_id in
 		<foreach collection="depts" item="dept" index="index" separator="," open="(" close=")">
@@ -178,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="getParentById" resultMap="SysDeptResult">
 		<include refid="selectDeptVo"/>
-		where d.parent_id = #{deptId}
+		where d.id = #{parentId}
 	</select>
 
 </mapper>