<?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.njzscloud.supervisory.role.mapper.SysRoleMapper">

    <select id="paging" resultType="com.njzscloud.supervisory.role.pojo.SysRoleEntity">
        SELECT id,
        role_code,
        role_name,
        memo,
        creator_id,
        modifier_id,
        create_time,
        modify_time,
        deleted
        FROM sys_role
        <if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment !=''">
            ${ew.customSqlSegment}
        </if>
    </select>

    <select id="selectRoleByUserId" resultType="java.lang.String">
        SELECT a.role_code
        FROM sys_role a
        INNER JOIN sys_user_role b ON b.role_id = a.id AND b.user_id = #{userId}
        WHERE a.deleted = 0
    </select>

</mapper>
