<?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.qmth.themis.business.dao.TBUserRoleMapper">

    <select id="userQueryByRole" resultType="com.qmth.themis.business.entity.TBUser">
        select
            tbu.id
        from
            t_b_user tbu
        left join t_b_user_role tbur on
            tbur.user_id = tbu.id
        <where>
            <if test="orgId != null and orgId != ''">
                and tbu.org_id = #{orgId}
            </if>
            <if test="roleCode != null and roleCode != ''">
                and tbur.role_code = #{roleCode}
            </if>
        </where>
    </select>
</mapper>
