MonitorTemplateMapper.xml
6.7 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
<?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.ruoyi.web.controller.monitorTemplate.mapper.MonitorTemplateMapper">
<resultMap type="MonitorTemplate" id="MonitorTemplateResult">
<result property="id" column="id" />
<result property="templateName" column="template_name" />
<result property="groupId" column="group_id" />
<result property="groupName" column="group_name" />
<result property="userId" column="user_id" />
<result property="enableStatus" column="enable_status" />
<result property="deflag" column="deflag" />
<result property="createDate" column="create_date" />
<result property="createBy" column="create_by" />
<result property="updateDate" column="update_date" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectMonitorTemplateVo">
select id, template_name, group_id, group_name, user_id, enable_status, deflag, create_date, create_by, update_date, update_by from monitor_template
</sql>
<select id="selectMonitorTemplateList" parameterType="MonitorTemplate" resultMap="MonitorTemplateResult">
<include refid="selectMonitorTemplateVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="templateName != null and templateName != '' ">
and template_name LIKE CONCAT('%', #{templateName}, '%')
</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
<if test="groupName != null and groupName != '' "> and group_name = #{groupName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="enableStatus != null and enableStatus != '' "> and enable_status = #{enableStatus}</if>
<if test="deflag != null and deflag != '' "> and deflag = #{deflag}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
</where>
</select>
<select id="selectMonitorTemplateById" parameterType="Integer" resultMap="MonitorTemplateResult">
<include refid="selectMonitorTemplateVo"/>
where id = #{id}
</select>
<select id="selectMonitorTemplateByList"
resultType="com.ruoyi.web.controller.monitorTemplate.domain.MonitorTemplate" resultMap="MonitorTemplateResult">
<include refid="selectMonitorTemplateVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="templateName != null and templateName != '' ">and template_name = #{templateName}</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
<if test="groupName != null and groupName != '' "> and group_name = #{groupName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="enableStatus != null and enableStatus != '' "> and enable_status = #{enableStatus}</if>
<if test="deflag != null and deflag != '' "> and deflag = #{deflag}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
</where>
</select>
<insert id="insertMonitorTemplate" parameterType="MonitorTemplate" useGeneratedKeys="true" keyProperty="id">
insert into monitor_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateName != null and templateName != '' ">template_name,</if>
<if test="groupId != null ">group_id,</if>
<if test="groupName != null and groupName != '' ">group_name,</if>
<if test="userId != null ">user_id,</if>
<if test="enableStatus != null and enableStatus != '' ">enable_status,</if>
<if test="deflag != null and deflag != '' ">deflag,</if>
<if test="createDate != null ">create_date,</if>
<if test="createBy != null and createBy != '' ">create_by,</if>
<if test="updateDate != null ">update_date,</if>
<if test="updateBy != null and updateBy != '' ">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateName != null and templateName != '' ">#{templateName},</if>
<if test="groupId != null ">#{groupId},</if>
<if test="groupName != null and groupName != '' ">#{groupName},</if>
<if test="userId != null ">#{userId},</if>
<if test="enableStatus != null and enableStatus != '' ">#{enableStatus},</if>
<if test="deflag != null and deflag != '' ">#{deflag},</if>
<if test="createDate != null ">#{createDate},</if>
<if test="createBy != null and createBy != '' ">#{createBy},</if>
<if test="updateDate != null ">#{updateDate},</if>
<if test="updateBy != null and updateBy != '' ">#{updateBy},</if>
</trim>
</insert>
<update id="updateMonitorTemplate" parameterType="MonitorTemplate">
update monitor_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null and templateName != '' ">template_name = #{templateName},</if>
group_id = #{groupId},
group_name = #{groupName},
<if test="userId != null ">user_id = #{userId},</if>
<if test="enableStatus != null and enableStatus != '' ">enable_status = #{enableStatus},</if>
<if test="deflag != null and deflag != '' ">deflag = #{deflag},</if>
<if test="createDate != null ">create_date = #{createDate},</if>
<if test="createBy != null and createBy != '' ">create_by = #{createBy},</if>
<if test="updateDate != null ">update_date = #{updateDate},</if>
<if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMonitorTemplateById" parameterType="Integer">
delete from monitor_template where id = #{id}
</delete>
<delete id="deleteMonitorTemplateByIds" parameterType="String">
delete from monitor_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>