Bläddra i källkod

更改日付申请 分页

leiy 1 år sedan
förälder
incheckning
ac0a40b96e

+ 1 - 1
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -72,7 +72,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, result.Msg));
             }
 
-            return Ok(JsonView(data.Data, Convert.ToInt32(data.Rows)));
+            return Ok(JsonView(data));
         }
         /// <summary>
         /// 日付申请 Single Search By Id

+ 1 - 1
OASystem/OASystem.Api/appsettings.json

@@ -105,7 +105,7 @@
   ],
   "ExcelBaseUrl": "http://132.232.92.186:24/",
   "ExcelBasePath": "C:/Server/File/OA2023/Office/Excel/",
-  "OfficeBaseUrl": "http://132.232.92.186/",
+  "OfficeBaseUrl": "http://132.232.92.186:24/",
   "OfficeTempBasePath": "C:/Server/File/OA2023/Office/"
 
 }

+ 2 - 0
OASystem/OASystem.Domain/Dtos/Financial/DailyFeePaymentDto.cs

@@ -23,6 +23,7 @@ namespace OASystem.Domain.Dtos.Financial
         /// 其他Id 公司Id
         /// </summary>
         public int CompanyId { get; set; }
+
         /// <summary>
         /// 财务审核状态
         /// -1 全部/未选择
@@ -66,6 +67,7 @@ namespace OASystem.Domain.Dtos.Financial
         /// 其他Id 员工Id
         /// </summary>
         public int CreateUserId { get; set; }
+
     }
 
     /// <summary>

+ 9 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -15,6 +15,15 @@ namespace OASystem.Domain.ViewModels.Financial
     public class Fin_DailyFeePaymentView:Fin_DailyFeePayment
     {}
 
+
+    public class Fin_DailyFeePaymentPageCount
+    {
+        /// <summary>
+        /// 总条数
+        /// </summary>
+        public int Count { get; set; }
+    }
+
     /// <summary>
     /// 日付申请 分页查询View
     /// </summary>

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -44,7 +44,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                     List<int> NewClientDataId2 = new List<int>();
                     string NewClientDataId = "";
                     int state = 0;
-                    if (dto.Userid != 0)
+                    if ( !string.IsNullOrEmpty(dto.Userid) )
                     {
                         string sql = string.Format(@"select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and u1.UsersId in ({0})", dto.Userid);
                         List<AscribedUser> ascribedUsers = await _sqlSugar.SqlQueryable<AscribedUser>(sql).ToListAsync();

+ 31 - 19
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -4,6 +4,7 @@ using OASystem.Domain.Dtos;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Dtos.UserDto;
 using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.ViewModels;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Infrastructure.Repositories.System;
 using Org.BouncyCastle.Asn1.Cms;
@@ -88,6 +89,11 @@ namespace OASystem.Infrastructure.Repositories.Financial
         {
             Result result = new Result() { Code = -2 };
 
+            ListViewBase<Fin_DailyFeePaymentPageListView> dailyFeePaymentPageList = new ListViewBase<Fin_DailyFeePaymentPageListView>()
+            {
+                ReceiveDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+            };
+
             #region sql条件处理
             string sqlWhere = "";
 
@@ -132,17 +138,9 @@ namespace OASystem.Infrastructure.Repositories.Financial
             if (dto.CreateUserId != -1)
                 sqlWhere += string.Format(" And dfp.CreateUserId = {0}", dto.CreateUserId);
 
-            //string sqlPage = string.Format(@"Select * From (	
-            //                                    Select row_number() over (order by dfp.Id Desc) as RowNumber,
-            //                                        dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
-            //                                        dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
-            //                                        dfp.PriceTypeId
-            //                                    From Fin_DailyFeePayment dfp
-            //                                    Inner Join Sys_Company c On dfp.CompanyId = c.Id
-            //                                    Left Join Sys_Users u On dfp.CreateUserId = u.Id
-            //                                    Where dfp.IsDel=0 {0} 
-            //                                    ) temp Where RowNumber Between {1} and {2} ", sqlWhere, dto.PageIndex, dto.PageSize);
 
+            int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
+            int endIndex = startIndex + dto.PageSize - 1;
 
             string sqlPage = string.Format(@"Select * From (	
                                                 Select row_number() over (order by dfp.Id Desc) as RowNumber,
@@ -153,29 +151,43 @@ namespace OASystem.Infrastructure.Repositories.Financial
                                                 Inner Join Sys_Company c On dfp.CompanyId = c.Id
                                                 Left Join Sys_Users u On dfp.CreateUserId = u.Id
                                                 Where dfp.IsDel=0 {0} 
+                                                ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
+
+
+            string sqlCount = string.Format(@"Select COUNT(1) as Count From (	
+                                                Select dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
+                                                       dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
+                                                       dfp.PriceTypeId
+                                                From Fin_DailyFeePayment dfp
+                                                Inner Join Sys_Company c On dfp.CompanyId = c.Id
+                                                Left Join Sys_Users u On dfp.CreateUserId = u.Id
+                                                Where dfp.IsDel=0 {0} 
                                                 ) temp ", sqlWhere);
             #endregion
 
-            dynamic? DailyFeePaymentList = null;
+           
             if (dto.PortType == 1 || dto.PortType == 2) //web
             {
+                //Fin_DailyFeePaymentPageCount
+                var dailyFeePaymentCount = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentPageCount>(sqlCount).FirstAsync();
                 var DailyFeePaymentData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentPageListView>(sqlPage).ToListAsync();
 
-                int totalCount = DailyFeePaymentData.Count;
+                int totalCount = dailyFeePaymentCount.Count;
+                
 
-                int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
-                int endIndex = startIndex + dto.PageSize;
-
-                DailyFeePaymentList = new Fin_DailyFeePaymentPage
+                dailyFeePaymentPageList = new ListViewBase<Fin_DailyFeePaymentPageListView>
                 {
-                    Rows = totalCount,
-                    Data = DailyFeePaymentData.Where(a => a.RowNumber >= startIndex && a.RowNumber < endIndex).ToList()
+                    CurrPageIndex = dto.PageIndex,
+                    CurrPageSize = dto.PageSize,
+                    DataCount = totalCount,
+                    DataList = DailyFeePaymentData
                 };
+
             }
 
             result.Code = 0;
             result.Msg = "查询成功!";
-            result.Data = DailyFeePaymentList;
+            result.Data = dailyFeePaymentPageList;
             return result;
 
         }