peng
2026-03-18 e59a0201057ba67cad425fed804c82ff4ba0c6f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.tievd.cube.modules.system.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import com.tievd.cube.modules.system.entity.SysDepart;
import org.springframework.data.repository.query.Param;
 
import java.util.List;
 
/**
 * 部门管理
 *
 * @author 杨欣武
 * @version 2.4.0
 * @since 2022-05-07
 */
public interface SysDepartMapper extends BaseMapper<SysDepart> {
 
    /**
     * 根据用户ID查询部门集合
     */
    List<SysDepart> queryUserDeparts(@Param("userId") String userId);
 
    /**
     * 根据用户名查询部门
     */
    List<SysDepart> queryDepartsByUsername(@Param("username") String username);
 
    /**
     * 根据用户名查询所属部门的所有OrgCode
     *
     * @param username 用户名
     * @return orgCode列表
     */
    List<String> queryDepartOrgCodesByUsername(@Param("username") String username);
 
    /**
     * 根据部门编码查询部门id
     */
    @Select("select id from sys_depart where org_code = #{orgCode}")
    String queryDepartIdByOrgCode(@Param("orgCode") String orgCode);
 
    /**
     * 根据部门id查询部门父级id
     */
    @Select("select id,parent_id from sys_depart where id = #{departId}")
    SysDepart getParentDepartId(@Param("departId") String departId);
 
    /**
     * 根据部门Id查询,当前和下级所有部门
     */
    List<String> getSubDepIdsByDepId(@Param("departId") String departId);
 
    /**
     * 根据部门编码获取部门下所有部门
     */
    List<String> getSubDepIdsByOrgCodes(@Param("orgCodes") String[] orgCodes);
}