zhibing.pu
2024-08-26 9f35dc84a6af0a9019e5ae2c8ac4b2c8e2c99fe9
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -244,9 +244,12 @@
   @Override
   public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) {
      List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId);
      List<TChargingGun> chargingGuns = chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class)
            .eq(TChargingGun::getSiteId, siteId)
            .eq(TChargingGun::getChargeMode, type));
      LambdaQueryWrapper<TChargingGun> wrapper = new LambdaQueryWrapper<>();
      if(Objects.nonNull(type)){
         wrapper.eq(TChargingGun::getChargeMode, type);
      }
      wrapper.eq(TChargingGun::getSiteId, siteId);
      List<TChargingGun> chargingGuns = chargingGunService.list(wrapper);
      // 查询充电枪信息
      chargingPileVOS.forEach(item -> {
         item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()));