MenuMapper.xml 1.58 KB
Newer Older
liqin's avatar
liqin committed
1 2
<?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">
liqin's avatar
liqin committed
3
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.MenuMapper">
liqin's avatar
liqin committed
4 5

    <!-- 通用查询映射结果 -->
6
    <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.Menu">
liqin's avatar
liqin committed
7 8 9 10
        <id column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="is_deleted" property="isDeleted" />
wzp's avatar
wzp committed
11 12
        <result column="url" property="url" />
        <result column="name" property="name" />
liqin's avatar
liqin committed
13 14
        <result column="parent_id" property="parentId" />
        <result column="is_button" property="isButton" />
15
        <result column="level" property="level" />
wzp's avatar
wzp committed
16 17 18
        <result column="icon" property="icon" />
        <result column="color" property="color" />
        <result column="avatar" property="avatar" />
liqin's avatar
liqin committed
19 20 21
    </resultMap>

    <select id="getUserMenuPerms" resultMap="BaseResultMap">
22
        SELECT distinct
wzp's avatar
wzp committed
23
            m.id,m.name,m.url,m.parent_id,m.sort,m.is_button,m.level,m.icon,m.color,m.avatar
liqin's avatar
liqin committed
24 25 26 27 28
        FROM
            ref_role_menu rm
        LEFT JOIN menu m ON m.id = rm.menu_id
        <where>
            m.is_deleted = 0
29 30 31 32 33
            <if test="list!=null">
                AND rm.role_id in
            <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
liqin's avatar
liqin committed
34 35
            </if>
        </where>
wzp's avatar
wzp committed
36
        ORDER BY m.level desc,m.sort
liqin's avatar
liqin committed
37 38 39
    </select>

</mapper>