From 355dda1f90c70ab04c4517688da37d1a4236f112 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期二, 23 十二月 2025 21:43:30 +0800
Subject: [PATCH] fix:优化保存

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/VehicleSyncServiceImpl.java |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/VehicleSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/VehicleSyncServiceImpl.java
index 56fc2c2..860c875 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/VehicleSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/VehicleSyncServiceImpl.java
@@ -46,7 +46,9 @@
     @Autowired
     private VehicleInfoMapper vehicleInfoMapper;
 
-
+    private VehicleInfo findVehicleByCarId(Integer carId){
+        return vehicleInfoService.selectVehicleInfoByCarId(carId);
+    }
     /**
      * 鍚屾杞﹁締鏁版嵁鍒癕ySQL
      * 
@@ -87,6 +89,11 @@
 
                     // 鏌ヨ杞﹁締鏄惁瀛樺湪
                     VehicleInfo existingVehicle = findVehicleByPlateNumber(plateNumber);
+                    if(existingVehicle==null){
+                        existingVehicle = findVehicleByCarId(vehicleDTO.getCarId());
+                    }
+
+
 
                     // 瑙f瀽鎵�鏈夊垎鍏徃ID锛圕arOrdClass鍙兘鍖呭惈澶氫釜缂栫爜锛屽锛欻B,TI锛�
                     List<VehicleDept> vehicleDepts = parseVehicleDepts(vehicleDTO.getCarOrdClass());
@@ -215,6 +222,9 @@
         return license;
     }
 
+    private VehicleInfo findByCarId(Integer carId){
+        return vehicleInfoService.selectVehicleInfoByCarId(carId);
+    }
     /**
      * 鏍规嵁杞︾墝鍙锋煡鎵捐溅杈嗭紙妯$硦鍖归厤锛�
      * 

--
Gitblit v1.9.1