From 89a25d390a22400d6a8d02d8369ad50c7d1ddfd0 Mon Sep 17 00:00:00 2001 From: CZ Date: Sun, 23 Jun 2024 13:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E6=B1=A0=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Station/BatteryOpModelDetailService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Service/Station/BatteryOpModelDetailService.cs b/Service/Station/BatteryOpModelDetailService.cs index d30c853..5613e64 100644 --- a/Service/Station/BatteryOpModelDetailService.cs +++ b/Service/Station/BatteryOpModelDetailService.cs @@ -60,9 +60,11 @@ public class BatteryOpModelDetailService : BaseServices // 删除模型 var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == user.ModelId); bool batteay = true; + var batteryOpModel = _batteryOpModelRepository.QueryListByClause(i => i.ModelId == user.ModelId); if (isExistModel != null) { - batteay = await _batteryOpModelRepository.DeleteAsync(isExistModel); + if (batteryOpModel.Count > 1) //如果模型里面还有数据,此模型就不删除 + batteay = await _batteryOpModelRepository.DeleteAsync(isExistModel); } // 删除模型详情 @@ -116,7 +118,7 @@ public class BatteryOpModelDetailService : BaseServices ModelId = input.ModelId }; await _batteryOpModelDetailRepository.InsertAsync(input); - + var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == input.ModelId); if (isExistModel == null) { @@ -147,7 +149,6 @@ public class BatteryOpModelDetailService : BaseServices List batteryOpModelDetails = await _batteryOpModelDetailRepository.QueryAsync(); foreach (var detail in batteryOpModelDetails) { - if (detail.StartTime == batteryOpReq.StartTime && detail.Id != batteryOpReq.Id || detail.EndTime == batteryOpReq.EndTime && detail.Id != batteryOpReq.Id) { @@ -155,7 +156,6 @@ public class BatteryOpModelDetailService : BaseServices } } - // 通过id查找修改之前的模型id var batteryOpModelDetail =