whycxzp
2023-12-22 6320368558f548b4a3a07228e52d5ebed4818401
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
57
58
59
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);
    }
}