TaskSheduleMapper.xml
6.88 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?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.TaskSheduleMapper">
<resultMap id="BaseResultMap" type="com.model.TaskModel">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="alarm_interval" property="interval" jdbcType="INTEGER"/>
<result column="relax_start_time" property="relaxStartTime" jdbcType="INTEGER"/>
<result column="relax_end_time" property="relaxEndTime" jdbcType="INTEGER"/>
<result column="time_flag" property="timeFlag" jdbcType="INTEGER"/>
<result column="alarm_type" property="alarmType" jdbcType="INTEGER"/>
<result column="alarm_num_flag" property="alarmNumFlag" jdbcType="INTEGER"/>
<result column="is_run" property="isRun" jdbcType="INTEGER"/>
<result column="is_on" property="isOn" jdbcType="INTEGER"/>
<result column="continuous_alarm_times" property="alarmTimes" jdbcType="INTEGER"/>
<result column="fields" property="fields" jdbcType="VARCHAR"/>
<result column="tags" property="tags" jdbcType="VARCHAR"/>
<result column="influxdbs" property="influxdbs" jdbcType="VARCHAR"/>
<result column="influx_sql" property="influxSql" jdbcType="VARCHAR"/>
<result column="mobile" property="mobile" jdbcType="VARCHAR"/>
<result column="sms" property="sms" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="VARCHAR"/>
<result column="inf_database" property="database" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="last_time" property="lastTime"/>
<result column="alarm_group_id" property="alarmGroupId" jdbcType="INTEGER"/>
<result column="addsource" property="addSource" jdbcType="INTEGER"/>
<result column="influx_sql_snd" property="influxSqlSnd" jdbcType="VARCHAR"/>
<result column="eventname" property="eventName" jdbcType="VARCHAR"/>
<result column="operation" property="operation" jdbcType="INTEGER"/>
<result column="data_interval_times" property="dataIntervalTimes" jdbcType="INTEGER"/>
<result column="alarm_channel" property="alarmChannel" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
*
from task_shedule
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
*
from task_shedule
</select>
<select id="selectByPageWithSourceTask" resultMap="BaseResultMap">
select
*
from task_shedule
where addsource = #{params.addSource,jdbcType=INTEGER}
<if test="params.eventName != null && params.eventName != ''" >
and eventname like CONCAT('%',#{params.eventName,jdbcType=VARCHAR},'%' )
</if>
<if test="params.sms!=null && params.sms != ''">
and sms like CONCAT('%',#{params.sms,jdbcType=VARCHAR},'%')
</if>
order by id
limit #{startIndex},#{pageSize}
</select>
<!--<select id="selectByPageWithSourceGateway" resultMap="BaseResultMap">
select
*
from task_shedule
where addsource = 1
<if test="page.params.eventName != null && page.params.eventName != ''" >
and eventname like CONCAT('%',#{page.params.eventName,jdbcType=VARCHAR},'%' )
</if>
order by id
limit #{page.startIndex},#{page.pageSize}
</select>-->
<select id="selectCount" resultType="java.lang.Integer">
select
count(1)
from task_shedule
where addsource = #{params.addSource,jdbcType=INTEGER}
<if test="params.eventName != null && params.eventName != ''" >
and eventname like CONCAT('%',#{params.eventName,jdbcType=VARCHAR},'%' )
</if>
<if test="params.sms!=null && params.sms != ''">
and sms like CONCAT('%',#{params.sms,jdbcType=VARCHAR},'%')
</if>
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
delete from task_shedule
where id = #{id,jdbcType=INTEGER}
</delete>
<update id="updateByid" parameterType="com.model.TaskModel">
update task_shedule
set alarm_interval = #{interval,jdbcType=INTEGER},
relax_start_time = #{relaxStartTime,jdbcType=INTEGER},
time_flag = #{timeFlag,jdbcType=INTEGER},
relax_end_time = #{relaxEndTime,jdbcType=INTEGER},
alarm_type = #{alarmType,jdbcType=INTEGER},
alarm_num_flag = #{alarmNumFlag,jdbcType=INTEGER},
is_on = #{isOn,jdbcType=INTEGER},
alarm_channel = #{alarmChannel,jdbcType=VARCHAR},
fields = #{fields,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
influxdbs = #{influxdbs,jdbcType=VARCHAR},
influx_sql = #{influxSql,jdbcType=VARCHAR},
influx_sql_snd = #{influxSqlSnd,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
sms = #{sms,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
inf_database = #{database,jdbcType=VARCHAR},
alarm_group_id = #{alarmGroupId,jdbcType=INTEGER},
eventname = #{eventName,jdbcType=INTEGER},
operation = #{operation,jdbcType=INTEGER},
data_interval_times = #{dataIntervalTimes,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insert" parameterType="com.model.TaskModel">
insert into task_shedule
(alarm_interval,
relax_start_time,
time_flag,
relax_end_time,
alarm_num_flag,
alarm_type,
is_on,
alarm_channel,
fields,
tags,
influxdbs,
influx_sql,
mobile,
sms,
type ,
inf_database,
description,
alarm_group_id,
addsource,
influx_sql_snd,
eventname,
operation,
data_interval_times)
values
(#{interval,jdbcType=INTEGER},
#{relaxStartTime,jdbcType=INTEGER},
#{timeFlag,jdbcType=INTEGER},
#{relaxEndTime,jdbcType=INTEGER},
#{alarmNumFlag,jdbcType=INTEGER},
#{alarmType,jdbcType=INTEGER},
#{isOn,jdbcType=INTEGER},
#{alarmChannel,jdbcType=VARCHAR},
#{fields,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR},
#{influxdbs,jdbcType=VARCHAR},
#{influxSql,jdbcType=VARCHAR},
#{mobile,jdbcType=VARCHAR},
#{sms,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{database,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{alarmGroupId,jdbcType=INTEGER},
#{addSource,jdbcType=INTEGER},
#{influxSqlSnd,jdbcType=VARCHAR},
#{eventName,jdbcType=VARCHAR},
#{operation,jdbcType=INTEGER},
#{dataIntervalTimes,jdbcType=INTEGER}
)
</insert>
<update id="updateLastTime" parameterType="java.lang.Integer">
update task_shedule
set last_time = now()
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>