JobMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.project.monitor.job.mapper.JobMapper">
  6. <resultMap type="Job" id="JobResult">
  7. <id property="jobId" column="job_id" />
  8. <result property="jobName" column="job_name" />
  9. <result property="jobGroup" column="job_group" />
  10. <result property="methodName" column="method_name" />
  11. <result property="methodParams" column="method_params" />
  12. <result property="cronExpression" column="cron_expression" />
  13. <result property="status" column="status" />
  14. <result property="createBy" column="create_by" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateBy" column="update_by" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="remark" column="remark" />
  19. </resultMap>
  20. <sql id="selectJobVo">
  21. select job_id, job_name, job_group, method_name, method_params, cron_expression, status, create_by, create_time, remark from sys_job
  22. </sql>
  23. <select id="selectJobList" parameterType="Job" resultMap="JobResult">
  24. <include refid="selectJobVo"/>
  25. <where>
  26. <if test="jobName != null and jobName != ''">
  27. AND job_name like concat('%', #{jobName}, '%')
  28. </if>
  29. <if test="status != null and status != ''">
  30. AND status = #{status}
  31. </if>
  32. <if test="methodName != null and methodName != ''">
  33. AND method_name like concat('%', #{methodName}, '%')
  34. </if>
  35. </where>
  36. </select>
  37. <select id="selectJobAll" resultMap="JobResult">
  38. <include refid="selectJobVo"/>
  39. </select>
  40. <select id="selectJobById" parameterType="Long" resultMap="JobResult">
  41. <include refid="selectJobVo"/>
  42. where job_id = #{jobId}
  43. </select>
  44. <delete id="deleteJobById" parameterType="Long">
  45. delete from sys_job where job_id = #{jobId}
  46. </delete>
  47. <delete id="deleteJobByIds" parameterType="Long">
  48. delete from sys_job where job_id in
  49. <foreach collection="array" item="jobId" open="(" separator="," close=")">
  50. #{jobId}
  51. </foreach>
  52. </delete>
  53. <update id="updateJob" parameterType="Job">
  54. update sys_job
  55. <set>
  56. <if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
  57. <if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
  58. <if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
  59. <if test="methodParams != null and methodParams != ''">method_params = #{methodParams},</if>
  60. <if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
  61. <if test="status !=null">status = #{status},</if>
  62. <if test="remark != null and remark != ''">remark = #{remark},</if>
  63. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  64. update_time = sysdate()
  65. </set>
  66. where 1=1
  67. <if test="jobId != null">and job_id = #{jobId}</if>
  68. </update>
  69. <insert id="insertJob" parameterType="Post" useGeneratedKeys="true" keyProperty="jobId">
  70. insert into sys_job(
  71. <if test="jobId != null and jobId != 0">job_id,</if>
  72. <if test="jobName != null and jobName != ''">job_name,</if>
  73. <if test="jobGroup != null and jobGroup != ''">job_group,</if>
  74. <if test="methodName != null and methodName != ''">method_name,</if>
  75. <if test="methodParams != null and methodParams != ''">method_params,</if>
  76. <if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
  77. <if test="status != null and status != ''">status,</if>
  78. <if test="remark != null and remark != ''">remark,</if>
  79. <if test="createBy != null and createBy != ''">create_by,</if>
  80. create_time
  81. )values(
  82. <if test="jobId != null and jobId != 0">#{jobId},</if>
  83. <if test="jobName != null and jobName != ''">#{jobName},</if>
  84. <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
  85. <if test="methodName != null and methodName != ''">#{methodName},</if>
  86. <if test="methodParams != null and methodParams != ''">#{method_params},</if>
  87. <if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
  88. <if test="status != null and status != ''">#{status},</if>
  89. <if test="remark != null and remark != ''">#{remark},</if>
  90. <if test="createBy != null and createBy != ''">#{createBy},</if>
  91. sysdate()
  92. )
  93. </insert>
  94. </mapper>