|
- <?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.tuoheng.mapper.op.MenusMapper">
-
- <resultMap id="BaseResultMap" type="com.tuoheng.model.entity.Menu">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="createUser" column="create_user" jdbcType="INTEGER"/>
- <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
- <result property="mark" column="mark" jdbcType="TINYINT"/>
- <result property="parentId" column="parent_id" jdbcType="INTEGER"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="clientId" column="client_id" jdbcType="VARCHAR"/>
- <result property="menuIcon" column="menu_icon" jdbcType="VARCHAR"/>
- <result property="path" column="path" jdbcType="VARCHAR"/>
- <result property="component" column="component" jdbcType="VARCHAR"/>
- <result property="target" column="target" jdbcType="VARCHAR"/>
- <result property="isHidden" column="is_hidden" jdbcType="INTEGER"/>
- <result property="sort" column="sort" jdbcType="INTEGER"/>
- <result property="status" column="status" jdbcType="INTEGER"/>
- </resultMap>
-
- <sql id="Base_Column_List">
- id,create_time,update_time,
- create_user,update_user,mark,
- parent_id,name,client_id,
- menu_icon,path,component,
- target,is_hidden,sort,status
- </sql>
-
- <!--根据角色id获取对应的菜单集合 无父级-->
- <select id="getOpMenusByRoleId" resultType="com.tuoheng.model.entity.Menu">
- select
- <include refid="Base_Column_List"/>
- from op_menus
- where mark = 1 and parent_id = 0
- and status = 1
- and id in (select menu_id from op_role_menu where role_id = #{roleId} and mark = 1)
- order by sort asc
- </select>
-
- <!--根据父级id查询所属对应的菜单列表-->
- <select id="getChildrenMenuByPid" resultType="com.tuoheng.model.entity.Menu">
- select
- <include refid="Base_Column_List"/>
- from op_menus
- where mark = 1 and status = 1 and parent_id = #{parentId}
- order by sort asc
- </select>
- </mapper>
|