调度中心,DAO层代码精简优化并且新增测试用例覆盖;

master
xuxueli 7 years ago
parent 8e7a255105
commit 7926be5bc8
  1. 51
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobGroupDaoImpl.java
  2. 74
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobInfoDaoImpl.java
  3. 107
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java
  4. 45
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogGlueDaoImpl.java
  5. 52
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobRegistryDaoImpl.java

@ -1,51 +0,0 @@
//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 +0,0 @@
//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 +0,0 @@
//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 +0,0 @@
//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 +0,0 @@
//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);
// }
//
//}
Loading…
Cancel
Save