dongyukun
9 天以前 95066d1bdaf67f414f01d1686e7ea9c0ebc07e26
提交 | 用户 | 时间
e7c126 1 <?xml version="1.0" encoding="UTF-8"?>
H 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3     "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
4 <mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
5
6     <resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
7         <result column="id" property="id" />
8
9         <result column="job_group" property="jobGroup" />
10         <result column="job_desc" property="jobDesc" />
11
12         <result column="add_time" property="addTime" />
13         <result column="update_time" property="updateTime" />
14
15         <result column="author" property="author" />
16         <result column="alarm_email" property="alarmEmail" />
17
18         <result column="schedule_type" property="scheduleType" />
19         <result column="schedule_conf" property="scheduleConf" />
20         <result column="misfire_strategy" property="misfireStrategy" />
21
22         <result column="executor_route_strategy" property="executorRouteStrategy" />
23         <result column="executor_handler" property="executorHandler" />
24         <result column="executor_param" property="executorParam" />
25         <result column="executor_block_strategy" property="executorBlockStrategy" />
26         <result column="executor_timeout" property="executorTimeout" />
27         <result column="executor_fail_retry_count" property="executorFailRetryCount" />
28
29         <result column="glue_type" property="glueType" />
30         <result column="glue_source" property="glueSource" />
31         <result column="glue_remark" property="glueRemark" />
32         <result column="glue_updatetime" property="glueUpdatetime" />
33
34         <result column="child_jobid" property="childJobId" />
35
36         <result column="trigger_status" property="triggerStatus" />
37         <result column="trigger_last_time" property="triggerLastTime" />
38         <result column="trigger_next_time" property="triggerNextTime" />
39     </resultMap>
40
41     <sql id="Base_Column_List">
42         t.id,
43         t.job_group,
44         t.job_desc,
45         t.add_time,
46         t.update_time,
47         t.author,
48         t.alarm_email,
49         t.schedule_type,
50         t.schedule_conf,
51         t.misfire_strategy,
52         t.executor_route_strategy,
53         t.executor_handler,
54         t.executor_param,
55         t.executor_block_strategy,
56         t.executor_timeout,
57         t.executor_fail_retry_count,
58         t.glue_type,
59         t.glue_source,
60         t.glue_remark,
61         t.glue_updatetime,
62         t.child_jobid,
63         t.trigger_status,
64         t.trigger_last_time,
65         t.trigger_next_time
66     </sql>
67
68     <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
69         SELECT <include refid="Base_Column_List" />
70         FROM xxl_job_info AS t
71         <trim prefix="WHERE" prefixOverrides="AND | OR" >
72             <if test="jobGroup gt 0">
73                 AND t.job_group = #{jobGroup}
74             </if>
75             <if test="triggerStatus gte 0">
76                 AND t.trigger_status = #{triggerStatus}
77             </if>
78             <if test="jobDesc != null and jobDesc != ''">
79                 AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
80             </if>
81             <if test="executorHandler != null and executorHandler != ''">
82                 AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
83             </if>
84             <if test="author != null and author != ''">
85                 AND t.author like CONCAT(CONCAT('%', #{author}), '%')
86             </if>
87         </trim>
88         ORDER BY id DESC
89         LIMIT #{offset}, #{pagesize}
90     </select>
91
92     <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
93         SELECT count(1)
94         FROM xxl_job_info AS t
95         <trim prefix="WHERE" prefixOverrides="AND | OR" >
96             <if test="jobGroup gt 0">
97                 AND t.job_group = #{jobGroup}
98             </if>
99             <if test="triggerStatus gte 0">
100                 AND t.trigger_status = #{triggerStatus}
101             </if>
102             <if test="jobDesc != null and jobDesc != ''">
103                 AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
104             </if>
105             <if test="executorHandler != null and executorHandler != ''">
106                 AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
107             </if>
108             <if test="author != null and author != ''">
109                 AND t.author like CONCAT(CONCAT('%', #{author}), '%')
110             </if>
111         </trim>
112     </select>
113
114     <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
115         INSERT INTO xxl_job_info (
116             job_group,
117             job_desc,
118             add_time,
119             update_time,
120             author,
121             alarm_email,
122             schedule_type,
123             schedule_conf,
124             misfire_strategy,
125             executor_route_strategy,
126             executor_handler,
127             executor_param,
128             executor_block_strategy,
129             executor_timeout,
130             executor_fail_retry_count,
131             glue_type,
132             glue_source,
133             glue_remark,
134             glue_updatetime,
135             child_jobid,
136             trigger_status,
137             trigger_last_time,
138             trigger_next_time
139         ) VALUES (
140             #{jobGroup},
141             #{jobDesc},
142             #{addTime},
143             #{updateTime},
144             #{author},
145             #{alarmEmail},
146             #{scheduleType},
147             #{scheduleConf},
148             #{misfireStrategy},
149             #{executorRouteStrategy},
150             #{executorHandler},
151             #{executorParam},
152             #{executorBlockStrategy},
153             #{executorTimeout},
154             #{executorFailRetryCount},
155             #{glueType},
156             #{glueSource},
157             #{glueRemark},
158             #{glueUpdatetime},
159             #{childJobId},
160             #{triggerStatus},
161             #{triggerLastTime},
162             #{triggerNextTime}
163         );
164         <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
165             SELECT LAST_INSERT_ID()
166             /*SELECT @@IDENTITY AS id*/
167         </selectKey>-->
168     </insert>
169
170     <select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
171         SELECT <include refid="Base_Column_List" />
172         FROM xxl_job_info AS t
173         WHERE t.id = #{id}
174     </select>
175
176     <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
177         UPDATE xxl_job_info
178         SET
179             job_group = #{jobGroup},
180             job_desc = #{jobDesc},
181             update_time = #{updateTime},
182             author = #{author},
183             alarm_email = #{alarmEmail},
184             schedule_type = #{scheduleType},
185             schedule_conf = #{scheduleConf},
186             misfire_strategy = #{misfireStrategy},
187             executor_route_strategy = #{executorRouteStrategy},
188             executor_handler = #{executorHandler},
189             executor_param = #{executorParam},
190             executor_block_strategy = #{executorBlockStrategy},
191             executor_timeout = ${executorTimeout},
192             executor_fail_retry_count = ${executorFailRetryCount},
193             glue_type = #{glueType},
194             glue_source = #{glueSource},
195             glue_remark = #{glueRemark},
196             glue_updatetime = #{glueUpdatetime},
197             child_jobid = #{childJobId},
198             trigger_status = #{triggerStatus},
199             trigger_last_time = #{triggerLastTime},
200             trigger_next_time = #{triggerNextTime}
201         WHERE id = #{id}
202     </update>
203
204     <delete id="delete" parameterType="java.util.HashMap">
205         DELETE
206         FROM xxl_job_info
207         WHERE id = #{id}
208     </delete>
209
210     <select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
211         SELECT <include refid="Base_Column_List" />
212         FROM xxl_job_info AS t
213         WHERE t.job_group = #{jobGroup}
214     </select>
215
216     <select id="findAllCount" resultType="int">
217         SELECT count(1)
218         FROM xxl_job_info
219     </select>
220
221
222     <select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
223         SELECT <include refid="Base_Column_List" />
224         FROM xxl_job_info AS t
225         WHERE t.trigger_status = 1
226             and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
227         ORDER BY id ASC
228         LIMIT #{pagesize}
229     </select>
230
231     <update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo"  >
232         UPDATE xxl_job_info
233         SET
234             trigger_last_time = #{triggerLastTime},
235             trigger_next_time = #{triggerNextTime},
236             trigger_status = #{triggerStatus}
237         WHERE id = #{id}
238     </update>
239
240 </mapper>