JobLogMapper.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.JobLogMapper">
  6. <resultMap type="JobLog" id="JobLogResult">
  7. <id property="jobLogId" column="job_log_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="jobMessage" column="job_message" />
  13. <result property="status" column="status" />
  14. <result property="exceptionInfo" column="exception_info" />
  15. <result property="createTime" column="create_time" />
  16. </resultMap>
  17. <sql id="selectJobLogVo">
  18. select job_log_id, job_name, job_group, method_name, method_params, job_message, status, exception_info, create_time
  19. from sys_job_log
  20. </sql>
  21. <select id="selectJobLogList" parameterType="JobLog" resultMap="JobLogResult">
  22. <include refid="selectJobLogVo"/>
  23. <where>
  24. <if test="jobName != null and jobName != ''">
  25. AND job_name like concat('%', #{jobName}, '%')
  26. </if>
  27. <if test="status != null and status != ''">
  28. AND status = #{status}
  29. </if>
  30. <if test="methodName != null and methodName != ''">
  31. AND method_name like concat('%', #{methodName}, '%')
  32. </if>
  33. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  34. and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  35. </if>
  36. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  37. and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  38. </if>
  39. </where>
  40. </select>
  41. <select id="selectJobAll" resultMap="JobLogResult">
  42. <include refid="selectJobLogVo"/>
  43. </select>
  44. <select id="selectJobLogById" parameterType="Long" resultMap="JobLogResult">
  45. <include refid="selectJobLogVo"/>
  46. where job_log_id = #{jobLogId}
  47. </select>
  48. <delete id="deleteJobLogById" parameterType="Long">
  49. delete from sys_job_log where job_log_id = #{jobLogId}
  50. </delete>
  51. <delete id="deleteJobLogByIds" parameterType="String">
  52. delete from sys_job_log where job_log_id in
  53. <foreach collection="array" item="jobLogId" open="(" separator="," close=")">
  54. #{jobLogId}
  55. </foreach>
  56. </delete>
  57. <insert id="insertJobLog" parameterType="JobLog">
  58. insert into sys_job_log(
  59. <if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
  60. <if test="jobName != null and jobName != ''">job_name,</if>
  61. <if test="jobGroup != null and jobGroup != ''">job_group,</if>
  62. <if test="methodName != null and methodName != ''">method_name,</if>
  63. <if test="methodParams != null and methodParams != ''">method_params,</if>
  64. <if test="jobMessage != null and jobMessage != ''">job_message,</if>
  65. <if test="status != null and status != ''">status,</if>
  66. <if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
  67. create_time
  68. )values(
  69. <if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
  70. <if test="jobName != null and jobName != ''">#{jobName},</if>
  71. <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
  72. <if test="methodName != null and methodName != ''">#{methodName},</if>
  73. <if test="methodParams != null and methodParams != ''">#{methodParams},</if>
  74. <if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
  75. <if test="status != null and status != ''">#{status},</if>
  76. <if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
  77. sysdate()
  78. )
  79. </insert>
  80. </mapper>