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