电池模型

zw
CZ 5 months ago
parent bd3325234e
commit 89a25d390a

@ -60,9 +60,11 @@ public class BatteryOpModelDetailService : BaseServices<BatteryOpModelDetail>
// 删除模型 // 删除模型
var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == user.ModelId); var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == user.ModelId);
bool batteay = true; bool batteay = true;
var batteryOpModel = _batteryOpModelRepository.QueryListByClause(i => i.ModelId == user.ModelId);
if (isExistModel != null) 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<BatteryOpModelDetail>
ModelId = input.ModelId ModelId = input.ModelId
}; };
await _batteryOpModelDetailRepository.InsertAsync(input); await _batteryOpModelDetailRepository.InsertAsync(input);
var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == input.ModelId); var isExistModel = await _batteryOpModelRepository.QueryByClauseAsync(u => u.ModelId == input.ModelId);
if (isExistModel == null) if (isExistModel == null)
{ {
@ -147,7 +149,6 @@ public class BatteryOpModelDetailService : BaseServices<BatteryOpModelDetail>
List<BatteryOpModelDetail> batteryOpModelDetails = await _batteryOpModelDetailRepository.QueryAsync(); List<BatteryOpModelDetail> batteryOpModelDetails = await _batteryOpModelDetailRepository.QueryAsync();
foreach (var detail in batteryOpModelDetails) foreach (var detail in batteryOpModelDetails)
{ {
if (detail.StartTime == batteryOpReq.StartTime && detail.Id != batteryOpReq.Id || if (detail.StartTime == batteryOpReq.StartTime && detail.Id != batteryOpReq.Id ||
detail.EndTime == batteryOpReq.EndTime && detail.Id != batteryOpReq.Id) detail.EndTime == batteryOpReq.EndTime && detail.Id != batteryOpReq.Id)
{ {
@ -155,7 +156,6 @@ public class BatteryOpModelDetailService : BaseServices<BatteryOpModelDetail>
} }
} }
// 通过id查找修改之前的模型id // 通过id查找修改之前的模型id
var batteryOpModelDetail = var batteryOpModelDetail =

Loading…
Cancel
Save