src/main/java/com/whyc/controller/SinfBinfController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/SinfBinfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/StationInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/SinfBinf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/StationInf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/SinfBinfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/SinfBinfController.java
@@ -29,4 +29,11 @@ Response res=service.getAllSinfBinf2(); return res; } @ApiOperation("查询左侧机房信息列表(包含电源和电池)") @GetMapping("getAllSinfBinf") public Response getAllSinfBinf(){ Response res=service.getAllSinfBinf(); return res; } } src/main/java/com/whyc/mapper/SinfBinfMapper.java
@@ -1,5 +1,7 @@ package com.whyc.mapper; import com.whyc.pojo.BattInf; import com.whyc.pojo.PowerInf; import com.whyc.pojo.SinfBinf; import com.whyc.pojo.StationInf; @@ -11,4 +13,12 @@ //查询左侧电源机房信息列表 List<StationInf> getAllSinfBinf2(); //根据机房id查电池组 List<BattInf> selectBinfList(int sinfId); //根据机房id查电源 List<PowerInf> selectPinfList(int sinfId); } src/main/java/com/whyc/mapper/StationInfMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.StationInf; public interface StationInfMapper extends CustomMapper<StationInf>{ } src/main/java/com/whyc/pojo/SinfBinf.java
@@ -33,7 +33,4 @@ @ApiModelProperty("机房内电池组编号") private Integer groupIndex; @TableField("stype") @ApiModelProperty("机房类型: 1<电池组> 2<电源>") private Integer stype; } src/main/java/com/whyc/pojo/StationInf.java
@@ -30,6 +30,10 @@ @ApiModelProperty("机房ip") private String sinfIp; @TableField("stype") @ApiModelProperty("机房类型: 1<电池组> 2<电源>") private Integer stype; @TableField(exist = false) private List<BattInf> binfList; src/main/java/com/whyc/service/SinfBinfService.java
@@ -1,11 +1,18 @@ 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 @@ -13,6 +20,9 @@ @Autowired(required = false) private SinfBinfMapper mapper; @Autowired(required = false) private StationInfMapper sinfMapper; /*查询左侧电池机房信息列表 * @param null 入参 @@ -35,4 +45,33 @@ 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,"查询左侧机房信息列表(包含电源和电池)"); } }