1ac96315b9ff545c00bd4a269493528caf8b1cd0.svn-base 6.8 KB

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