lxw
2023-12-22 d2d8eef94baf66b0917fe42adbfa971565f0928e
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.getPageNum(),battSetLog.getPageSize());
        QueryWrapper wrapper=new QueryWrapper();
        if(battSetLog.getCmdType()!=null&&battSetLog.getCmdType()!=-1){
            wrapper.eq("cmd_type",battSetLog.getCmdType());
        }
        /*if(battSetLog.getParamCn()!=null){
            wrapper.eq("param_cn",battSetLog.getParamCn());
        }*/
        if(battSetLog.getBattIndex()!=null){
            wrapper.eq("batt_index",battSetLog.getBattIndex());
        }
        if(battSetLog.getCreateTime()!=null&&!battSetLog.getCreateTime().equals("")){
            wrapper.ge("create_time",battSetLog.getCreateTime());
        }
        if(battSetLog.getCreateTime1()!=null&&!battSetLog.getCreateTime1().equals("")){
            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);
    }
}