RoleMenuDao.xml
1.9 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
<?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.RoleMenuDao">
<resultMap id="BaseResultMap" type="com.tianbo.analysis.model.RoleMenu">
<result column="ID" jdbcType="VARCHAR" property="id" />
<result column="ROLENAME" jdbcType="VARCHAR" property="rolename" />
<result column="MENUID" jdbcType="VARCHAR" property="menuid" />
<result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
</resultMap>
<insert id="insert" parameterType="com.tianbo.analysis.model.RoleMenu">
insert into ROLE_MENU (ID, ROLENAME, MENUID,
CREATETIME)
values (#{id,jdbcType=VARCHAR}, #{rolename,jdbcType=VARCHAR}, #{menuid,jdbcType=VARCHAR},
#{createtime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.tianbo.analysis.model.RoleMenu">
insert into ROLE_MENU
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="rolename != null">
ROLENAME,
</if>
<if test="menuid != null">
MENUID,
</if>
<if test="createtime != null">
CREATETIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="rolename != null">
#{rolename,jdbcType=VARCHAR},
</if>
<if test="menuid != null">
#{menuid,jdbcType=VARCHAR},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="getUserMenus" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT B.MENUID
FROM COMPANYUSER A
LEFT JOIN ROLE_MENU B ON A.ROLENAMEID = B.ID
WHERE A.ID = #{userid,jdbcType=VARCHAR}
</select>
</mapper>