use of com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig in project Saturn by vipshop.
the class CurrentJobConfigServiceImpl method updateConfigAndSave2History.
@Transactional
@Override
public void updateConfigAndSave2History(final CurrentJobConfig newJobconfig, final CurrentJobConfig oldJobconfig, final String userName) throws Exception {
HistoryJobConfig history = mapper.map(oldJobconfig, HistoryJobConfig.class);
if (userName != null) {
newJobconfig.setLastUpdateBy(userName);
}
newJobconfig.setLastUpdateTime(new Date());
updateByPrimaryKey(newJobconfig);
history.setId(null);
historyJobConfigService.create(history);
}
use of com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig in project Saturn by vipshop.
the class HistoryJobConfigServiceImpl method findByPrimaryKey.
@Transactional(readOnly = true)
@Override
public HistoryJobConfig findByPrimaryKey(Long id) throws Exception {
HistoryJobConfig historyJobConfig = historyJobConfigRepo.selectByPrimaryKey(id);
historyJobConfig.setDefaultValues();
return historyJobConfig;
}
use of com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig in project Saturn by vipshop.
the class JobOperationController method loadHistoryConfig.
@RequestMapping(value = "loadHistoryConfig", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> loadHistoryConfig(String jobName, String ns, Integer length, HttpSession session) throws Exception {
Map<String, Object> data = new HashMap<String, Object>();
HistoryJobConfig history = new HistoryJobConfig();
history.setJobName(jobName);
history.setNamespace(ns);
int total = historyJobConfigService.selectCount(history);
total = total > DEFAULT_RECORD_COUNT ? DEFAULT_RECORD_COUNT : total;
PageRequest page = new PageRequest(0, DEFAULT_RECORD_COUNT, Direction.DESC, "last_update_time");
data.put("data", historyJobConfigService.selectPage(history, page));
data.put("recordsTotal", total);
data.put("recordsFiltered", length);
data.put("draw", 1);
return data;
}
use of com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig in project Saturn by vipshop.
the class CurrentJobConfigServiceImpl method updateConfigAndSave2History.
@Transactional
@Override
public void updateConfigAndSave2History(final CurrentJobConfig jobconfig, final JobSettings jobSettings, final String userName) throws Exception {
HistoryJobConfig history = mapper.map(jobconfig, HistoryJobConfig.class);
mapper.map(jobSettings, jobconfig);
jobconfig.setLastUpdateBy(userName);
jobconfig.setLastUpdateTime(new Date());
updateByPrimaryKey(jobconfig);
history.setId(null);
historyJobConfigService.create(history);
}
use of com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig in project Saturn by vipshop.
the class HistoryJobConfigServiceImpl method selectPage.
@Override
public List<HistoryJobConfig> selectPage(HistoryJobConfig historyjobconfig, Pageable pageable) throws Exception {
List<HistoryJobConfig> historyJobConfigs = historyJobConfigRepo.selectPage(historyjobconfig, pageable);
if (historyJobConfigs != null) {
int i = 1;
for (HistoryJobConfig historyJobConfig : historyJobConfigs) {
historyJobConfig.setRownum(i++);
historyJobConfig.setDefaultValues();
}
}
return historyJobConfigs;
}
Aggregations