forked from xuxueli/xxl-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xueli.xue
committed
Sep 30, 2016
1 parent
662e129
commit 5c16e16
Showing
6 changed files
with
176 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobRegistryDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
30 changes: 30 additions & 0 deletions
30
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobRegistryDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |