<?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.jkcredit.invoice.hub.mapper.RoleMapper">
    <resultMap id="baseResultMap" type="com.jkcredit.invoice.hub.model.po.role.RolePo">
        <id column="id" property="id"/>
        <result column="role" property="role"/>
        <result column="role_name" property="roleName"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="activated" property="activated"/>
    </resultMap>

    <select id="getRoles" resultMap="baseResultMap">
        select * from
        h_role
        <where>
            and activated = 1
            <if test="query.roleName != null and query.roleName != ''">
                and role_name like CONCAT('%',#{query.roleName},'%')
            </if>
        </where>
    </select>

    <select id="getRolesWithoutPage" resultMap="baseResultMap">
        select * from
        h_role
        where activated = 1
    </select>
</mapper>
