kaiyu
2021-03-10 5097d13418e9a0bf605f5272f1b9e60fc62c80cb
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
<?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.ManageRoleMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.moral.api.entity.ManageRole">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_delete" property="isDelete"/>
        <result column="desc" property="desc"/>
    </resultMap>
 
    <sql id="Base_Column_List">
            mr.id,mr.name,mr.create_time,mr.update_time,mr.is_delete,mr.desc
        </sql>
 
    <select id="getManageRoleByAccountId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"></include>
        FROM
        manage_role mr
        JOIN manage_account_role mar
        ON mar.role_id=mr.id AND mar.is_delete = 0
        JOIN manage_account ma
        ON ma.id=mar.account_id and ma.id = #{accountId}
        where
        mr.is_delete=0
    </select>
</mapper>