RoleMapper.xml
3.19 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
<?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.bjivt.entity.showtime.Role">
<select id="findRole" resultType="com.bjivt.entity.showtime.Role" parameterType="com.bjivt.entity.showtime.Role">
select * from tbl_role
<trim prefix="where" prefixOverrides="and|or">
<if test="status != null and status !=''">
and status = #{status}
</if>
<if test="code != null and code !=''">
and code like '%${code}%'
</if>
<if test="name != null and name !=''">
and name like '%${name}%'
</if>
</trim>
order by ${orderBy}
<if test="startRow != null and sizeRow != null">
limit #{startRow},#{sizeRow}
</if>
</select>
<select id="findRoleByIds" resultType="com.bjivt.entity.showtime.Role" >
select * from tbl_role where 1=1
<foreach item="id" index="index" collection="list" open="and id in (" separator="," close=")">
#{id}
</foreach>
</select>
<select id="getRoleCount" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.Role">
select count(1) from tbl_role
<trim prefix="where" prefixOverrides="and|or">
<if test="status != null and status !=''">
and status = #{status}
</if>
<if test="code != null and code !=''">
and code like '%${code}%'
</if>
<if test="name != null and name !=''">
and name like '%${name}%'
</if>
</trim>
</select>
<select id="getRole" resultType="com.bjivt.entity.showtime.Role" >
select * from tbl_role where id = #{roleId}
</select>
<insert id="addRole" parameterType="com.bjivt.entity.showtime.Role">
insert into tbl_role
(id,name,note,status,code,operatorId,createDate,createTime)
values
(#{id},#{name},#{note},#{status},#{code},#{operatorId},#{createDate},#{createTime})
</insert>
<update id="updateRole" parameterType="com.bjivt.entity.showtime.Role">
update tbl_role set name = #{name},note = #{note},status = #{status},code = #{code},operatorId = #{operatorId}
where id = #{id}
</update>
<delete id="deleteRole">
delete from tbl_role where id = #{roleId}
</delete>
<delete id="deleteCompetenceForRole">
delete from tbl_role_competence where roleId = #{roleId}
</delete>
<delete id="deleteRoleState">
delete from tbl_role_state where roleId = #{roleId}
</delete>
<insert id="addRoleCompetence" >
insert into tbl_role_competence
(roleId,competenceId)
values
(#{roleId},#{competenceId})
</insert>
<insert id="addRoleState" >
insert into tbl_role_state
(role_Id,Activiti_elementId)
values
(#{roleId},#{roleSteate})
</insert>
<select id="findCompetenceIdsForRoleId" resultType="java.lang.String">
select competenceId from tbl_role_competence
where roleId = #{roleId}
</select>
<select id="findCompetencesForRoleId" resultType="com.bjivt.entity.showtime.Competence">
select cp from Competence as cp where cp.id in (select rc.competenceId from tbl_role_competence as rc
where rc.roleId = #{roleId})
</select>
</mapper>