lxw
2023-12-21 21a2275b893d210e8777d2a8239bbf994b95b40e
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
55
56
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.LogOpEnum;
import com.whyc.dto.Response;
import com.whyc.mapper.CKPowerDevBattSetLogMapper;
import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattSetLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class CKPowerDevBattSetLogService {
    @Autowired(required = false)
    private CKPowerDevBattSetLogMapper mapper;
 
    //获取核容装置日志
    public Response getBattSetLog(CKPowerDevBattSetLog battSetLog) {
        PageHelper.startPage(battSetLog.getPageCurr(),battSetLog.getPageSize());
        QueryWrapper wrapper=new QueryWrapper();
        if(battSetLog.getDevType()!=null){
            wrapper.eq("dev_type",battSetLog.getDevType());
        }
        if(battSetLog.getCmdType()!=null){
            wrapper.eq("cmd_type",battSetLog.getDevType());
        }
        if(battSetLog.getParamCn()!=null){
            wrapper.eq("param_cn",battSetLog.getDevType());
        }
        if(battSetLog.getCreateTime()!=null){
            wrapper.ge("create_time",battSetLog.getCreateTime());
        }
        if(battSetLog.getCreateTime1()!=null){
            wrapper.le("create_time",battSetLog.getCreateTime1());
        }
        wrapper.orderByDesc("create_time");
        List<CKPowerDevBattSetLog> list=mapper.selectList(wrapper);
        list.forEach(log->{
            log.setCmdName(LogOpEnum.getValueByKey(log.getCmdType()));
        });
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"获取核容装置日志");
    }
    //添加记录
    public void addBatch(List<CKPowerDevBattSetLog> logList) {
        mapper.insertBatchSomeColumn(logList);
    }
 
    //添加记录单条
    public void add(CKPowerDevBattSetLog log) {
        mapper.insert(log);
    }
}