MenuMapper.xml
2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?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="cn.com.glsx.dj.system.mapper.MenuMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.system.model.Menu" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="parent_code" property="parentCode" jdbcType="INTEGER" />
<result column="type" property="type" jdbcType="TINYINT" />
<result column="order_no" property="orderNo" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.system.dto.MenuDTO" extends="BaseResultMap"></resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, code, name, url, parent_code, type,order_no, created_by, created_date, updated_by,
updated_date, deleted_flag
</sql>
<select id="list" parameterType="cn.com.glsx.dj.system.dto.MenuDTO" resultMap="DTOResultMap">
select <include refid="Base_Column_List"/> from dj_system_menu a
<where>
deleted_flag = 'N'
<if test="name != null and name !=''">
and name LIKE "%"#{name}"%"
</if>
<if test="code != null">
and code =#{code}
</if>
<if test="parentCode != null">
and parent_code = #{parentCode}
</if>
<if test="userId != null or roleId != null">
and a.code in (
select b.menu_code from dj_system_role_menu b
left join dj_system_role c on c.id=b.role_id
left join dj_system_user_role d on d.role_id=b.role_id and d.deleted_flag='N'
where b.deleted_flag='N' and c.deleted_flag='N'
<if test="userId != null">
and d.user_id = #{userId}
</if>
<if test="roleId != null">
and b.role_id = #{roleId}
</if>
)
</if>
</where>
order by order_no asc
</select>
<select id="listUserAuth" parameterType="cn.com.glsx.dj.system.dto.MenuDTO" resultMap="DTOResultMap">
select id,code,name,url,parent_code,type,order_no from dj_system_menu a
<where>
deleted_flag = 'N'
<if test="menuCodes != null">
and code in
<foreach collection="menuCodes" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
order by order_no asc
</select>
</mapper>