From ea0e6aeaad04e8762bb33ddad64fec1eb1d0e3b7 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期六, 21 六月 2025 10:07:04 +0800
Subject: [PATCH] 资产管理添加变更记录,查询时需要将最近2次的变更记录查询出来

---
 src/main/java/com/whyc/service/BattInfService.java |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java
index dc13974..00043eb 100644
--- a/src/main/java/com/whyc/service/BattInfService.java
+++ b/src/main/java/com/whyc/service/BattInfService.java
@@ -15,9 +15,7 @@
 import com.whyc.mapper.BattInfMapper;
 import com.whyc.mapper.PowerInfMapper;
 import com.whyc.mapper.StationInfMapper;
-import com.whyc.pojo.db_station.BattInf;
-import com.whyc.pojo.db_station.PowerInf;
-import com.whyc.pojo.db_station.StationInf;
+import com.whyc.pojo.db_station.*;
 import com.whyc.pojo.db_user.User;
 import com.whyc.util.ActionUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +41,8 @@
     @Autowired(required = false)
     private BaojigroupService bjService;
 
+    @Autowired(required = false)
+    private InfoChangeService changeService;
     /*鏂板缓鐢垫睜缁勶紙鏂扮殑璁惧鏂扮殑鐢垫睜缁勶級
      * @param binf
      * 1.鍦ㄧ數婧愪笅鏂板缓璁惧锛岃褰曡澶囩紪鍙凤紝devNum,璁惧鍚嶇О涓鸿澶囩被鍨�+devNum
@@ -310,6 +310,11 @@
         }
         sinfMapper.update((StationInf) ActionUtil.objeNull,wrapper1);
         pinfMapper.update((PowerInf) ActionUtil.objeNull,wrapper2);
+        //瀛樺叆鍙樻洿淇℃伅璁板綍
+        pinf.setStationId(sinf.getStationId());
+        binf.setStationId(sinf.getStationId());
+        binf.setPowerId(pinf.getPowerId());
+        changeService.addInfoChange(sinf,pinf,binf,info.getUpdateReason());
         return new Response().set(1,true,"淇敼淇℃伅鎴愬姛");
     }
     /*//淇敼鐢垫睜缁�
@@ -363,6 +368,15 @@
         dto.setUid(user.getId());
         PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
         List<InfoDto> list=mapper.getInfo(dto);
+        for (InfoDto infoDto:list) {
+            //鑾峰彇鏈烘埧锛岀數婧愶紝鐢垫睜缁勫彉鏇磋褰�
+            List<StationInfChange> sinfChangeList=changeService.getSinfChange(infoDto.getStationId());
+            infoDto.setSinfChangeList(sinfChangeList);
+            List<PowerInfChange> pinfChangeList=changeService.getPinfChange(infoDto.getPowerId());
+            infoDto.setPinfChangeList(pinfChangeList);
+            List<BattInfChange> binfChangeList=changeService.getBinfChange(infoDto.getBattgroupId());
+            infoDto.setBinfChangeList(binfChangeList);
+        }
         PageInfo pageInfo=new PageInfo(list);
         return new Response().setII(1,list!=null,pageInfo,"鏌ヨ鐢垫睜");
     }

--
Gitblit v1.9.1