package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.whyc.mapper.CKPowerDevBattRtDataMapper;
|
import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtData;
|
import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtState;
|
import com.whyc.pojo.db_ckpwrdev_inf.CKPwrDevInf;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
@Service
|
public class CKPowerDevBattRtDataService {
|
|
@Resource
|
private CKPowerDevBattRtDataMapper mapper;
|
|
@Autowired
|
private CKPwrDevInfService ckPwrDevInfService;
|
|
/**
|
* 首页只显示1组,目前只有1组
|
* 但是其他地方,均按多组处理
|
* @return
|
*/
|
public List<CKPowerDevBattRtData> getList(Integer index) {
|
//查询有单体数量
|
CKPwrDevInf ckPwrDevInf = ckPwrDevInfService.get();
|
|
QueryWrapper<CKPowerDevBattRtData> query = Wrappers.query();
|
if(index!=null) {
|
if(index == -1){ //首页查询使用,只查询组1
|
query.eq("batt_index", 0);
|
}else {
|
query.eq("batt_index", index);
|
}
|
}
|
query.le("mon_num",ckPwrDevInf.getBattMonCount());
|
return mapper.selectList(query);
|
}
|
|
|
/**单体列表查询*/
|
public List<CKPowerDevBattRtData> getMonList(Integer battIndex, List<Integer> monNumList) {
|
QueryWrapper<CKPowerDevBattRtData> query = Wrappers.query();
|
if(battIndex!=null) {
|
if(battIndex == -1) { //首页上使用,默认只查组1
|
query.eq("batt_index", 0);
|
}else{
|
query.eq("batt_index", battIndex);
|
}
|
}
|
query.in("mon_num",monNumList);
|
return mapper.selectList(query);
|
}
|
|
/**组内所有单体列表查询*/
|
public List<CKPowerDevBattRtData> getAllMonList(Integer battIndex) {
|
QueryWrapper<CKPowerDevBattRtData> query = Wrappers.query();
|
if(battIndex!=null) {
|
if(battIndex == -1) { //首页上使用,默认只查组1
|
query.eq("batt_index", 0);
|
}else{
|
query.eq("batt_index", battIndex);
|
}
|
}
|
return mapper.selectList(query);
|
}
|
|
//获取默认第一组单体数据刷新至第一组0
|
public List<CKPowerDevBattRtData> getDataList_index0() {
|
QueryWrapper<CKPowerDevBattRtData> wrapper = Wrappers.query();
|
wrapper.eq("batt_index",0);
|
wrapper.orderByAsc("mon_num");
|
return mapper.selectList(wrapper);
|
}
|
}
|