parent
5c1bba3364
commit
74e4e58c0e
@ -0,0 +1,69 @@
|
|||||||
|
package com.xxl.job.core.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xxl-job log for glue, used to track job code process
|
||||||
|
* @author xuxueli 2016-5-19 17:57:46
|
||||||
|
*/
|
||||||
|
public class XxlJobLogGlue {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String jobGroup;
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
private String glueSource;
|
||||||
|
private String glueRemark;
|
||||||
|
private String addTime;
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getJobGroup() {
|
||||||
|
return jobGroup;
|
||||||
|
}
|
||||||
|
public void setJobGroup(String jobGroup) {
|
||||||
|
this.jobGroup = jobGroup;
|
||||||
|
}
|
||||||
|
public String getJobName() {
|
||||||
|
return jobName;
|
||||||
|
}
|
||||||
|
public void setJobName(String jobName) {
|
||||||
|
this.jobName = jobName;
|
||||||
|
}
|
||||||
|
public String getGlueSource() {
|
||||||
|
return glueSource;
|
||||||
|
}
|
||||||
|
public void setGlueSource(String glueSource) {
|
||||||
|
this.glueSource = glueSource;
|
||||||
|
}
|
||||||
|
public String getGlueRemark() {
|
||||||
|
return glueRemark;
|
||||||
|
}
|
||||||
|
public void setGlueRemark(String glueRemark) {
|
||||||
|
this.glueRemark = glueRemark;
|
||||||
|
}
|
||||||
|
public String getAddTime() {
|
||||||
|
return addTime;
|
||||||
|
}
|
||||||
|
public void setAddTime(String addTime) {
|
||||||
|
this.addTime = addTime;
|
||||||
|
}
|
||||||
|
public String getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
public void setUpdateTime(String updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "XxlJobLogGlue [id=" + id + ", jobGroup=" + jobGroup + ", jobName=" + jobName + ", glueSource="
|
||||||
|
+ glueSource + ", glueRemark=" + glueRemark + ", addTime=" + addTime + ", updateTime=" + updateTime
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.xxl.job.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xxl.job.core.model.XxlJobLogGlue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* job log for glue
|
||||||
|
* @author xuxueli 2016-5-19 18:04:56
|
||||||
|
*/
|
||||||
|
public interface IXxlJobLogGlueDao {
|
||||||
|
|
||||||
|
public int save(XxlJobLogGlue xxlJobLogGlue);
|
||||||
|
|
||||||
|
public List<XxlJobLogGlue> selectList(String jobGroup, String jobName);
|
||||||
|
|
||||||
|
public int removeOld(String jobGroup, String jobName, int limit);
|
||||||
|
|
||||||
|
public int delete(String jobGroup, String jobName);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.xxl.job.dao.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.xxl.job.core.model.XxlJobLogGlue;
|
||||||
|
import com.xxl.job.dao.IXxlJobLogGlueDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* job log for glue
|
||||||
|
* @author xuxueli 2016-5-19 18:17:52
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class XxlJobLogGlueDaoImpl implements IXxlJobLogGlueDao {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
public SqlSessionTemplate sqlSessionTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int save(XxlJobLogGlue xxlJobLogGlue) {
|
||||||
|
return sqlSessionTemplate.insert("XxlJobLogGlueMapper.save", xxlJobLogGlue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<XxlJobLogGlue> selectList(String jobGroup, String jobName) {
|
||||||
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("jobGroup", jobGroup);
|
||||||
|
params.put("jobName", jobName);
|
||||||
|
return sqlSessionTemplate.selectList("XxlJobLogGlueMapper.selectList", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeOld(String jobGroup, String jobName, int limit) {
|
||||||
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("jobGroup", jobGroup);
|
||||||
|
params.put("jobName", jobName);
|
||||||
|
params.put("limit", limit);
|
||||||
|
return sqlSessionTemplate.delete("XxlJobLogGlueMapper.removeOld", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(String jobGroup, String jobName) {
|
||||||
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("jobGroup", jobGroup);
|
||||||
|
params.put("jobName", jobName);
|
||||||
|
return sqlSessionTemplate.delete("XxlJobLogGlueMapper.delete", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="XxlJobLogGlueMapper">
|
||||||
|
|
||||||
|
<resultMap id="XxlJobLogGlue" type="com.xxl.job.core.model.XxlJobLogGlue" >
|
||||||
|
<result column="id" property="id" />
|
||||||
|
<result column="job_group" property="jobGroup" />
|
||||||
|
<result column="job_name" property="jobName" />
|
||||||
|
<result column="glue_source" property="glueSource" />
|
||||||
|
<result column="glue_remark" property="glueRemark" />
|
||||||
|
<result column="add_time" property="addTime" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
t.id,
|
||||||
|
t.job_group,
|
||||||
|
t.job_name,
|
||||||
|
t.glue_source,
|
||||||
|
t.glue_remark,
|
||||||
|
t.add_time,
|
||||||
|
t.update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="save" parameterType="com.xxl.job.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
|
||||||
|
INSERT INTO `xxl_job_qrtz_trigger_logglue` (
|
||||||
|
`job_group`,
|
||||||
|
`job_name`,
|
||||||
|
`glue_source`,
|
||||||
|
`glue_remark`,
|
||||||
|
`add_time`,
|
||||||
|
`update_time`
|
||||||
|
) VALUES (
|
||||||
|
#{jobGroup},
|
||||||
|
#{jobName},
|
||||||
|
#{glueSource},
|
||||||
|
#{glueRemark},
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
|
);
|
||||||
|
<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
|
SELECT LAST_INSERT_ID()
|
||||||
|
</selectKey>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectList" parameterType="java.util.HashMap" resultMap="XxlJobLogGlue">
|
||||||
|
SELECT <include refid="Base_Column_List" />
|
||||||
|
FROM xxl_job_qrtz_trigger_logglue AS t
|
||||||
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
|
<if test="jobGroup != null and jobGroup != ''">
|
||||||
|
AND t.job_group = #{jobGroup}
|
||||||
|
</if>
|
||||||
|
<if test="jobName != null and jobName != ''">
|
||||||
|
AND t.job_name = #{jobName}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
ORDER BY id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="removeOld" parameterType="java.util.HashMap" >
|
||||||
|
DELETE FROM xxl_job_qrtz_trigger_logglue
|
||||||
|
WHERE id NOT in(
|
||||||
|
SELECT id FROM(
|
||||||
|
SELECT id FROM xxl_job_qrtz_trigger_logglue
|
||||||
|
WHERE `job_group` = #{jobGroup} and `job_name` = #{jobName}
|
||||||
|
ORDER BY update_time desc
|
||||||
|
LIMIT 0, #{limit}
|
||||||
|
) t1
|
||||||
|
)
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete" parameterType="java.util.HashMap" >
|
||||||
|
DELETE FROM xxl_job_qrtz_trigger_logglue
|
||||||
|
WHERE job_group = #{jobGroup} and job_name = #{jobName}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in new issue