SnailJobMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.interfaces.mapper.SnailJobMapper">
  6. <resultMap type="com.ruoyi.interfaces.domain.Job" id="JobResult">
  7. <result property="id" column="id"/>
  8. <result property="namespaceId" column="namespace_id"/>
  9. <result property="groupName" column="group_name"/>
  10. <result property="jobName" column="job_name"/>
  11. <result property="argsStr" column="args_str"/>
  12. <result property="argsType" column="args_type"/>
  13. <result property="nextTriggerAt" column="next_trigger_at"/>
  14. <result property="jobStatus" column="job_status"/>
  15. <result property="taskType" column="task_type"/>
  16. <result property="routeKey" column="route_key"/>
  17. <result property="executorType" column="executor_type"/>
  18. <result property="executorInfo" column="executor_info"/>
  19. <result property="triggerType" column="trigger_type"/>
  20. <result property="triggerInterval" column="trigger_interval"/>
  21. <result property="blockStrategy" column="block_strategy"/>
  22. <result property="executorTimeout" column="executor_timeout"/>
  23. <result property="maxRetryTimes" column="max_retry_times"/>
  24. <result property="parallelNum" column="parallel_num"/>
  25. <result property="retryInterval" column="retry_interval"/>
  26. <result property="bucketIndex" column="bucket_index"/>
  27. <result property="resident" column="resident"/>
  28. <result property="notifyIds" column="notify_ids"/>
  29. <result property="ownerId" column="owner_id"/>
  30. <result property="labels" column="labels"/>
  31. <result property="description" column="description"/>
  32. <result property="extAttrs" column="ext_attrs"/>
  33. <result property="deleted" column="deleted"/>
  34. </resultMap>
  35. <sql id="selectJobVo">
  36. select id,
  37. namespace_id,
  38. group_name,
  39. job_name,
  40. args_str,
  41. args_type,
  42. next_trigger_at,
  43. job_status,
  44. task_type,
  45. route_key,
  46. executor_type,
  47. executor_info,
  48. trigger_type,
  49. trigger_interval,
  50. block_strategy,
  51. executor_timeout,
  52. max_retry_times,
  53. parallel_num,
  54. retry_interval,
  55. bucket_index,
  56. resident,
  57. notify_ids,
  58. owner_id,
  59. labels,
  60. description,
  61. ext_attrs,
  62. deleted
  63. from SNAIL_JOB.sj_job
  64. </sql>
  65. <select id="selectJobList" resultType="com.ruoyi.interfaces.domain.Job">
  66. <include refid="selectJobVo"></include>
  67. <where>
  68. <if test="namespaceId != null and namespaceId != ''">and namespace_id = #{namespaceId}</if>
  69. <if test="groupName != null and groupName != ''">and group_name = #{groupName}</if>
  70. <if test="jobName != null and jobName != ''">and job_name = #{jobName}</if>
  71. <if test="argsStr != null and argsStr != ''">and args_str = #{argsStr}</if>
  72. <if test="argsType != null ">and args_type = #{argsType}</if>
  73. <if test="nextTriggerAt != null ">and next_trigger_at = #{nextTriggerAt}</if>
  74. <if test="jobStatus != null ">and job_status = #{jobStatus}</if>
  75. <if test="taskType != null ">and task_type = #{taskType}</if>
  76. <if test="routeKey != null ">and route_key = #{routeKey}</if>
  77. <if test="executorType != null ">and executor_type = #{executorType}</if>
  78. <if test="executorInfo != null ">and executor_info = #{executorInfo}</if>
  79. </where>
  80. order by id
  81. </select>
  82. <select id="listOfJobLog" resultType="com.ruoyi.interfaces.domain.JobLogVo">
  83. SELECT
  84. A.*,
  85. B.TASK_STATUS,
  86. B.CREATE_DT AS EXECUTION_TIME
  87. FROM SJ_JOB A
  88. JOIN SJ_JOB_TASK B ON A.ID = B.JOB_ID
  89. <where>
  90. <if test="jobName != null and jobName != ''">and A.JOB_NAME = #{jobName}</if>
  91. <if test="startTime != null and startTime != ''">
  92. and B.CREATE_DT &gt;= TO_DATE(TO_CHAR(startTime, 'YYYY-MM-DD'), 'YYYY-MM-DD')
  93. </if>
  94. <if test="endTime != null and endTime != ''">
  95. and B.CREATE_DT &lt;= TO_DATE(TO_CHAR(endTime, 'YYYY-MM-DD'), 'YYYY-MM-DD')
  96. </if>
  97. </where>
  98. ORDER BY B.CREATE_DT DESC
  99. </select>
  100. <select id="listOfJobLogCount" resultType="java.lang.Long">
  101. SELECT
  102. count(*)
  103. FROM SJ_JOB A
  104. JOIN SJ_JOB_TASK B ON A.ID = B.JOB_ID
  105. <where>
  106. <if test="jobName != null and jobName != ''">and A.job_name = #{jobName}</if>
  107. <if test="startTime != null">
  108. and B.CREATE_DT &gt;= TO_DATE(TO_CHAR(#{startTime}, 'YYYY-MM-DD'), 'YYYY-MM-DD')
  109. </if>
  110. <if test="endTime != null">
  111. and B.CREATE_DT &lt;= TO_DATE(TO_CHAR(#{endTime}, 'YYYY-MM-DD'), 'YYYY-MM-DD')
  112. </if>
  113. </where>
  114. </select>
  115. </mapper>