parent
eb834b6dcc
commit
8e7a255105
@ -1,29 +0,0 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* job info
|
||||
* @author xuxueli 2016-1-12 18:03:45
|
||||
*/
|
||||
public interface IXxlJobInfoDao {
|
||||
|
||||
public List<XxlJobInfo> pageList(int offset, int pagesize, int jobGroup, String executorHandler);
|
||||
public int pageListCount(int offset, int pagesize, int jobGroup, String executorHandler);
|
||||
|
||||
public int save(XxlJobInfo info);
|
||||
|
||||
public XxlJobInfo loadById(int id);
|
||||
|
||||
public int update(XxlJobInfo item);
|
||||
|
||||
public int delete(int id);
|
||||
|
||||
public List<XxlJobInfo> getJobsByGroup(String jobGroup);
|
||||
|
||||
public int findAllCount();
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* job log
|
||||
* @author xuxueli 2016-1-12 18:03:06
|
||||
*/
|
||||
public interface IXxlJobLogDao {
|
||||
|
||||
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus);
|
||||
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus);
|
||||
|
||||
public XxlJobLog load(int id);
|
||||
|
||||
public int save(XxlJobLog xxlJobLog);
|
||||
|
||||
public int updateTriggerInfo(XxlJobLog xxlJobLog);
|
||||
|
||||
public int updateHandleInfo(XxlJobLog xxlJobLog);
|
||||
|
||||
public int delete(int jobId);
|
||||
|
||||
public int triggerCountByHandleCode(int handleCode);
|
||||
|
||||
public List<Map<String, Object>> triggerCountByDay(Date from, Date to, int handleCode);
|
||||
|
||||
public int clearLog(int jobGroup, int jobId, Date clearBeforeTime, int clearBeforeNum);
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* job log for glue
|
||||
* @author xuxueli 2016-5-19 18:04:56
|
||||
*/
|
||||
public interface IXxlJobLogGlueDao {
|
||||
|
||||
public int save(XxlJobLogGlue xxlJobLogGlue);
|
||||
|
||||
public List<XxlJobLogGlue> findByJobId(int jobId);
|
||||
|
||||
public int removeOld(int jobId, int limit);
|
||||
|
||||
public int deleteByJobId(int jobId);
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
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 {
|
||||
public int removeDead(int timeout);
|
||||
|
||||
public List<XxlJobRegistry> findAll(int timeout);
|
||||
|
||||
public int registryUpdate(String registryGroup, String registryKey, String registryValue);
|
||||
|
||||
public int registrySave(String registryGroup, String registryKey, String registryValue);
|
||||
|
||||
}
|
@ -1,23 +1,24 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
public interface IXxlJobGroupDao {
|
||||
public interface XxlJobGroupDao {
|
||||
|
||||
public List<XxlJobGroup> findAll();
|
||||
|
||||
public List<XxlJobGroup> findByAddressType(int addressType);
|
||||
public List<XxlJobGroup> findByAddressType(@Param("addressType") int addressType);
|
||||
|
||||
public int save(XxlJobGroup xxlJobGroup);
|
||||
|
||||
public int update(XxlJobGroup xxlJobGroup);
|
||||
|
||||
public int remove(int id);
|
||||
public int remove(@Param("id") int id);
|
||||
|
||||
public XxlJobGroup load(int id);
|
||||
public XxlJobGroup load(@Param("id") int id);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* job info
|
||||
* @author xuxueli 2016-1-12 18:03:45
|
||||
*/
|
||||
public interface XxlJobInfoDao {
|
||||
|
||||
public List<XxlJobInfo> pageList(@Param("offset") int offset, @Param("pagesize") int pagesize, @Param("jobGroup") int jobGroup, @Param("executorHandler") String executorHandler);
|
||||
public int pageListCount(@Param("offset") int offset, @Param("pagesize") int pagesize, @Param("jobGroup") int jobGroup, @Param("executorHandler") String executorHandler);
|
||||
|
||||
public int save(XxlJobInfo info);
|
||||
|
||||
public XxlJobInfo loadById(@Param("id") int id);
|
||||
|
||||
public int update(XxlJobInfo item);
|
||||
|
||||
public int delete(@Param("id") int id);
|
||||
|
||||
public List<XxlJobInfo> getJobsByGroup(@Param("jobGroup") int jobGroup);
|
||||
|
||||
public int findAllCount();
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* job log
|
||||
* @author xuxueli 2016-1-12 18:03:06
|
||||
*/
|
||||
public interface XxlJobLogDao {
|
||||
|
||||
public List<XxlJobLog> pageList(@Param("offset") int offset,
|
||||
@Param("pagesize") int pagesize,
|
||||
@Param("jobGroup") int jobGroup,
|
||||
@Param("jobId") int jobId,
|
||||
@Param("triggerTimeStart") Date triggerTimeStart,
|
||||
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
||||
@Param("logStatus") int logStatus);
|
||||
public int pageListCount(@Param("offset") int offset,
|
||||
@Param("pagesize") int pagesize,
|
||||
@Param("jobGroup") int jobGroup,
|
||||
@Param("jobId") int jobId,
|
||||
@Param("triggerTimeStart") Date triggerTimeStart,
|
||||
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
||||
@Param("logStatus") int logStatus);
|
||||
|
||||
public XxlJobLog load(@Param("id") int id);
|
||||
|
||||
public int save(XxlJobLog xxlJobLog);
|
||||
|
||||
public int updateTriggerInfo(XxlJobLog xxlJobLog);
|
||||
|
||||
public int updateHandleInfo(XxlJobLog xxlJobLog);
|
||||
|
||||
public int delete(@Param("jobId") int jobId);
|
||||
|
||||
public int triggerCountByHandleCode(@Param("handleCode") int handleCode);
|
||||
|
||||
public List<Map<String, Object>> triggerCountByDay(@Param("from") Date from,
|
||||
@Param("to") Date to,
|
||||
@Param("handleCode") int handleCode);
|
||||
|
||||
public int clearLog(@Param("jobGroup") int jobGroup,
|
||||
@Param("jobId") int jobId,
|
||||
@Param("clearBeforeTime") Date clearBeforeTime,
|
||||
@Param("clearBeforeNum") int clearBeforeNum);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* job log for glue
|
||||
* @author xuxueli 2016-5-19 18:04:56
|
||||
*/
|
||||
public interface XxlJobLogGlueDao {
|
||||
|
||||
public int save(XxlJobLogGlue xxlJobLogGlue);
|
||||
|
||||
public List<XxlJobLogGlue> findByJobId(@Param("jobId") int jobId);
|
||||
|
||||
public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
|
||||
|
||||
public int deleteByJobId(@Param("jobId") int jobId);
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
public interface XxlJobRegistryDao {
|
||||
|
||||
public int removeDead(@Param("timeout") int timeout);
|
||||
|
||||
public List<XxlJobRegistry> findAll(@Param("timeout") int timeout);
|
||||
|
||||
public int registryUpdate(@Param("registryGroup") String registryGroup,
|
||||
@Param("registryKey") String registryKey,
|
||||
@Param("registryValue") String registryValue);
|
||||
|
||||
public int registrySave(@Param("registryGroup") String registryGroup,
|
||||
@Param("registryKey") String registryKey,
|
||||
@Param("registryValue") String registryValue);
|
||||
|
||||
}
|
@ -1,51 +1,51 @@
|
||||
package com.xxl.job.admin.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||
import com.xxl.job.admin.dao.IXxlJobGroupDao;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xuxueli on 16/9/30.
|
||||
*/
|
||||
@Repository
|
||||
public class XxlJobGroupDaoImpl implements IXxlJobGroupDao {
|
||||
|
||||
@Resource
|
||||
public SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
public List<XxlJobGroup> findAll() {
|
||||
return sqlSessionTemplate.selectList("XxlJobGroupMapper.findAll");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XxlJobGroup> findByAddressType(int addressType) {
|
||||
return sqlSessionTemplate.selectList("XxlJobGroupMapper.findByAddressType", addressType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(XxlJobGroup xxlJobGroup) {
|
||||
return sqlSessionTemplate.update("XxlJobGroupMapper.save", xxlJobGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(XxlJobGroup xxlJobGroup) {
|
||||
return sqlSessionTemplate.update("XxlJobGroupMapper.update", xxlJobGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(int id) {
|
||||
return sqlSessionTemplate.delete("XxlJobGroupMapper.remove", id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XxlJobGroup load(int id) {
|
||||
return sqlSessionTemplate.selectOne("XxlJobGroupMapper.load", id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package com.xxl.job.admin.dao.impl;
|
||||
//
|
||||
//import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||
//import com.xxl.job.admin.dao.XxlJobGroupDao;
|
||||
//import org.mybatis.spring.SqlSessionTemplate;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * Created by xuxueli on 16/9/30.
|
||||
// */
|
||||
//@Repository
|
||||
//public class XxlJobGroupDaoImpl implements XxlJobGroupDao {
|
||||
//
|
||||
// @Resource
|
||||
// public SqlSessionTemplate sqlSessionTemplate;
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobGroup> findAll() {
|
||||
// return sqlSessionTemplate.selectList("XxlJobGroupMapper.findAll");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobGroup> findByAddressType(int addressType) {
|
||||
// return sqlSessionTemplate.selectList("XxlJobGroupMapper.findByAddressType", addressType);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int save(XxlJobGroup xxlJobGroup) {
|
||||
// return sqlSessionTemplate.update("XxlJobGroupMapper.save", xxlJobGroup);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int update(XxlJobGroup xxlJobGroup) {
|
||||
// return sqlSessionTemplate.update("XxlJobGroupMapper.update", xxlJobGroup);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int remove(int id) {
|
||||
// return sqlSessionTemplate.delete("XxlJobGroupMapper.remove", id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public XxlJobGroup load(int id) {
|
||||
// return sqlSessionTemplate.selectOne("XxlJobGroupMapper.load", id);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
@ -1,74 +1,74 @@
|
||||
package com.xxl.job.admin.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
import com.xxl.job.admin.dao.IXxlJobInfoDao;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* job info
|
||||
* @author xuxueli 2016-1-12 18:03:45
|
||||
*/
|
||||
@Repository
|
||||
public class XxlJobInfoDaoImpl implements IXxlJobInfoDao {
|
||||
|
||||
@Resource
|
||||
public SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
public List<XxlJobInfo> pageList(int offset, int pagesize, int jobGroup, String executorHandler) {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("offset", offset);
|
||||
params.put("pagesize", pagesize);
|
||||
params.put("jobGroup", jobGroup);
|
||||
params.put("executorHandler", executorHandler);
|
||||
|
||||
return sqlSessionTemplate.selectList("XxlJobInfoMapper.pageList", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pageListCount(int offset, int pagesize, int jobGroup, String executorHandler) {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("offset", offset);
|
||||
params.put("pagesize", pagesize);
|
||||
params.put("jobGroup", jobGroup);
|
||||
params.put("executorHandler", executorHandler);
|
||||
|
||||
return sqlSessionTemplate.selectOne("XxlJobInfoMapper.pageListCount", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(XxlJobInfo info) {
|
||||
return sqlSessionTemplate.insert("XxlJobInfoMapper.save", info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XxlJobInfo loadById(int id) {
|
||||
return sqlSessionTemplate.selectOne("XxlJobInfoMapper.loadById", id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(XxlJobInfo item) {
|
||||
return sqlSessionTemplate.update("XxlJobInfoMapper.update", item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(int id) {
|
||||
return sqlSessionTemplate.update("XxlJobInfoMapper.delete", id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XxlJobInfo> getJobsByGroup(String jobGroup) {
|
||||
return sqlSessionTemplate.selectList("XxlJobInfoMapper.getJobsByGroup", jobGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findAllCount() {
|
||||
return sqlSessionTemplate.selectOne("XxlJobInfoMapper.findAllCount");
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xxl.job.admin.dao.impl;
|
||||
//
|
||||
//import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
//import com.xxl.job.admin.dao.XxlJobInfoDao;
|
||||
//import org.mybatis.spring.SqlSessionTemplate;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * job info
|
||||
// * @author xuxueli 2016-1-12 18:03:45
|
||||
// */
|
||||
//@Repository
|
||||
//public class XxlJobInfoDaoImpl implements XxlJobInfoDao {
|
||||
//
|
||||
// @Resource
|
||||
// public SqlSessionTemplate sqlSessionTemplate;
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobInfo> pageList(int offset, int pagesize, int jobGroup, String executorHandler) {
|
||||
// HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("offset", offset);
|
||||
// params.put("pagesize", pagesize);
|
||||
// params.put("jobGroup", jobGroup);
|
||||
// params.put("executorHandler", executorHandler);
|
||||
//
|
||||
// return sqlSessionTemplate.selectList("XxlJobInfoMapper.pageList", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int pageListCount(int offset, int pagesize, int jobGroup, String executorHandler) {
|
||||
// HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("offset", offset);
|
||||
// params.put("pagesize", pagesize);
|
||||
// params.put("jobGroup", jobGroup);
|
||||
// params.put("executorHandler", executorHandler);
|
||||
//
|
||||
// return sqlSessionTemplate.selectOne("XxlJobInfoMapper.pageListCount", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int save(XxlJobInfo info) {
|
||||
// return sqlSessionTemplate.insert("XxlJobInfoMapper.save", info);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public XxlJobInfo loadById(int id) {
|
||||
// return sqlSessionTemplate.selectOne("XxlJobInfoMapper.loadById", id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int update(XxlJobInfo item) {
|
||||
// return sqlSessionTemplate.update("XxlJobInfoMapper.update", item);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int delete(int id) {
|
||||
// return sqlSessionTemplate.update("XxlJobInfoMapper.delete", id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobInfo> getJobsByGroup(String jobGroup) {
|
||||
// return sqlSessionTemplate.selectList("XxlJobInfoMapper.getJobsByGroup", jobGroup);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int findAllCount() {
|
||||
// return sqlSessionTemplate.selectOne("XxlJobInfoMapper.findAllCount");
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -1,107 +1,107 @@
|
||||
package com.xxl.job.admin.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
import com.xxl.job.admin.dao.IXxlJobLogDao;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* job log
|
||||
* @author xuxueli 2016-1-12 18:03:06
|
||||
*/
|
||||
@Repository
|
||||
public class XxlJobLogDaoImpl implements IXxlJobLogDao {
|
||||
|
||||
@Resource
|
||||
public SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("offset", offset);
|
||||
params.put("pagesize", pagesize);
|
||||
params.put("jobGroup", jobGroup);
|
||||
params.put("jobId", jobId);
|
||||
params.put("triggerTimeStart", triggerTimeStart);
|
||||
params.put("triggerTimeEnd", triggerTimeEnd);
|
||||
params.put("logStatus", logStatus);
|
||||
|
||||
return sqlSessionTemplate.selectList("XxlJobLogMapper.pageList", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("offset", offset);
|
||||
params.put("pagesize", pagesize);
|
||||
params.put("jobGroup", jobGroup);
|
||||
params.put("jobId", jobId);
|
||||
params.put("triggerTimeStart", triggerTimeStart);
|
||||
params.put("triggerTimeEnd", triggerTimeEnd);
|
||||
params.put("logStatus", logStatus);
|
||||
|
||||
return sqlSessionTemplate.selectOne("XxlJobLogMapper.pageListCount", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XxlJobLog load(int id) {
|
||||
return sqlSessionTemplate.selectOne("XxlJobLogMapper.load", id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(XxlJobLog xxlJobLog) {
|
||||
return sqlSessionTemplate.insert("XxlJobLogMapper.save", xxlJobLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateTriggerInfo(XxlJobLog xxlJobLog) {
|
||||
if (xxlJobLog.getTriggerMsg()!=null && xxlJobLog.getTriggerMsg().length()>2000) {
|
||||
xxlJobLog.setTriggerMsg(xxlJobLog.getTriggerMsg().substring(0, 2000));
|
||||
}
|
||||
return sqlSessionTemplate.update("XxlJobLogMapper.updateTriggerInfo", xxlJobLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHandleInfo(XxlJobLog xxlJobLog) {
|
||||
if (xxlJobLog.getHandleMsg()!=null && xxlJobLog.getHandleMsg().length()>2000) {
|
||||
xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg().substring(0, 2000));
|
||||
}
|
||||
return sqlSessionTemplate.update("XxlJobLogMapper.updateHandleInfo", xxlJobLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(int jobId) {
|
||||
return sqlSessionTemplate.delete("XxlJobLogMapper.delete", jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int triggerCountByHandleCode(int handleCode) {
|
||||
return sqlSessionTemplate.selectOne("XxlJobLogMapper.triggerCountByHandleCode", handleCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> triggerCountByDay(Date from, Date to, int handleCode) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("from", from);
|
||||
params.put("to", to);
|
||||
params.put("handleCode", handleCode);
|
||||
return sqlSessionTemplate.selectList("XxlJobLogMapper.triggerCountByDay", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int clearLog(int jobGroup, int jobId, Date clearBeforeTime, int clearBeforeNum) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("jobGroup", jobGroup);
|
||||
params.put("jobId", jobId);
|
||||
params.put("clearBeforeTime", clearBeforeTime);
|
||||
params.put("clearBeforeNum", clearBeforeNum);
|
||||
return sqlSessionTemplate.delete("XxlJobLogMapper.clearLog", params);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xxl.job.admin.dao.impl;
|
||||
//
|
||||
//import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
//import com.xxl.job.admin.dao.XxlJobLogDao;
|
||||
//import org.mybatis.spring.SqlSessionTemplate;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.Date;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * job log
|
||||
// * @author xuxueli 2016-1-12 18:03:06
|
||||
// */
|
||||
//@Repository
|
||||
//public class XxlJobLogDaoImpl implements XxlJobLogDao {
|
||||
//
|
||||
// @Resource
|
||||
// public SqlSessionTemplate sqlSessionTemplate;
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||
// HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("offset", offset);
|
||||
// params.put("pagesize", pagesize);
|
||||
// params.put("jobGroup", jobGroup);
|
||||
// params.put("jobId", jobId);
|
||||
// params.put("triggerTimeStart", triggerTimeStart);
|
||||
// params.put("triggerTimeEnd", triggerTimeEnd);
|
||||
// params.put("logStatus", logStatus);
|
||||
//
|
||||
// return sqlSessionTemplate.selectList("XxlJobLogMapper.pageList", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||
// HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("offset", offset);
|
||||
// params.put("pagesize", pagesize);
|
||||
// params.put("jobGroup", jobGroup);
|
||||
// params.put("jobId", jobId);
|
||||
// params.put("triggerTimeStart", triggerTimeStart);
|
||||
// params.put("triggerTimeEnd", triggerTimeEnd);
|
||||
// params.put("logStatus", logStatus);
|
||||
//
|
||||
// return sqlSessionTemplate.selectOne("XxlJobLogMapper.pageListCount", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public XxlJobLog load(int id) {
|
||||
// return sqlSessionTemplate.selectOne("XxlJobLogMapper.load", id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int save(XxlJobLog xxlJobLog) {
|
||||
// return sqlSessionTemplate.insert("XxlJobLogMapper.save", xxlJobLog);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int updateTriggerInfo(XxlJobLog xxlJobLog) {
|
||||
// if (xxlJobLog.getTriggerMsg()!=null && xxlJobLog.getTriggerMsg().length()>2000) {
|
||||
// xxlJobLog.setTriggerMsg(xxlJobLog.getTriggerMsg().substring(0, 2000));
|
||||
// }
|
||||
// return sqlSessionTemplate.update("XxlJobLogMapper.updateTriggerInfo", xxlJobLog);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int updateHandleInfo(XxlJobLog xxlJobLog) {
|
||||
// if (xxlJobLog.getHandleMsg()!=null && xxlJobLog.getHandleMsg().length()>2000) {
|
||||
// xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg().substring(0, 2000));
|
||||
// }
|
||||
// return sqlSessionTemplate.update("XxlJobLogMapper.updateHandleInfo", xxlJobLog);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int delete(int jobId) {
|
||||
// return sqlSessionTemplate.delete("XxlJobLogMapper.delete", jobId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int triggerCountByHandleCode(int handleCode) {
|
||||
// return sqlSessionTemplate.selectOne("XxlJobLogMapper.triggerCountByHandleCode", handleCode);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<Map<String, Object>> triggerCountByDay(Date from, Date to, int handleCode) {
|
||||
// Map<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("from", from);
|
||||
// params.put("to", to);
|
||||
// params.put("handleCode", handleCode);
|
||||
// return sqlSessionTemplate.selectList("XxlJobLogMapper.triggerCountByDay", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int clearLog(int jobGroup, int jobId, Date clearBeforeTime, int clearBeforeNum) {
|
||||
// Map<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("jobGroup", jobGroup);
|
||||
// params.put("jobId", jobId);
|
||||
// params.put("clearBeforeTime", clearBeforeTime);
|
||||
// params.put("clearBeforeNum", clearBeforeNum);
|
||||
// return sqlSessionTemplate.delete("XxlJobLogMapper.clearLog", params);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -1,45 +1,45 @@
|
||||
package com.xxl.job.admin.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
import com.xxl.job.admin.dao.IXxlJobLogGlueDao;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 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> findByJobId(int jobId) {
|
||||
return sqlSessionTemplate.selectList("XxlJobLogGlueMapper.findByJobId", jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeOld(int jobId, int limit) {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("jobId", jobId);
|
||||
params.put("limit", limit);
|
||||
return sqlSessionTemplate.delete("XxlJobLogGlueMapper.removeOld", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByJobId(int jobId) {
|
||||
return sqlSessionTemplate.delete("XxlJobLogGlueMapper.deleteByJobId", jobId);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xxl.job.admin.dao.impl;
|
||||
//
|
||||
//import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
//import com.xxl.job.admin.dao.XxlJobLogGlueDao;
|
||||
//import org.mybatis.spring.SqlSessionTemplate;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * job log for glue
|
||||
// * @author xuxueli 2016-5-19 18:17:52
|
||||
// */
|
||||
//@Repository
|
||||
//public class XxlJobLogGlueDaoImpl implements XxlJobLogGlueDao {
|
||||
//
|
||||
// @Resource
|
||||
// public SqlSessionTemplate sqlSessionTemplate;
|
||||
//
|
||||
// @Override
|
||||
// public int save(XxlJobLogGlue xxlJobLogGlue) {
|
||||
// return sqlSessionTemplate.insert("XxlJobLogGlueMapper.save", xxlJobLogGlue);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobLogGlue> findByJobId(int jobId) {
|
||||
// return sqlSessionTemplate.selectList("XxlJobLogGlueMapper.findByJobId", jobId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int removeOld(int jobId, int limit) {
|
||||
// HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("jobId", jobId);
|
||||
// params.put("limit", limit);
|
||||
// return sqlSessionTemplate.delete("XxlJobLogGlueMapper.removeOld", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int deleteByJobId(int jobId) {
|
||||
// return sqlSessionTemplate.delete("XxlJobLogGlueMapper.deleteByJobId", jobId);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -1,52 +1,52 @@
|
||||
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 int removeDead(int timeout) {
|
||||
return sqlSessionTemplate.delete("XxlJobRegistryMapper.removeDead", timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XxlJobRegistry> findAll(int timeout) {
|
||||
return sqlSessionTemplate.selectList("XxlJobRegistryMapper.findAll", timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registryUpdate(String registryGroup, String registryKey, String registryValue) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("registryGroup", registryGroup);
|
||||
params.put("registryKey", registryKey);
|
||||
params.put("registryValue", registryValue);
|
||||
|
||||
return sqlSessionTemplate.update("XxlJobRegistryMapper.registryUpdate", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registrySave(String registryGroup, String registryKey, String registryValue) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("registryGroup", registryGroup);
|
||||
params.put("registryKey", registryKey);
|
||||
params.put("registryValue", registryValue);
|
||||
|
||||
return sqlSessionTemplate.update("XxlJobRegistryMapper.registrySave", params);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xxl.job.admin.dao.impl;
|
||||
//
|
||||
//import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
//import com.xxl.job.admin.dao.XxlJobRegistryDao;
|
||||
//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 XxlJobRegistryDao {
|
||||
//
|
||||
// @Resource
|
||||
// public SqlSessionTemplate sqlSessionTemplate;
|
||||
//
|
||||
// @Override
|
||||
// public int removeDead(int timeout) {
|
||||
// return sqlSessionTemplate.delete("XxlJobRegistryMapper.removeDead", timeout);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<XxlJobRegistry> findAll(int timeout) {
|
||||
// return sqlSessionTemplate.selectList("XxlJobRegistryMapper.findAll", timeout);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int registryUpdate(String registryGroup, String registryKey, String registryValue) {
|
||||
// Map<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("registryGroup", registryGroup);
|
||||
// params.put("registryKey", registryKey);
|
||||
// params.put("registryValue", registryValue);
|
||||
//
|
||||
// return sqlSessionTemplate.update("XxlJobRegistryMapper.registryUpdate", params);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int registrySave(String registryGroup, String registryKey, String registryValue) {
|
||||
// Map<String, Object> params = new HashMap<String, Object>();
|
||||
// params.put("registryGroup", registryGroup);
|
||||
// params.put("registryKey", registryKey);
|
||||
// params.put("registryValue", registryValue);
|
||||
//
|
||||
// return sqlSessionTemplate.update("XxlJobRegistryMapper.registrySave", params);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||
import com.xxl.job.admin.dao.XxlJobGroupDao;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml")
|
||||
public class XxlJobGroupDaoTest {
|
||||
|
||||
@Resource
|
||||
private XxlJobGroupDao xxlJobGroupDao;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
List<XxlJobGroup> list = xxlJobGroupDao.findAll();
|
||||
|
||||
List<XxlJobGroup> list2 = xxlJobGroupDao.findByAddressType(0);
|
||||
|
||||
XxlJobGroup group = new XxlJobGroup();
|
||||
group.setAppName("setAppName");
|
||||
group.setTitle("setTitle");
|
||||
group.setOrder(1);
|
||||
group.setAddressType(0);
|
||||
group.setAddressList("setAddressList");
|
||||
|
||||
int ret = xxlJobGroupDao.save(group);
|
||||
|
||||
XxlJobGroup group2 = xxlJobGroupDao.load(group.getId());
|
||||
group2.setAppName("setAppName2");
|
||||
group2.setTitle("setTitle2");
|
||||
group2.setOrder(2);
|
||||
group2.setAddressType(2);
|
||||
group2.setAddressList("setAddressList2");
|
||||
|
||||
int ret2 = xxlJobGroupDao.update(group2);
|
||||
|
||||
int ret3 = xxlJobGroupDao.remove(group.getId());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
import com.xxl.job.admin.dao.XxlJobLogDao;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml")
|
||||
public class XxlJobLogDaoTest {
|
||||
|
||||
@Resource
|
||||
private XxlJobLogDao xxlJobLogDao;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
List<XxlJobLog> list = xxlJobLogDao.pageList(0, 10, 1, 1, null, null, 1);
|
||||
int list_count = xxlJobLogDao.pageListCount(0, 10, 1, 1, null, null, 1);
|
||||
|
||||
XxlJobLog log = new XxlJobLog();
|
||||
log.setJobGroup(1);
|
||||
log.setJobId(1);
|
||||
|
||||
int ret1 = xxlJobLogDao.save(log);
|
||||
XxlJobLog dto = xxlJobLogDao.load(log.getId());
|
||||
|
||||
log.setGlueType("1");
|
||||
log.setTriggerTime(new Date());
|
||||
log.setTriggerCode(1);
|
||||
log.setTriggerMsg("1");
|
||||
log.setExecutorAddress("1");
|
||||
log.setExecutorHandler("1");
|
||||
log.setExecutorParam("1");
|
||||
ret1 = xxlJobLogDao.updateTriggerInfo(log);
|
||||
dto = xxlJobLogDao.load(log.getId());
|
||||
|
||||
|
||||
log.setHandleTime(new Date());
|
||||
log.setHandleCode(2);
|
||||
log.setHandleMsg("2");
|
||||
ret1 = xxlJobLogDao.updateHandleInfo(log);
|
||||
dto = xxlJobLogDao.load(log.getId());
|
||||
|
||||
|
||||
List<Map<String, Object>> list2 = xxlJobLogDao.triggerCountByDay(DateUtils.addDays(new Date(), 30), new Date(), 200);
|
||||
|
||||
int ret4 = xxlJobLogDao.clearLog(1, 1, new Date(), 100);
|
||||
|
||||
int ret2 = xxlJobLogDao.delete(log.getJobId());
|
||||
|
||||
int ret3 = xxlJobLogDao.triggerCountByHandleCode(-1);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
import com.xxl.job.admin.dao.XxlJobLogGlueDao;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml")
|
||||
public class XxlJobLogGlueDaoTest {
|
||||
|
||||
@Resource
|
||||
private XxlJobLogGlueDao xxlJobLogGlueDao;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
XxlJobLogGlue logGlue = new XxlJobLogGlue();
|
||||
logGlue.setJobId(1);
|
||||
logGlue.setGlueType("1");
|
||||
logGlue.setGlueSource("1");
|
||||
logGlue.setGlueRemark("1");
|
||||
int ret = xxlJobLogGlueDao.save(logGlue);
|
||||
|
||||
List<XxlJobLogGlue> list = xxlJobLogGlueDao.findByJobId(1);
|
||||
|
||||
int ret2 = xxlJobLogGlueDao.removeOld(1, 1);
|
||||
|
||||
int ret3 =xxlJobLogGlueDao.deleteByJobId(1);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
import com.xxl.job.admin.dao.XxlJobRegistryDao;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml")
|
||||
public class XxlJobRegistryDaoTest {
|
||||
|
||||
@Resource
|
||||
private XxlJobRegistryDao xxlJobRegistryDao;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
int ret = xxlJobRegistryDao.registryUpdate("g1", "k1", "v1");
|
||||
if (ret < 1) {
|
||||
ret = xxlJobRegistryDao.registrySave("g1", "k1", "v1");
|
||||
}
|
||||
|
||||
List<XxlJobRegistry> list = xxlJobRegistryDao.findAll(1);
|
||||
|
||||
int ret2 = xxlJobRegistryDao.removeDead(1);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue