diff --git a/PVDEMCS/.vs/PVDEMCS/v17/.suo b/PVDEMCS/.vs/PVDEMCS/v17/.suo index 71be1b8..f5e9dfd 100644 Binary files a/PVDEMCS/.vs/PVDEMCS/v17/.suo and b/PVDEMCS/.vs/PVDEMCS/v17/.suo differ diff --git a/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs b/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs index 20feb91..8b0273b 100644 --- a/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs @@ -154,6 +154,18 @@ namespace PVDEMCS.Controllers return result; } + /// + /// 根据设备Id获取记录统计 + /// + /// 设备Id + /// + [HttpGet] + public Result GetEquipmentRecordTotalDetail(string equipmentId) + { + var result = _equipmentRecordService.GetEquipmentRecordTotalDetail(equipmentId); + return result; + } + /// /// 获取设备总览 /// diff --git a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs index 4c92be6..0f1cba1 100644 --- a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs @@ -2,6 +2,7 @@ using PVDEMCS.Common.DI; using PVDEMCS.Common; using PVDEMCS.Services.Models; +using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services { @@ -36,6 +37,13 @@ namespace PVDEMCS.Services /// Result> GetEquipmentRecordList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime); + /// + /// 根据设备Id获取记录统计 + /// + /// 设备Id + /// + Result GetEquipmentRecordTotalDetail(string equipmentId); + /// /// 添加或更新设备状态记录 /// 1.如果设备最新记录状态没有改变则更新结束时间 diff --git a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs index db58e0f..dcf79c5 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs @@ -6,6 +6,8 @@ using PVDEMCS.Services.Repositories; using Microsoft.AspNetCore.Mvc.RazorPages; using PVDEMCS.Common.Constant; using System; +using PVDEMCS.Common.Tools; +using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services.Impl { @@ -149,6 +151,27 @@ namespace PVDEMCS.Services.Impl return result; } + + /// + /// 根据设备Id获取记录统计 + /// + /// 设备Id + /// + public Result GetEquipmentRecordTotalDetail(string equipmentId) + { + var result = new Result(); + + var value = this._equipmentRecordRepository.GetEquipmentRecordTotalDetail(equipmentId); + if (!value.IsSuccess) + { + result.Message = value.Message; + return result; + } + result.Content = ModelTools.PubClone.Trans(value.Content); + + return result; + } + /// /// 获取设备状态记录月统计 /// diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/BaseEntity/CUDBaseEntity.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/BaseEntity/CUDBaseEntity.cs index d7d7274..341f146 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/BaseEntity/CUDBaseEntity.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/BaseEntity/CUDBaseEntity.cs @@ -52,7 +52,7 @@ namespace PVDEMCS.Services.Repositories.Entities.BaseEntity public void Create() { - Id = SnowFlakeNew.NewId; + Id = SnowFlakeNew.LongId.ToString(); CreateAt = DateTime.Now; CreateBy = "1"; Update(); diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs index 902cef6..5f34159 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs @@ -107,6 +107,13 @@ namespace PVDEMCS.Services.Repositories /// 设备类型 Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType); + /// + /// 根据设备Id获取记录统计 + /// + /// 设备Id + /// + Result GetEquipmentRecordTotalDetail(string equipmentId); + /// /// 获取设备状态记录月统计 /// diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs index 385dcbd..44aeb45 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs @@ -528,6 +528,20 @@ namespace PVDEMCS.Services.Repositories.Impl return query; } + /// + /// 根据设备Id获取记录统计 + /// + /// 设备Id + /// + public Result GetEquipmentRecordTotalDetail(string equipmentId) + { + using (var context=new EFContext()) + { + var entity = context.EquipmentRecordTotals.Where(f => f.EquipmentId == equipmentId).FirstOrDefault(); + return new Result(entity); + } + } + /// /// 获取设备状态记录月统计 ///