Przeglądaj źródła

根据ID查询所有子部门

chenshudong 3 miesięcy temu
rodzic
commit
9953188357

+ 8 - 0
airport-system/src/main/java/com/sundot/airport/system/mapper/SysDeptMapper.java

@@ -156,4 +156,12 @@ public interface SysDeptMapper {
156 156
      * @return 指定角色人员
157 157
      */
158 158
     public List<SysUser> deptRole(@Param("deptId") Long deptId, @Param("list") List<String> list);
159
+
160
+    /**
161
+     * 根据ID查询所有子部门(正常状态)
162
+     *
163
+     * @param deptId 部门ID
164
+     * @return 部门列表
165
+     */
166
+    public List<SysDept> selectUseChildrenDeptById(Long deptId);
159 167
 }

+ 8 - 0
airport-system/src/main/java/com/sundot/airport/system/service/ISysDeptService.java

@@ -188,4 +188,12 @@ public interface ISysDeptService {
188 188
      * @return 上级部门信息
189 189
      */
190 190
     public DeptInfo getDeptInfoByDeptId(Long deptId);
191
+
192
+    /**
193
+     * 根据ID查询所有子部门
194
+     *
195
+     * @param deptId 部门ID
196
+     * @return 部门列表
197
+     */
198
+    public List<SysDept> selectChildrenDeptById(Long deptId);
191 199
 }

+ 11 - 0
airport-system/src/main/java/com/sundot/airport/system/service/impl/SysDeptServiceImpl.java

@@ -598,4 +598,15 @@ public class SysDeptServiceImpl implements ISysDeptService {
598 598
         result.setStationName(station.getDeptName());
599 599
         return result;
600 600
     }
601
+
602
+    /**
603
+     * 根据ID查询所有子部门
604
+     *
605
+     * @param deptId 部门ID
606
+     * @return 部门列表
607
+     */
608
+    @Override
609
+    public List<SysDept> selectChildrenDeptById(Long deptId) {
610
+        return deptMapper.selectUseChildrenDeptById(deptId);
611
+    }
601 612
 }

+ 8 - 0
airport-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -273,4 +273,12 @@
273 273
             #{item}
274 274
         </foreach>
275 275
     </select>
276
+
277
+    <select id="selectUseChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
278
+        select *
279
+        from sys_dept
280
+        where status = '0'
281
+          and del_flag = '0'
282
+          and find_in_set(#{deptId}, ancestors)
283
+    </select>
276 284
 </mapper>