AuthModuleMapper.xml
3.35 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
<?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.monitor.mysql.mapper.AuthModuleMapper" >
<resultMap id="BaseResultMap" type="com.model.AuthModule" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="module_name" property="moduleName" jdbcType="VARCHAR" />
<result column="module_cname" property="moduleCName" jdbcType="VARCHAR" />
<result column="module_group" property="moduleGroup" jdbcType="VARCHAR" />
<result column="module_group_name" property="moduleGroupName" jdbcType="VARCHAR" />
<result column="module_level" property="moduleLevel" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, module_name, module_level, module_cname, module_group, module_group_name
</sql>
<select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from auth_module
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByName" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from auth_module
where module_name = #{moduleName,jdbcType=VARCHAR}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auth_module
</select>
<select id="selectAllByKeys" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auth_module
where 1=1
<if test="keys != null and keys != '' " >
AND (module_name like CONCAT('%',#{keys},'%') or module_name like CONCAT('%',#{keys},'%') )
</if>
order by module_group,module_group_name,id
</select>
<insert id="insert" parameterType="com.model.AuthModule" >
insert into auth_module
(module_name,module_level,module_cname, module_group, module_group_name, create_time, update_time)
values
(#{moduleName,jdbcType=VARCHAR},#{moduleLevel,jdbcType=INTEGER},
#{moduleCName,jdbcType=VARCHAR},#{moduleGroup,jdbcType=VARCHAR},
#{moduleGroupName,jdbcType=VARCHAR},
now(),now())
</insert>
<update id="updateLevel" parameterType="com.model.AuthModule" >
update auth_module
set module_level = #{moduleLevel,jdbcType=VARCHAR},
module_cname = #{moduleCName,jdbcType=VARCHAR},
module_group = #{moduleGroup,jdbcType=VARCHAR},
module_group_name = #{moduleGroupName,jdbcType=VARCHAR},
update_time = now()
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectCount" resultType="java.lang.Integer">
select
count(1)
from auth_module
where 1=1
<if test="keys != null and keys != '' " >
AND (module_name like CONCAT('%',#{keys},'%') or module_name like CONCAT('%',#{keys},'%') )
</if>
</select>
<select id="selectAuthModules" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auth_module
where
1=1
<if test="keys != null and keys != '' " >
AND (module_name like CONCAT('%',#{keys},'%') or module_name like CONCAT('%',#{keys},'%') )
</if>
order by id desc
limit #{startIndex},#{pageSize}
</select>
<delete id="deleteByName" parameterType="java.lang.String" >
delete from auth_module
where module_name = #{name,jdbcType=VARCHAR}
</delete>
</mapper>