79 lines
2.9 KiB
XML
79 lines
2.9 KiB
XML
<?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="cc.iteachyou.cms.dao.MenuMapper">
|
|
<resultMap id="BaseResultMap" type="cc.iteachyou.cms.entity.Menu">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
-->
|
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
|
<result column="menu_name" jdbcType="VARCHAR" property="menuName" />
|
|
<result column="menu_code" jdbcType="VARCHAR" property="menuCode" />
|
|
<result column="menu_url" jdbcType="VARCHAR" property="menuUrl" />
|
|
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
|
|
<result column="menu_icon" jdbcType="VARCHAR" property="menuIcon" />
|
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
</resultMap>
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cc.iteachyou.cms.entity.Menu">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
-->
|
|
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
-->
|
|
id, menu_name, menu_code, menu_url, parent_id, menu_icon, sort, create_by, create_time,
|
|
update_by, update_time
|
|
</sql>
|
|
<sql id="Blob_Column_List">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
-->
|
|
remark
|
|
</sql>
|
|
|
|
<select id="queryListByPage" parameterType="java.util.Map" resultType="cc.iteachyou.cms.entity.Menu">
|
|
select
|
|
m.*,
|
|
p.menu_name as parentMenuName
|
|
from system_menu m
|
|
left join system_menu p on p.id = m.parent_id
|
|
where 1 = 1
|
|
<if test="menuName != null and menuName != ''">
|
|
and m.menu_name like concat('%',#{menuName,jdbcType=VARCHAR},'%')
|
|
</if>
|
|
<if test="menuCode != null and menuCode != ''">
|
|
and m.menu_code = #{menuCode,jdbcType=VARCHAR}
|
|
</if>
|
|
order by m.parent_id,m.sort asc
|
|
</select>
|
|
|
|
<select id="selectListByUserId" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
|
SELECT
|
|
*
|
|
FROM system_menu m WHERE m.id IN(
|
|
SELECT rp.permission_id FROM system_role_permission rp WHERE rp.role_id IN(
|
|
SELECT ur.role_id FROM system_user_role ur WHERE ur.user_id = #{userId,jdbcType=VARCHAR}
|
|
)
|
|
AND rp.type = '1'
|
|
)
|
|
<if test="parentId != null and parentId != ''">
|
|
and m.parent_id = #{parentId,jdbcType=VARCHAR}
|
|
</if>
|
|
order by m.sort asc
|
|
</select>
|
|
|
|
<select id="selectListByParentId" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
|
SELECT
|
|
*
|
|
FROM system_menu m
|
|
WHERE
|
|
m.parent_id = #{parentId,jdbcType=VARCHAR}
|
|
order by m.sort asc
|
|
</select>
|
|
</mapper> |