From fca1721e4ef9d92242942f6151d026400ab9bd0b Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期三, 26 三月 2025 00:04:56 +0800 Subject: [PATCH] 更新 --- src/main/java/com/whyc/service/PowerInfService.java | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/whyc/service/PowerInfService.java b/src/main/java/com/whyc/service/PowerInfService.java index b067f8d..f2b0e1b 100644 --- a/src/main/java/com/whyc/service/PowerInfService.java +++ b/src/main/java/com/whyc/service/PowerInfService.java @@ -110,19 +110,21 @@ } //鐢垫簮id鏌ヨ鏈�澶у�� int powerId = mapper.getMaxPowerId(); - powerInf.setPowerId(powerId); + powerInf.setPowerId(powerId+1); //瀵圭珯鐐瑰悕绉拌繘琛屾煡璇�,濡傛灉瀛樺湪鍒欑洿鎺ョ粦瀹氬叧绯� //濡傛灉涓嶅瓨鍦�,鍒欐柊澧炲悗,鍐嶇粦瀹氬叧绯� StationInf stationInf = stationInfService.getByStationName(powerInf.getStationName()); - if(stationInf == null){ + Integer stationId = stationInf.getSinfId(); + if(stationInf == null) { StationInf stationNew = new StationInf(); stationNew.setSinfName(powerInf.getStationName()); - int stationId = stationInfService.getMaxStationId(); - stationNew.setSinfId(stationId+1); + int stationIdInDB = stationInfService.getMaxStationId(); + stationId = stationIdInDB + 1; + stationNew.setSinfId(stationId); stationInfService.add(stationNew); - //绔欑偣鍜岀數婧恑d鍏宠仈 - stationPowerRelationService.add(stationId,powerId); } + //绔欑偣鍜岀數婧恑d鍏宠仈 + stationPowerRelationService.add(stationId,powerId); mapper.insert(powerInf); return new Response().setII(1,"鏂板瀹屾垚"); } -- Gitblit v1.9.1