Search in sources :

Example 1 with HistoryJobConfig

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);
}
Also used : HistoryJobConfig(com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig) Date(java.util.Date) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with HistoryJobConfig

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;
}
Also used : HistoryJobConfig(com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with 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;
}
Also used : HistoryJobConfig(com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig) PageRequest(org.springframework.data.domain.PageRequest) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with HistoryJobConfig

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);
}
Also used : HistoryJobConfig(com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig) Date(java.util.Date) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with HistoryJobConfig

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;
}
Also used : HistoryJobConfig(com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig)

Aggregations

HistoryJobConfig (com.vip.saturn.job.console.mybatis.entity.HistoryJobConfig)5 Transactional (org.springframework.transaction.annotation.Transactional)3 Date (java.util.Date)2 HashMap (java.util.HashMap)1 PageRequest (org.springframework.data.domain.PageRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1