QuartzJobMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="net.chenlin.dp.modules.sys.dao.QuartzJobMapper">
  4. <select id="listForPage" resultType="net.chenlin.dp.modules.sys.entity.QuartzJobEntity">
  5. SELECT
  6. job_id,
  7. bean_name,
  8. method_name,
  9. params,
  10. cron_expression,
  11. status,
  12. remark,
  13. gmt_create
  14. FROM
  15. quartz_job
  16. <where>
  17. <if test="name != null and name.trim() != ''">
  18. AND
  19. (bean_name LIKE concat('%',#{name},'%') or
  20. remark LIKE concat('%',#{name},'%') or
  21. method_name LIKE concat('%',#{name},'%'))
  22. </if>
  23. <if test="selectPar != null and selectPar.trim() != ''">
  24. AND remark LIKE concat('%',#{selectPar},'%')
  25. </if>
  26. </where>
  27. ORDER BY
  28. gmt_create DESC
  29. </select>
  30. <select id="list" resultType="net.chenlin.dp.modules.sys.entity.QuartzJobEntity">
  31. SELECT
  32. job_id,
  33. bean_name,
  34. method_name,
  35. params,
  36. cron_expression,
  37. status
  38. FROM
  39. quartz_job
  40. </select>
  41. <insert id="save" parameterType="net.chenlin.dp.modules.sys.entity.QuartzJobEntity" useGeneratedKeys="true" keyProperty="jobId">
  42. INSERT INTO quartz_job (
  43. bean_name,
  44. method_name,
  45. params,
  46. cron_expression,
  47. status,
  48. remark,
  49. gmt_create
  50. )
  51. VALUES (
  52. #{beanName},
  53. #{methodName},
  54. #{params},
  55. #{cronExpression},
  56. #{status},
  57. #{remark},
  58. NOW()
  59. )
  60. </insert>
  61. <select id="getObjectById" resultType="net.chenlin.dp.modules.sys.entity.QuartzJobEntity">
  62. SELECT
  63. job_id,
  64. bean_name,
  65. method_name,
  66. params,
  67. cron_expression,
  68. status,
  69. remark,
  70. gmt_create
  71. FROM
  72. quartz_job
  73. WHERE
  74. job_id = #{value}
  75. </select>
  76. <update id="update">
  77. UPDATE quartz_job
  78. <set>
  79. <if test="beanName != null">bean_name = #{beanName}, </if>
  80. <if test="methodName != null">method_name = #{methodName}, </if>
  81. <if test="params != null">params = #{params}, </if>
  82. <if test="cronExpression != null">cron_expression = #{cronExpression}, </if>
  83. <if test="status != null">status = #{status}, </if>
  84. <if test="remark != null">remark = #{remark}, </if>
  85. gmt_modified = NOW()
  86. </set>
  87. WHERE
  88. job_id = #{jobId}
  89. </update>
  90. <update id="batchUpdate">
  91. UPDATE quartz_job
  92. SET status = #{status}
  93. WHERE
  94. job_id in
  95. <foreach item="jobId" collection="jobIdList" open="(" separator="," close=")">
  96. #{jobId}
  97. </foreach>
  98. </update>
  99. <delete id="batchRemove">
  100. DELETE
  101. FROM
  102. quartz_job
  103. WHERE
  104. job_id IN
  105. <foreach item="id" collection="array" open="(" separator="," close=")">
  106. #{id}
  107. </foreach>
  108. </delete>
  109. </mapper>