whyclxw
2024-08-14 07ee6872dcbc977ad0b3c902e452d571d3a01661
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.SinfBinfMapper;
import com.whyc.mapper.StationInfMapper;
import com.whyc.pojo.BattInf;
import com.whyc.pojo.PowerInf;
import com.whyc.pojo.SinfBinf;
import com.whyc.pojo.StationInf;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.swing.*;
import java.util.List;
 
@Service
public class SinfBinfService {
 
    @Autowired(required = false)
    private SinfBinfMapper mapper;
 
    @Autowired(required = false)
    private StationInfMapper sinfMapper;
 
    /*查询左侧电池机房信息列表
     * @param null 入参
     * @return null
     * @author lxw
     * @date 2024/6/15 9:41
     **/
    public Response getAllSinfBinf1() {
        List<StationInf> list=mapper.getAllSinfBinf1();
        return new Response().setII(1,list!=null,list,"左侧电池机房信息");
    }
 
    /*查询左侧电源机房信息列表
     * @param null 入参
     * @return null
     * @author lxw
     * @date 2024/6/15 9:41
     **/
    public Response getAllSinfBinf2() {
        List<StationInf> list=mapper.getAllSinfBinf2();
        return new Response().setII(1,list!=null,list,"左侧电源机房信息");
    }
 
    /*查询左侧机房信息列表(包含电源和电池)
     * @param null 入参
     * @return null
     * @author lxw
     * @date 2024/6/27 15:58
     **/
    public Response getAllSinfBinf() {
        List<StationInf> list=sinfMapper.selectList((Wrapper<StationInf>) ActionUtil.objeNull);
        if(list!=null){
            for (StationInf sinf:list) {
                if(sinf.getStype()==1){
                    List<BattInf> binfList=mapper.selectBinfList(sinf.getSinfId());
                    sinf.setBinfList(binfList);
                }
                if(sinf.getStype()==2){
                    List<PowerInf> pinfList=mapper.selectPinfList(sinf.getSinfId());
                    sinf.setPinfList(pinfList);
                }
                if(sinf.getStype()==0){
                    List<BattInf> binfList=mapper.selectBinfList(sinf.getSinfId());
                    sinf.setBinfList(binfList);
                    List<PowerInf> pinfList=mapper.selectPinfList(sinf.getSinfId());
                    sinf.setPinfList(pinfList);
                }
            }
        }
        return new Response().setII(1,list!=null,list,"查询左侧机房信息列表(包含电源和电池)");
    }
}