From 3cf9d2b6664bf83216c25d33f3f2890de6f25443 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 08 七月 2024 12:05:12 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Services/ProjectService.cs | 49 ++++++++++++++++++++++++++----------------------- 1 files changed, 26 insertions(+), 23 deletions(-) diff --git a/zhengcaioa/Services/ProjectService.cs b/zhengcaioa/Services/ProjectService.cs index 89a6f22..24c5958 100644 --- a/zhengcaioa/Services/ProjectService.cs +++ b/zhengcaioa/Services/ProjectService.cs @@ -231,7 +231,7 @@ } } } - CacheHelperNetCore.CacheNull("Projects"); + //CacheHelperNetCore.CacheNull("Projects"); _context.SaveChanges(); @@ -348,21 +348,7 @@ } - if (!string.IsNullOrWhiteSpace(searchEntity.NamesToubiao)) - { - sql.Append(" and ( exists (select b.[ProjectId] from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and b.[names] like '%" + searchEntity.NamesToubiao + "%') "); - - sql.Append(" or exists (select c.[ProjectId] from [Projectreason] c where a.[Id]=c.[ProjectId] and c.[reasonname] like '%" + searchEntity.NamesToubiao + "%') "); - - sql.Append(" or exists (select d.[ProjectId] from [Projectyouxiao] d where a.[Id]=d.[ProjectId] and d.[namesyouxiao] like '%" + searchEntity.NamesToubiao + "%') "); - - sql.Append(" or a.[drhx] like '%" + searchEntity.NamesToubiao + "%' "); - - sql.Append(" or a.[dshx] like '%" + searchEntity.NamesToubiao + "%' "); - - sql.Append(" )"); - - } + if (!string.IsNullOrWhiteSpace(searchEntity.Fencha)) { decimal aaaa = 0; @@ -653,7 +639,28 @@ - var query = _context.Projects + if (!string.IsNullOrWhiteSpace(searchEntity.NamesToubiao)) + { + var sqlsss = sql.ToString(); + sql.Append(" and ( exists (select b.[ProjectId] from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and b.[names] like '%" + searchEntity.NamesToubiao + "%') "); + + sql.Append(" or exists (select c.[ProjectId] from [Projectreason] c where a.[Id]=c.[ProjectId] and c.[reasonname] like '%" + searchEntity.NamesToubiao + "%') "); + + sql.Append(" or exists (select d.[ProjectId] from [Projectyouxiao] d where a.[Id]=d.[ProjectId] and d.[namesyouxiao] like '%" + searchEntity.NamesToubiao + "%') "); + sql.Append(" )"); + sql.Append(" union "+ sqlsss + " and ( a.[drhx] like '%" + searchEntity.NamesToubiao + "%' "); + + sql.Append(" or a.[dshx] like '%" + searchEntity.NamesToubiao + "%' "); + sql.Append(" )"); + + + } + + + + + + var query = _context.Projects .FromSqlRaw(sql.ToString()); @@ -860,16 +867,12 @@ /// <returns></returns> public List<ProjectDTO> GetList() { - List<ProjectDTO> projectDTOs = (List<ProjectDTO>)CacheHelperNetCore.CacheValue("Projects"); - if (projectDTOs!=null&& projectDTOs.Count > 0) - { - return projectDTOs; - } + var listPosition = _context.Projects.Where(r => r.RecStatus == "A").ToList(); var list = _mapper.Map<List<ProjectDTO>>(listPosition); - CacheHelperNetCore.CacheInsert("Projects", list); + return list; } -- Gitblit v1.9.1