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 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 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 list=sinfMapper.selectList((Wrapper) ActionUtil.objeNull); if(list!=null){ for (StationInf sinf:list) { if(sinf.getStype()==1){ List binfList=mapper.selectBinfList(sinf.getSinfId()); sinf.setBinfList(binfList); } if(sinf.getStype()==2){ List pinfList=mapper.selectPinfList(sinf.getSinfId()); sinf.setPinfList(pinfList); } if(sinf.getStype()==0){ List binfList=mapper.selectBinfList(sinf.getSinfId()); sinf.setBinfList(binfList); List pinfList=mapper.selectPinfList(sinf.getSinfId()); sinf.setPinfList(pinfList); } } } return new Response().setII(1,list!=null,list,"查询左侧机房信息列表(包含电源和电池)"); } }