username@email.com
2021-09-10 83c4efe25b7b5ee027a34987f8ee508a379c1d47
zhengcaioa/Services/ProjectService.cs
@@ -372,6 +372,32 @@
                    sql.Append("  ) ");
                }
            }
             if (!string.IsNullOrWhiteSpace(searchEntity.Chuanbiaofenxi))
            {
                if (searchEntity.Chuanbiaofenxi == "01")
                {
                    sql.Append(" and exists ( select b.[ProjectId] from [Projectzhongbiao] b  where  a.[Id]=b.[ProjectId] and  (b.[defen]-a.[drhx_defen])  >= 10 ) ");
                    sql.Append(" and exists ( select * from( select  (   isnull((select  COUNT(*) ProjectIdshuliang from  [Projectzhongbiao] b  where  a.[Id]=b.[ProjectId]   group by b.ProjectId) ,0)+  ");
                    sql.Append(" isnull( (select  COUNT(*) ProjectIdshuliang from  [Projectreason] b  where  a.[Id]=b.[ProjectId] group by b.ProjectId),0)+ ");
                    sql.Append(" isnull( (select  COUNT(*) ProjectIdshuliang from  [Projectyouxiao] b  where  a.[Id]=b.[ProjectId] group by b.ProjectId),0)+ ");
                    sql.Append(" isnull( ( select  COUNT(*) ProjectIdshuliang from  [Project] b    where a.[Id]=b.[Id] and b.drhx is not null ),0)+ ");
                    sql.Append(" isnull(  (select  COUNT(*) ProjectIdshuliang from  [Project] b    where  a.[Id]=b.[Id] and b.dshx is not null ),0) ");
                    sql.Append("  ) as sum_count ) a  where a.sum_count    <=  5 ");
                    sql.Append("  ) ");
                }
                else if (searchEntity.Chuanbiaofenxi == "02")
                {
                    sql.Append(" and exists ( select b.[ProjectId] from [Projectzhongbiao] b  where  a.[Id]=b.[ProjectId] and  (b.[defen]-a.[drhx_defen])  >= 20 ) ");
                }
                else if (searchEntity.Chuanbiaofenxi == "03")
                {
                    sql.Append(" and exists ( select b.[ProjectId] from [Projectzhongbiao] b  where  a.[Id]=b.[ProjectId] and  (b.[defen]-a.[drhx_defen])  >= 10 ) ");
                }
            }
            if (!string.IsNullOrWhiteSpace(searchEntity.Reasonname))
@@ -429,6 +455,17 @@
            if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
            {
                sql.Append(" and a.start_time <='" + StartTimestarend.AddDays(1).ToString("yyyy-MM-dd") + "'");
            }
            if (!string.IsNullOrWhiteSpace(searchEntity.KaibiaoTimeStar))
            {
                sql.Append(" and a.start_time >='" + searchEntity.KaibiaoTimeStar + "'");
            }
            if (!string.IsNullOrWhiteSpace(searchEntity.KaibiaoTimeEnd))
            {
                sql.Append(" and a.start_time <='" + searchEntity.KaibiaoTimeEnd + "'");
            }
@@ -544,6 +581,20 @@
                searchEntity.totalrows = query.Count();
            var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
            list = _mapper.Map<List<ProjectDTO>>(lianlist);
            var cgfs = GetCgfs();
           foreach(var projectDTO  in list)
            {
              var cgf =  cgfs.Where(x=>x.Id == projectDTO.Cgfs).FirstOrDefault();
                if (cgf != null)
                {
                    projectDTO.CgfsName = cgf.Name;
                }
            }
            data.LoadData(searchEntity, list);
            return data;
        }