package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.CKPowerDevRtSetLogMapper;
|
import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevRtSetLog;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
@Service
|
public class CKPowerDevRtSetLogService {
|
|
@Resource
|
private CKPowerDevRtSetLogMapper mapper;
|
|
|
public void add(CKPowerDevRtSetLog log) {
|
mapper.insert(log);
|
}
|
|
public void addBatch(List<CKPowerDevRtSetLog> log){
|
mapper.insertBatchSomeColumn(log);
|
}
|
|
public Response getCounts(List<String> countFields) {
|
for (String countField : countFields) {
|
QueryWrapper<CKPowerDevRtSetLog> query = Wrappers.query();
|
query.select(countField).isNotNull(countField);
|
List<CKPowerDevRtSetLog> logs = mapper.selectList(query);
|
long count = logs.stream().filter(temp -> temp.getAcIn1VolASt() ==0).count();
|
long count2 = logs.stream().filter(temp -> temp.getAcIn1VolASt() ==1).count();
|
|
return new Response().setII(1,count,count2,null);
|
}
|
return null;
|
|
}
|
}
|