1
0

ScheduleJobDao.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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="com.kmall.schedule.dao.ScheduleJobDao">
  4. <select id="queryObject" resultType="com.kmall.schedule.entity.ScheduleJobEntity" >
  5. select * from schedule_job where job_id = #{value}
  6. </select>
  7. <select id="queryList" resultType="com.kmall.schedule.entity.ScheduleJobEntity" >
  8. select * from schedule_job
  9. <where>
  10. <if test="beanName != null and beanName.trim() != ''">
  11. bean_name like concat('%', #{beanName}, '%')
  12. </if>
  13. <if test="methodName != null and methodName.trim() != ''">
  14. method_name like concat('%', #{methodName}, '%')
  15. </if>
  16. </where>
  17. <if test="offset != null and limit != null ">
  18. limit #{offset}, #{limit}
  19. </if>
  20. </select>
  21. <select id="queryTotal" resultType="int">
  22. select count(1) from schedule_job
  23. <where>
  24. <if test="beanName != null and beanName.trim() != ''">
  25. bean_name like concat('%', #{beanName}, '%')
  26. </if>
  27. <if test="methodName != null and methodName.trim() != ''">
  28. method_name like concat('%', #{methodName}, '%')
  29. </if>
  30. </where>
  31. </select>
  32. <insert id="save" parameterType="com.kmall.schedule.entity.ScheduleJobEntity" useGeneratedKeys="true" keyProperty="jobId">
  33. insert into schedule_job
  34. (
  35. `bean_name`,
  36. `method_name`,
  37. `params`,
  38. `cron_expression`,
  39. `status`,
  40. `remark`,
  41. `create_time`
  42. )
  43. values
  44. (
  45. #{beanName},
  46. #{methodName},
  47. #{params},
  48. #{cronExpression},
  49. #{status},
  50. #{remark},
  51. #{createTime}
  52. )
  53. </insert>
  54. <update id="update" parameterType="com.kmall.schedule.entity.ScheduleJobEntity">
  55. update schedule_job
  56. <set>
  57. <if test="beanName != null">`bean_name` = #{beanName}, </if>
  58. <if test="methodName != null">`method_name` = #{methodName}, </if>
  59. <if test="params != null">`params` = #{params}, </if>
  60. <if test="cronExpression != null">`cron_expression` = #{cronExpression}, </if>
  61. <if test="status != null">`status` = #{status}, </if>
  62. <if test="remark != null">`remark` = #{remark}, </if>
  63. </set>
  64. where job_id = #{jobId}
  65. </update>
  66. <!-- 批量更新状态 -->
  67. <update id="updateBatch">
  68. update schedule_job set status = #{status} where job_id in
  69. <foreach item="jobId" collection="list" open="(" separator="," close=")">
  70. #{jobId}
  71. </foreach>
  72. </update>
  73. <delete id="deleteBatch">
  74. delete from schedule_job where job_id in
  75. <foreach item="jobId" collection="array" open="(" separator="," close=")">
  76. #{jobId}
  77. </foreach>
  78. </delete>
  79. </mapper>