parent
662e129afc
commit
5c16e16d96
@ -0,0 +1,55 @@
|
||||
package com.xxl.job.admin.core.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
public class XxlJobRegistry {
|
||||
|
||||
private int id;
|
||||
private String registryGroup;
|
||||
private String registryKey;
|
||||
private String registryValue;
|
||||
private Date updateTime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRegistryGroup() {
|
||||
return registryGroup;
|
||||
}
|
||||
|
||||
public void setRegistryGroup(String registryGroup) {
|
||||
this.registryGroup = registryGroup;
|
||||
}
|
||||
|
||||
public String getRegistryKey() {
|
||||
return registryKey;
|
||||
}
|
||||
|
||||
public void setRegistryKey(String registryKey) {
|
||||
this.registryKey = registryKey;
|
||||
}
|
||||
|
||||
public String getRegistryValue() {
|
||||
return registryValue;
|
||||
}
|
||||
|
||||
public void setRegistryValue(String registryValue) {
|
||||
this.registryValue = registryValue;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
public interface IXxlJobRegistryDao {
|
||||
List<XxlJobRegistry> findRegistrys(String registryGroup, String registryKey);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.xxl.job.admin.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
import com.xxl.job.admin.dao.IXxlJobRegistryDao;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
@Repository
|
||||
public class XxlJobRegistryDaoImpl implements IXxlJobRegistryDao {
|
||||
|
||||
@Resource
|
||||
public SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
public List<XxlJobRegistry> findRegistrys(String registryGroup, String registryKey) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("registryGroup", registryGroup);
|
||||
params.put("registryKey", registryKey);
|
||||
return sqlSessionTemplate.selectList("XxlJobRegistryMapper.findRegistrys", params);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?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="XxlJobRegistryMapper">
|
||||
|
||||
<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
|
||||
<result column="id" property="id" />
|
||||
<result column="registry_group" property="registryGroup" />
|
||||
<result column="registry_key" property="registryKey" />
|
||||
<result column="registry_value" property="registryValue" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.registry_group,
|
||||
t.registry_key,
|
||||
t.registry_value,
|
||||
t.update_time
|
||||
</sql>
|
||||
|
||||
<select id="findRegistrys" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM XXL_JOB_QRTZ_TRIGGER_REGISTRY AS t
|
||||
WHERE t.registry_group = #{registryGroup}
|
||||
AND t.registry_key = #{registryKey}
|
||||
AND t.update_time <![CDATA[ > ]]> DATE_ADD(NOW(),INTERVAL -30 SECOND)
|
||||
</select>
|
||||
|
||||
<delete id="refresh" >
|
||||
delete from XXL_JOB_QRTZ_TRIGGER_REGISTRY
|
||||
WHERE update_time <![CDATA[ < ]]> DATE_ADD(NOW(),INTERVAL -30 SECOND)
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in new issue