<?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.yunzhi.marketing.mapper.TaRoleMapper">
    <select id="getRolesByUser" resultType="com.yunzhi.marketing.entity.TaRole">
        SELECT
            t.*
        FROM
            ta_role t
        INNER JOIN ta_user_role s ON t.role_id = s.role_id
        WHERE
            s.user_id = #{user}
    </select>

    <select id="getRolesByBtnId" resultType="com.yunzhi.marketing.entity.TaRole">
        SELECT
            t.*
        FROM
        ta_role_button trb left JOIN  ta_role t
        ON trb.role_id = t.role_id
        WHERE
            trb.btn_id = #{btnId}
    </select>
</mapper>
