JobLogMapper.xml 3.8 KB

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