添加关键字查询

Uat_Study
hang 2022-05-31 11:31:43 +08:00
parent dbb25ed313
commit f8a1b396b9
6 changed files with 7 additions and 28 deletions

View File

@ -78,6 +78,8 @@ namespace IRaCIS.Application.Contracts
public class BasicDicQuery:PageInput public class BasicDicQuery:PageInput
{ {
public string? keyInfo { get; set; }
public string? Code { get; set; } public string? Code { get; set; }

View File

@ -42,6 +42,9 @@ namespace IRaCIS.Application.Services
var systemBasicDataQueryable = _dicRepository.Where(t => t.ParentId == null) var systemBasicDataQueryable = _dicRepository.Where(t => t.ParentId == null)
.WhereIf(!string.IsNullOrEmpty(basicDicQuery.Code), t => t.Code.Contains(basicDicQuery.Code!)) .WhereIf(!string.IsNullOrEmpty(basicDicQuery.Code), t => t.Code.Contains(basicDicQuery.Code!))
.WhereIf(!string.IsNullOrEmpty(basicDicQuery.keyInfo), t => t.Description.Contains(basicDicQuery.keyInfo!) || t.Code.Contains(basicDicQuery.keyInfo!)
|| t.ChildList.Any(u=>u.ValueCN.Contains(basicDicQuery.keyInfo!)) || t.ChildList.Any(u => u.Description.Contains(basicDicQuery.keyInfo!)))
.WhereIf(basicDicQuery.ConfigTypeId != null, t => t.ConfigTypeId == basicDicQuery.ConfigTypeId!) .WhereIf(basicDicQuery.ConfigTypeId != null, t => t.ConfigTypeId == basicDicQuery.ConfigTypeId!)
.WhereIf(basicDicQuery.DataTypeEnum != null, t => t.DataTypeEnum == basicDicQuery.DataTypeEnum) .WhereIf(basicDicQuery.DataTypeEnum != null, t => t.DataTypeEnum == basicDicQuery.DataTypeEnum)

View File

@ -55,6 +55,7 @@ namespace IRaCIS.Core.Domain.Models
[ForeignKey("ParentId")] [ForeignKey("ParentId")]
public Dictionary Parent { get; set; } public Dictionary Parent { get; set; }
public List<Dictionary> ChildList { get; set; } = new List<Dictionary>();
[NotMapped] [NotMapped]

View File

@ -1077,24 +1077,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
} }
/// <summary>
/// 判断是否为空
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
private bool IsNullOrEmpty(object value)
{
if (value == null || value.ToString() == string.Empty)
{
return true;
}
else
{
return false;
}
}
/// <summary> /// <summary>

View File

@ -88,7 +88,7 @@ namespace IRaCIS.Core.Infra.EFCore
//modelBuilder.HasDbFunction(typeof(DbContext).GetMethod(nameof(GetTableList))); //modelBuilder.HasDbFunction(typeof(DbContext).GetMethod(nameof(GetTableList)));
modelBuilder.Entity<Dictionary>().HasMany(t => t.ChildList).WithOne(t => t.Parent);
if (_userInfo.IsEn_Us) if (_userInfo.IsEn_Us)
{ {
modelBuilder.Entity<Dictionary>().Property(t => t.MappedValue).HasColumnName(nameof(Domain.Models.Dictionary.Value)); modelBuilder.Entity<Dictionary>().Property(t => t.MappedValue).HasColumnName(nameof(Domain.Models.Dictionary.Value));

View File

@ -570,15 +570,6 @@ namespace IRaCIS.Core.Infra.EFCore
} }
#endregion
#region 稽查
#endregion #endregion