diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackTemplateListInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackTemplateListInput.cs index 269a1a0e..e1c04282 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackTemplateListInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackTemplateListInput.cs @@ -16,4 +16,9 @@ public class GetTrackTemplateListInput /// 模版分类 /// public int? TemplateType { get; set; } + + /// + /// 模板code + /// + public string? TemplateCode { get; set; } } diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateListInputVo.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateListInputVo.cs index 7e0abd82..a2f111a7 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateListInputVo.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateListInputVo.cs @@ -16,4 +16,9 @@ public class GetTrackTemplateListInputVo /// 模版分类 /// public int? TemplateType { get; set; } + + /// + /// 模板code + /// + public string? TemplateCode { get; set; } } diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 9f28d8fc..24bdc7ea 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -191,6 +191,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where(x => x.SubSystemId == input.SubSystemId) .WhereIF(input.CustomerId.HasValue, x => x.CustomerId == input.CustomerId) .WhereIF(input.TemplateType.HasValue, x => x.CategoryId == input.TemplateType) + .WhereIF(!input.TemplateCode.IsNullOrWhiteSpace(), x => x.Code == input.TemplateCode) .Select(x => new TrackTemplateOutputVo { Id = x.Id, @@ -229,7 +230,6 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task> GetContentByTemplateCodes(string[] codes, int systemId) { - var sql = @$" select distinct @@ -244,7 +244,10 @@ public class TrackTemplateRepository : BasicRepository, ITr "; - var list = Context.Ado.SqlQuery(sql, new {codes = codes}).ToList(); + var list = Context.Ado.SqlQuery(sql, new + { + codes = codes + }).ToList(); return list; }