沙钢智慧能源系统后端代码
liriming
2024-10-14 516ef4b0df8c26a3088e113e39d8198f161d4ea4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有,侵权必究!
 */
 
package com.iailab.module.shasteel.job.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.iailab.framework.common.constant.Constant;
import com.iailab.framework.common.page.PageData;
import com.iailab.framework.common.service.impl.BaseServiceImpl;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.shasteel.job.dao.ScheduleJobLogDao;
import com.iailab.module.shasteel.job.dto.ScheduleJobLogDTO;
import com.iailab.module.shasteel.job.entity.ScheduleJobLogEntity;
import com.iailab.module.shasteel.job.service.ScheduleJobLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
 
import java.util.Map;
 
@Service
public class ScheduleJobLogServiceImpl extends BaseServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
 
    @Override
    public PageData<ScheduleJobLogDTO> page(Map<String, Object> params) {
        IPage<ScheduleJobLogEntity> page = baseDao.selectPage(
            getPage(params, Constant.CREATE_DATE, false),
            getWrapper(params)
        );
        return getPageData(page, ScheduleJobLogDTO.class);
    }
 
    private QueryWrapper<ScheduleJobLogEntity> getWrapper(Map<String, Object> params){
        String jobId = (String)params.get("jobId");
 
        QueryWrapper<ScheduleJobLogEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(jobId), "job_id", jobId);
 
        return wrapper;
    }
 
    @Override
    public ScheduleJobLogDTO get(Long id) {
        ScheduleJobLogEntity entity = baseDao.selectById(id);
 
        return ConvertUtils.sourceToTarget(entity, ScheduleJobLogDTO.class);
    }
 
}