jinpengyong
2021-03-12 e442e98a198d67994e6dce01fd88e163291fd40c
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
<?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.moral.api.mapper.GroupMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.moral.api.entity.Group">
        <id column="id" property="id"/>
        <result column="group_name" property="groupName"/>
        <result column="organization_id" property="organizationId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_delete" property="isDelete"/>
    </resultMap>
 
    <resultMap id="GroupResultMap" type="java.util.LinkedHashMap">
        <id column="id" property="id"/>
        <result column="group_name" property="groupName"/>
        <result column="organization_id" property="organizationId"/>
    </resultMap>
 
    <select id="selectUserGroup" resultMap="GroupResultMap">
        SELECT g.id,g.group_name
        FROM `group` g,`user_group` ug
        WHERE ug.user_id = #{userId}
        AND ug.group_id = g.id
        AND g.is_delete = 0
        AND ug.is_delete = 0
        ORDER BY g.id
    </select>
</mapper>