forked from kidgrow-microservices-platform

侯瑞军
2020-04-08 6325ff05bb15908b3dd975e958737c5dddf0e50d
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
<?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.kidgrow.usercenter.mapper.SysRoleMapper">
    <sql id="Column_List">
            id,
            code,
            name,
            create_time,
            update_time,
            is_del,
            enabled,
            tenant_id
    </sql>
 
    <sql id="where">
        <where>
            t.is_del=0
            <if test="r.enabled != null and r.enabled != ''">
                and t.enabled = #{r.enabled}
            </if>
            <if test="r.tenantId != null and r.tenantId != ''">
                and t.tenant_id = #{r.tenantId}
            </if>
            <if test="r.name != null and r.name != ''">
                and t.name like concat('%', #{r.name}, '%')
            </if>
            <if test="r.searchKey != null and r.searchKey != '' and r.searchKey=='name'">
                and t.name like concat('%', #{r.searchValue}, '%')
            </if>
        </where>
    </sql>
 
    <select id="findList" resultType="com.kidgrow.common.model.SysRole">
        select <include refid="Column_List"/>
        from sys_role t
        <include refid="where" />
        order by t.create_time desc
    </select>
 
    <select id="findAll" resultType="com.kidgrow.common.model.SysRole">
        select <include refid="Column_List"/>
        from sys_role
        order by create_time desc
    </select>
</mapper>