diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs
index 8fe2a151..8ec6831e 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs
@@ -11,10 +11,15 @@ public class GetWarningRuleInput
public int? SubSystemId { get; set; }
///
- /// 关键字(kpi/客户名称 模糊)
+ /// 关键字(kpi名称 模糊查询)
///
public string? Keywords { get; set; }
+ ///
+ /// 客户id
+ ///
+ public int? CustomId { get; set; }
+
///
/// 是否启用(留null查全部)
///
diff --git a/src/SJZY.Track.Application/Services/Warning/WarningService.cs b/src/SJZY.Track.Application/Services/Warning/WarningService.cs
index 478883b6..ced9e491 100644
--- a/src/SJZY.Track.Application/Services/Warning/WarningService.cs
+++ b/src/SJZY.Track.Application/Services/Warning/WarningService.cs
@@ -38,7 +38,7 @@ public class WarningService : ApplicationService
[HttpPost("GetWarningRule")]
public async Task>> GetWarningRule(GetWarningRuleInput input)
{
- var result = await _warningRuleRepository.GetWarningRuleListAsync(input.SubSystemId, input.Keywords, input.IsEnabled, input.WarningType);
+ var result = await _warningRuleRepository.GetWarningRuleListAsync(input.SubSystemId, input.CustomId, input.Keywords, input.IsEnabled, input.WarningType);
if (result.Count == 0)
return new UnifyResultDto>(true, new List());
diff --git a/src/SJZY.Track.Domain/Aggregates/WarningAggregate/IWarningRuleRepository.cs b/src/SJZY.Track.Domain/Aggregates/WarningAggregate/IWarningRuleRepository.cs
index 13df653f..b137a06c 100644
--- a/src/SJZY.Track.Domain/Aggregates/WarningAggregate/IWarningRuleRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/WarningAggregate/IWarningRuleRepository.cs
@@ -25,7 +25,7 @@ public interface IWarningRuleRepository : IBasicRepository
Task UpdateVersionAsync(WarningRuleEntity entity);
// 模糊查询预警规则主体
- Task> GetWarningRuleListAsync(int? subsystemId, string? keyword, bool? isEnabled, int? warningType);
+ Task> GetWarningRuleListAsync(int? subsystemId, int? customId, string? keyword, bool? isEnabled, int? warningType);
// 获取启用的预警规则主体
Task GetWarningRuleForEnabledAsync(int subSystemId, int customId, WarningRuleType warningType);
diff --git a/src/SJZY.Track.Repository/Repositories/WarningRuleRepository.cs b/src/SJZY.Track.Repository/Repositories/WarningRuleRepository.cs
index 13d7c255..811dbe8e 100644
--- a/src/SJZY.Track.Repository/Repositories/WarningRuleRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/WarningRuleRepository.cs
@@ -76,14 +76,14 @@ public class WarningRuleRepository : BasicRepository, IWarnin
return version;
}
- public Task> GetWarningRuleListAsync(int? subsystemId, string? keywords, bool? isEnabled, int? warningType)
+ public Task> GetWarningRuleListAsync(int? subsystemId, int? customId, string? keywords, bool? isEnabled, int? warningType)
{
return Context.Queryable()
+ .WhereIF(customId.HasValue, x => x.CustomId == customId!.Value)
.WhereIF(subsystemId.HasValue, x => x.SubSystemId == subsystemId!.Value)
- // todo: 客户/kpi名称 改成客户下拉
- .WhereIF(!string.IsNullOrWhiteSpace(keywords), x => x.Name.Contains(keywords!))
- .WhereIF(isEnabled.HasValue, x => x.IsEnabled == isEnabled!.Value)
.WhereIF(warningType.HasValue, x => x.WarningType == warningType!.Value)
+ .WhereIF(isEnabled.HasValue, x => x.IsEnabled == isEnabled!.Value)
+ .WhereIF(!string.IsNullOrWhiteSpace(keywords), x => x.Name.Contains(keywords!))
.ToListAsync();
}