CenterMenuMapper.xml
4.18 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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="org.nafmii.admin.user.dao.CenterMenuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.nafmii.admin.user.entity.CenterMenuPO">
<id column="ID" property="id" />
<result column="MENU_NAME" property="menuName" />
<result column="MENU_LEVLE" property="menuLevle" />
<result column="PARENT_ID" property="parentId" />
<result column="ORDER_SEQ" property="orderSeq" />
<result column="CREATE_TIME" property="createTime" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="IS_ENABLE" property="isEnable" />
<result column="CREATE_USER_ID" property="createUserId" />
<result column="UPDATE_USER_ID" property="updateUserId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ID, MENU_NAME, MENU_LEVLE, PARENT_ID, ORDER_SEQ, CREATE_TIME, UPDATE_TIME, IS_ENABLE, CREATE_USER_ID, UPDATE_USER_ID
</sql>
<!-- 新增修改中心端角色 -->
<update id="updateMenuById" parameterType="map" >
update CENTER_MENU
<set >
<if test="menuName != null" >
MENU_NAME = #{menuName,jdbcType=VARCHAR},
</if>
<if test="menuLevle != null" >
MENU_LEVLE = #{menuLevle,jdbcType=INTEGER},
</if>
<if test="parentId != null" >
PARENT_ID = #{parentId,jdbcType=BIGINT},
</if>
<if test="orderSeq != null" >
ORDER_SEQ = #{orderSeq,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
CREATE_TIME = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null" >
UPDATE_TIME = #{updateTime,jdbcType=BIGINT},
</if>
<if test="isEnable != null" >
IS_ENABLE = #{isEnable,jdbcType=VARCHAR},
</if>
<if test="createUserId != null" >
CREATE_USER_ID = #{createUserId,jdbcType=BIGINT},
</if>
<if test="updateUserId != null" >
UPDATE_USER_ID = #{updateUserId,jdbcType=BIGINT},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!-- 查询中心端菜单 -->
<select id="queryMenuList" parameterType="org.nafmii.admin.user.dto.CenterMenuDTO"
resultType="org.nafmii.admin.user.vo.CenterMenuVO">
select
ID as id, MENU_NAME as menuName, MENU_LEVLE as menuLevle, PARENT_ID as parentId, ORDER_SEQ as orderSeq,
CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable, CREATE_USER_ID as createUserId,
UPDATE_USER_ID as updateUserId
from CENTER_MENU
<where>
<if test="startCreateTime != null and endCreateTime != null">
DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') BETWEEN #{startCreateTime} and #{endCreateTime}
</if>
</where>
</select>
<!-- 删除中心端菜单 -->
<update id="deleteMenus">
update
CENTER_MENU
set IS_ENABLE = "1"
where
ID IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 中心端用户对应菜单查询 -->
<select id="queryUserMenus" parameterType="map" resultType="org.nafmii.admin.user.vo.CenterMenuVO">
SELECT
cm.ID as id, cm.MENU_NAME as menuName, cm.MENU_LEVLE as menuLevle, cm.PARENT_ID as parentId, cm.ORDER_SEQ as orderSeq,
cm.CREATE_TIME as createTime,cm.UPDATE_TIME as updateTime, cm.IS_ENABLE as isEnable, cm.CREATE_USER_ID as createUserId,
cm.UPDATE_USER_ID as updateUserId
FROM
CENTER_MENU cm
INNER JOIN CENTER_ROLE_MENU crm ON cm.id = crm.menu_id
INNER JOIN CENTER_USER_ROLE cur ON cur.role_id = crm.role_id
INNER JOIN CENTER_USER cu ON cur.user_id = cu.id
WHERE
cu.id = #{userid,jdbcType=BIGINT}
</select>
</mapper>