<?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.iemes.mapper.RoleMapper">
	<!--mybatis ehcache缓存配置 -->
	<!-- 以下两个<cache>标签二选一,第一个可以输出日志,第二个不输出日志 <cache type="org.mybatis.caches.ehcache.LoggingEhcache" 
		/> -->
	<!-- <cache type="org.mybatis.caches.ehcache.EhcacheCache"/> -->
	<!-- 以下与实体类的中字段一致 -->
	<sql id="selectId">
		id,
		state,
		name,
		roleKey,
		description
	</sql>
	<select id="seletUserRole" resultType="com.iemes.entity.RoleFormMap">
	select 
	<include refid="selectId"/>
	 from ly_role
		where ly_role.id
		in (SELECT roleId FROM ly_user_role WHERE
		userId=#{userId})
	</select>
</mapper>