SysMenuDao.xml
5.5 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?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.tianbo.analysis.dao.SysMenuDao">
<resultMap id="BaseResultMap" type="com.tianbo.analysis.model.SysMenu">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="PARENTID" jdbcType="DECIMAL" property="parentid" />
<result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
<result column="MENU_SORT" jdbcType="VARCHAR" property="menuSort" />
<result column="MENU_CONTROLL" jdbcType="VARCHAR" property="menuControll" />
<result column="MENU_VIEW" jdbcType="VARCHAR" property="menuView" />
<result column="MENU_NAME" jdbcType="VARCHAR" property="menuName" />
</resultMap>
<resultMap id="treeMap" type="com.tianbo.analysis.model.SysMenu">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="PARENTID" jdbcType="DECIMAL" property="parentid" />
<result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
<result column="MENU_SORT" jdbcType="VARCHAR" property="menuSort" />
<result column="MENU_CONTROLL" jdbcType="VARCHAR" property="menuControll" />
<result column="MENU_VIEW" jdbcType="VARCHAR" property="menuView" />
<result column="MENU_NAME" jdbcType="VARCHAR" property="menuName" />
<collection property="children" column="ID" javaType="java.util.ArrayList" ofType="com.tianbo.analysis.model.SysMenu" select="selectByParentId">
</collection>
</resultMap>
<sql id="Base_Column_List">
ID, PARENTID, CREATETIME, MENU_SORT, MENU_CONTROLL, MENU_VIEW, MENU_NAME
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from SYS_MENU
where ID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectByParentId" parameterType="java.lang.Integer" resultMap="treeMap">
select
<include refid="Base_Column_List" />
from SYS_MENU
where PARENTID = #{id,jdbcType=DECIMAL}
</select>
<select id="selectRoleMenu" parameterType="java.util.Map" resultMap="treeMap">
SELECT
<include refid="Base_Column_List" />
FROM SYS_MENU
WHERE menu_controll = '1'
and PARENTID = 0
AND ID IN
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
ORDER BY PARENTID, MENU_SORT
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from SYS_MENU
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert id="insert" keyColumn="ID" keyProperty="id" parameterType="com.tianbo.analysis.model.SysMenu" useGeneratedKeys="true">
insert into SYS_MENU (PARENTID, CREATETIME, MENU_SORT,
MENU_CONTROLL, MENU_VIEW, MENU_NAME
)
values (#{parentid,jdbcType=DECIMAL}, #{createtime,jdbcType=TIMESTAMP}, #{menuSort,jdbcType=VARCHAR},
#{menuControll,jdbcType=VARCHAR}, #{menuView,jdbcType=VARCHAR}, #{menuName,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="ID" keyProperty="id" parameterType="com.tianbo.analysis.model.SysMenu" useGeneratedKeys="true">
insert into SYS_MENU
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentid != null">
PARENTID,
</if>
<if test="createtime != null">
CREATETIME,
</if>
<if test="menuSort != null">
MENU_SORT,
</if>
<if test="menuControll != null">
MENU_CONTROLL,
</if>
<if test="menuView != null">
MENU_VIEW,
</if>
<if test="menuName != null">
MENU_NAME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentid != null">
#{parentid,jdbcType=DECIMAL},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
<if test="menuSort != null">
#{menuSort,jdbcType=VARCHAR},
</if>
<if test="menuControll != null">
#{menuControll,jdbcType=VARCHAR},
</if>
<if test="menuView != null">
#{menuView,jdbcType=VARCHAR},
</if>
<if test="menuName != null">
#{menuName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.tianbo.analysis.model.SysMenu">
update SYS_MENU
<set>
<if test="parentid != null">
PARENTID = #{parentid,jdbcType=DECIMAL},
</if>
<if test="createtime != null">
CREATETIME = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="menuSort != null">
MENU_SORT = #{menuSort,jdbcType=VARCHAR},
</if>
<if test="menuControll != null">
MENU_CONTROLL = #{menuControll,jdbcType=VARCHAR},
</if>
<if test="menuView != null">
MENU_VIEW = #{menuView,jdbcType=VARCHAR},
</if>
<if test="menuName != null">
MENU_NAME = #{menuName,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=DECIMAL}
</update>
<update id="updateByPrimaryKey" parameterType="com.tianbo.analysis.model.SysMenu">
update SYS_MENU
set PARENTID = #{parentid,jdbcType=DECIMAL},
CREATETIME = #{createtime,jdbcType=TIMESTAMP},
MENU_SORT = #{menuSort,jdbcType=VARCHAR},
MENU_CONTROLL = #{menuControll,jdbcType=VARCHAR},
MENU_VIEW = #{menuView,jdbcType=VARCHAR},
MENU_NAME = #{menuName,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL}
</update>
</mapper>