查询报警接口增加查询条件

zw
tq 4 months ago
parent 2bdb2a39c2
commit 0c0944d3c2

@ -6,4 +6,8 @@ public class QueryAlarmReq : QueryPageModel
{ {
public int TypeCode { get; set; } = -1; public int TypeCode { get; set; } = -1;
public string? EquipCode { get; set; } public string? EquipCode { get; set; }
public string? ErrorLevel { get; set; }
public DateTime? StartTime { get; set; }
} }

@ -33,8 +33,11 @@ public class EquipAlarmRecordService : BaseServices<EquipAlarmRecord>
int totalCount = 0; int totalCount = 0;
int reqTypeCode = req.TypeCode; int reqTypeCode = req.TypeCode;
var equipCode = req.EquipCode; var equipCode = req.EquipCode;
var errorLevel = req.ErrorLevel;
List<EquipAlarmRecord> list = BaseDal.Queryable().WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode) List<EquipAlarmRecord> list = BaseDal.Queryable().WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode) .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(errorLevel), it => it.ErrorLevel == errorLevel)
.WhereIF(req.StartTime.HasValue, it => it.StartTime == req.StartTime)
.OrderBy(it => it.CreatedTime, OrderByType.Desc) .OrderBy(it => it.CreatedTime, OrderByType.Desc)
.ToPageList(req.PageNum, req.PageSize, ref totalCount); .ToPageList(req.PageNum, req.PageSize, ref totalCount);
@ -84,9 +87,12 @@ public class EquipAlarmRecordService : BaseServices<EquipAlarmRecord>
int totalCount = 0; int totalCount = 0;
int reqTypeCode = req.TypeCode; int reqTypeCode = req.TypeCode;
var equipCode = req.EquipCode; var equipCode = req.EquipCode;
var errorLevel = req.ErrorLevel;
List<EquipAlarmProcessRecord> list = ProcessRecordRepository.Queryable() List<EquipAlarmProcessRecord> list = ProcessRecordRepository.Queryable()
.WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode) .WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode) .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(errorLevel), it => it.ErrorLevel == errorLevel)
.WhereIF(req.StartTime.HasValue, it => it.StartTime == req.StartTime)
.OrderBy(it => it.CreatedTime, OrderByType.Desc) .OrderBy(it => it.CreatedTime, OrderByType.Desc)
.ToPageList(req.PageNum, req.PageSize, ref totalCount); .ToPageList(req.PageNum, req.PageSize, ref totalCount);

Loading…
Cancel
Save