<?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.sy.coinage.sys.dao.UserRoleDao">

  <sql id="Base_Column_List">
    id
    , user_id, role_id
  </sql>
  <select id="selectRoleIdsByUserId" parameterType="java.lang.Integer"
    resultType="java.lang.Integer">
    select role_id
    from sys_user_role
    where user_id = #{userId,jdbcType=INTEGER}
  </select>

  <select id="selectUserIdsByRoleId" parameterType="java.lang.Integer"
          resultType="java.lang.Integer">
    select user_id
    from sys_user_role
    where role_id = #{roleId,jdbcType=INTEGER}
  </select>

  <select id="queryOptList" resultType="com.sy.coinage.core.vo.OptVO" parameterType="java.lang.Integer">
    select ur.user_id as id, u.real_name as name
    from sys_user_role ur left join sys_user u on ur.user_id = u.id
         where role_id = #{roleId,jdbcType=INTEGER}

  </select>


</mapper>
