From c5a96f35ff17e71a330fd391bc3866cead3d13b4 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 14 八月 2024 15:59:42 +0800 Subject: [PATCH] 充电桩权限管理 --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java index ea3e370..6d771f5 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -183,20 +184,22 @@ /** * 删除充电桩 - * @param id + * @param ids * @return */ @Override - public AjaxResult delChargingPile(Integer id) { + public AjaxResult delChargingPile(Integer[] ids) { //检查是否有关联数据 //接口 - long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); + long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, Arrays.asList(ids)).eq(TChargingGun::getDelFlag, 0)); if(count > 0){ return AjaxResult.error("该充电桩有关联的接口数据,删除失败!"); } - TChargingPile chargingPile = this.getById(id); - chargingPile.setDelFlag(true); - this.updateById(chargingPile); + for (Integer id : ids) { + TChargingPile chargingPile = this.getById(id); + chargingPile.setDelFlag(true); + this.updateById(chargingPile); + } return AjaxResult.success(); } @@ -215,14 +218,14 @@ } @Override - public List<TChargingPileVO> getChargingGunList(Integer siteId) { + 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::getSiteId, siteId) + .eq(TChargingGun::getChargeMode, type)); // 查询充电枪信息 chargingPileVOS.forEach(item -> { - List<TChargingGun> gunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); - item.setChargingGunList(gunList); + item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); }); return chargingPileVOS; } -- Gitblit v1.7.1