mg
2022-10-12 3f9ebf19e687c33287b0eaec64d4564a212f57db
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
<?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">
<mapper namespace="com.ycl.mapper.depart.UmsDepartMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.entity.depart.UmsDepart">
        <id column="id" property="id" />
        <result column="depart_name" property="departName" />
        <result column="depart_des" property="departDes" />
        <result column="depart_type" property="departType" />
        <result column="parent_id" property="parentId" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="is_deleted" property="isDeleted" />
    </resultMap>
    <resultMap type="com.ycl.entity.depart.UmsDepart" id="UserDepartResultMap" extends="BaseResultMap">
        <collection property="userInfoDTOS" javaType="ArrayList" ofType="com.ycl.dto.user.DepartUserDTO">
            <id column="user_id" property="userId" />
            <result column="username" property="username" />
        </collection>
    </resultMap>
 
    <select id="selectDepartList"  resultMap="UserDepartResultMap">
        SELECT
            ud.*,ua.id user_id,ua.username
        FROM
            ums_depart ud
                LEFT JOIN ums_depart_manager udm ON ud.id = udm.depart_id
                LEFT JOIN ums_admin ua ON udm.user_id = ua.id
    </select>
 
 
</mapper>