SystemUserRoleDAO.xml 1.02 KB
<?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.yiboshi.science.dao.SystemUserRoleDAO">
    <sql id="allColumns">
        t.user_id
        as userId t.role_id as roleId, t.created as created
    </sql>
    <select id="getRoleListByPersonId" resultType="com.yiboshi.science.param.dto.SystemUserRoleDTO">
        select distinct b.id user_id
        from system_user_role a
                 left join system_user b on a.user_id = b.id
                 left join com_person c on b.person_id = c.id
        where c.id = #{personId}
    </select>
    <select id="getUserRoleByCertId" resultType="com.yiboshi.science.param.dto.SystemUserDTO">
        select distinct a.user_id id
        from system_user_role a
        left join system_user b on a.user_id = b.id
        left join com_person c on b.person_id = c.id
        where c.cert_id = #{certId} and a.role_id=#{roleId}
    </select>
</mapper>