<?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.sandu.ximon.dao.mapper.RoleMapper">
|
|
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.Role">
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
<result property="level" column="level" jdbcType="INTEGER"/>
|
<result property="permission" column="permission" jdbcType="VARCHAR"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
|
<resultMap id="RoleDetail" type="com.sandu.ximon.dao.domain.RoleDetail" extends="BaseResultMap">
|
<collection property="menuIdList" columnPrefix="menu_" ofType="java.lang.Long">
|
<constructor>
|
<arg column="menu_id" javaType="long"/>
|
</constructor>
|
|
</collection>
|
</resultMap>
|
|
|
<select id="listRole" resultMap="RoleDetail">
|
SELECT t1.*,
|
t2.menu_id AS menu_menu_id
|
FROM role t1
|
LEFT JOIN role_menu_relation t2 ON t1.id = t2.role_id
|
<where>
|
t1.id IN
|
<foreach collection="roleIdList" separator="," item="roleId" open="(" close=")">
|
#{roleId}
|
</foreach>
|
</where>
|
ORDER BY t1.id ASC
|
</select>
|
</mapper>
|