Bladeren bron

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

leiy 1 jaar geleden
bovenliggende
commit
229127b630

+ 3 - 0
OASystem/OASystem.Domain/Dtos/Groups/InvitationOfficialActivitiesListDto.cs

@@ -15,6 +15,9 @@ namespace OASystem.Domain.Dtos.Groups
         public string Inviter { get; set; }
         public string StartInviteTime { get; set; }
         public string EndInviteTime { get; set; }
+
+        public int PageIndex { get; set; } = 1;
+        public int PageSize { get; set; } = 10;
     }
     /// <summary>
     /// 根据id查询C表数据和商邀费用数据

+ 34 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -10,6 +10,7 @@ using OASystem.Domain.ViewModels.Groups;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -87,10 +88,42 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 List<InvitationOfficialActivitiesView> _DecreasePayments = await _sqlSugar.SqlQueryable<InvitationOfficialActivitiesView>(sql).ToListAsync();
                 if (_DecreasePayments.Count != 0)
                 {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
+                    if (dto.PageIndex != 0 && dto.PageSize != 0)
+                    {
+
+                        int count = _DecreasePayments.Count;
+                        float totalPage = (float)count / dto.PageSize;//总页数
+                        if (totalPage == 0) totalPage = 1;
+                        else totalPage = (int)Math.Ceiling((double)totalPage);
+
+                        List<InvitationOfficialActivitiesView> invitationOfficialActivities = new List<InvitationOfficialActivitiesView>();
+                        for (int i = 0; i < dto.PageSize; i++)
+                        {
+                            var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
+                            if (RowIndex < _DecreasePayments.Count)
+                            {
+                                invitationOfficialActivities.Add(_DecreasePayments[RowIndex]);
+                            }
+                            else
+                            {
+                                break;
+                            }
+                        }
+                        ListViewBase<InvitationOfficialActivitiesView> rst = new ListViewBase<InvitationOfficialActivitiesView>();
+                        rst.DataList = invitationOfficialActivities;
+                        rst.DataCount = count;
+                        rst.CurrPageIndex = dto.PageIndex;
+                        rst.CurrPageSize = dto.PageSize;
+                        return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
+                    }
+                    else
+                    {
+                        return result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
+                    }
                 }
                 else
                 {
+
                     result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
                 }
             }