Browse Source

简化和统一审核条件处理

在 `StatisticsController.cs` 中进行了多处修改,主要是为了简化和统一审核条件的处理。新增了 `isAuditSql` 变量,用于存储审核条件的 SQL 语句片段,并在多个 SQL 查询中使用该变量替换了原本直接嵌入的审核条件。这些修改使得代码更加简洁,避免了重复的 SQL 片段,提高了代码的可维护性。
LEIYI 2 months ago
parent
commit
ee6b2ed4c8
1 changed files with 5 additions and 3 deletions
  1. 5 3
      OASystem/OASystem.Api/Controllers/StatisticsController.cs

+ 5 - 3
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -433,6 +433,8 @@ namespace OASystem.API.Controllers
                 #region 团组支出
                 #region 团组支出
                 GroupExpenditureView _geView = new GroupExpenditureView();
                 GroupExpenditureView _geView = new GroupExpenditureView();
 
 
+                var isAuditSql = string.Format($"And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)");
+
                 #region 酒店预定费用
                 #region 酒店预定费用
                 List<GroupHotelFeeView> groupHotelFeeViews = new List<GroupHotelFeeView>();
                 List<GroupHotelFeeView> groupHotelFeeViews = new List<GroupHotelFeeView>();
 
 
@@ -492,7 +494,7 @@ WHERE
   AND ccp.PayMoney <> 0
   AND ccp.PayMoney <> 0
   AND hr.DiId = {0}
   AND hr.DiId = {0}
 ORDER BY
 ORDER BY
-  CheckInDate Asc", _dto.DiId, _dto.isAudit ? "AND (ccp.IsAuditGM = 1 Or ccp.IsAuditGM = 3)" : " ");
+  CheckInDate Asc", _dto.DiId, _dto.isAudit ? isAuditSql : " ");
 
 
                 groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync();
                 groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync();
 
 
@@ -657,7 +659,7 @@ ORDER BY
                                                      Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
                                                      Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
                                                      Left Join Sys_Users u On ccp.CreateUserId = u.Id
                                                      Left Join Sys_Users u On ccp.CreateUserId = u.Id
                                                      Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
                                                      Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
-                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
+                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? isAuditSql : " ");
                 }
                 }
 
 
                 groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync();
                 groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync();
@@ -961,7 +963,7 @@ ORDER BY
                                                          Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
                                                          Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
                                                          Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
                                                          Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
                                                          Left Join Sys_Users u On ccp.CreateUserId = u.Id
                                                          Left Join Sys_Users u On ccp.CreateUserId = u.Id
-                                                         Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                                                         Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? isAuditSql : " ");
 
 
                 groupVisaFeeViews = await _sqlSugar.SqlQueryable<GroupVisaFeeView>(groupVisaFeeSql).ToListAsync();
                 groupVisaFeeViews = await _sqlSugar.SqlQueryable<GroupVisaFeeView>(groupVisaFeeSql).ToListAsync();