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 | 39 +++++++++++++++++++++++---------------- 1 files changed, 23 insertions(+), 16 deletions(-) diff --git a/zhengcaioa/Services/ProjectService.cs b/zhengcaioa/Services/ProjectService.cs index 7b3b87e..24c5958 100644 --- a/zhengcaioa/Services/ProjectService.cs +++ b/zhengcaioa/Services/ProjectService.cs @@ -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()); -- Gitblit v1.9.1