| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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.yt.zhylplat.moduleLhzx.role.mapper.TLhzxMenuMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
- <id column="id" property="id" />
- <result column="menu_name" property="menuName" />
- <result column="parent_id" property="parentId" />
- <result column="parent_name" property="parentName" />
- <result column="order_num" property="orderNum" />
- <result column="path" property="path" />
- <result column="component" property="component" />
- <result column="is_frame" property="isFrame" />
- <result column="is_cache" property="isCache" />
- <result column="menu_type" property="menuType" />
- <result column="visible" property="visible" />
- <result column="status" property="status" />
- <result column="perms" property="perms" />
- <result column="icon" property="icon" />
- <result column="remark" property="remark" />
- <result column="create_user_id" property="createUserId" />
- <result column="create_date" property="createDate" />
- <result column="update_user_id" property="updateUserId" />
- <result column="update_date" property="updateDate" />
- <result column="del_flg" property="delFlg" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, menu_name, parent_id, parent_name, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, remark, create_user_id, create_date, update_user_id, update_date, del_flg
- </sql>
- <select id="selectMenuByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
- select
- *,
- id as menuId
- from
- T_Lhzx_Menu
- where
- del_flg = 0
- and
- menu_type in ('M', 'C')
- and
- status = 0
- and
- id in (
- select
- rm.menu_id
- from
- T_Lhzx_User_Role ur
- left join
- T_Lhzx_Role_Menu rm on ur.role_id = rm.role_id
- where
- ur.del_flg = 0
- and
- rm.del_flg = 0
- and
- ur.user_id = #{userId}
- )
- <if test="deptType != null">
- and dept_type = #{deptType}
- </if>
- order by
- parent_id, order_num
- </select>
- <select id="selectMenuList" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
- select
- *,
- id as menuId
- from
- T_Lhzx_Menu
- <where>
- <if test="menuName != null and menuName != ''">
- AND menu_name like concat('%', #{menuName}, '%')
- </if>
- <if test="visible != null and visible != ''">
- AND visible = #{visible}
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- <if test="deptType != null">
- AND dept_type = #{deptType}
- </if>
- and del_flg = 0
- </where>
- order by parent_id, order_num
- </select>
- <select id="selectMenuListByUserId" resultType="com.yt.zhylplat.moduleLhzx.role.entity.TLhzxMenu">
- select distinct
- m.id,
- m.parent_id,
- m.menu_name,
- m.path,
- m.component,
- m.visible,
- m.status,
- ifnull(m.perms,'') as perms,
- m.is_frame,
- m.is_cache,
- m.menu_type,
- m.icon,
- m.order_num,
- m.create_date
- from T_Lhzx_Menu m
- left join T_Lhzx_Role_Menu rm on m.id = rm.menu_id
- left join T_Lhzx_User_Role ur on rm.role_id = ur.role_id
- left join T_Lhzx_Role ro on ur.role_id = ro.id
- where ur.user_id = #{params.userId}
- <if test="menuName != null and menuName != ''">
- AND m.menu_name like concat('%', #{menuName}, '%')
- </if>
- <if test="visible != null and visible != ''">
- AND m.visible = #{visible}
- </if>
- <if test="status != null and status != ''">
- AND m.status = #{status}
- </if>
- order by m.parent_id, m.order_num
- </select>
- <select id="selectMenuPermsByUserId" resultType="java.lang.String">
- select distinct
- m.perms
- from
- T_Lhzx_Menu m
- left join
- T_Lhzx_Role_Menu rm on m.id = rm.menu_id
- left join
- T_Lhzx_User_Role ur on rm.role_id = ur.role_id
- left join
- T_Lhzx_Role r on r.id = ur.role_id
- where
- m.status = 0
- and
- r.status = 0
- and
- ur.user_id = #{userId}
- </select>
- </mapper>
|