优化分页统一返回
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
|
||||
using Infrastructure.Model;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Vo;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
public static class QueryableExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 读取列表
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public static PagedInfo<T> ToPage<T>(this ISugarQueryable<T> source, PagerInfo parm)
|
||||
{
|
||||
var page = new PagedInfo<T>();
|
||||
var total = source.Count();
|
||||
page.TotalCount = total;
|
||||
page.PageSize = parm.PageSize;
|
||||
page.PageIndex = parm.PageNum;
|
||||
|
||||
//page.DataSource = source.OrderByIF(!string.IsNullOrEmpty(parm.Sort), $"{parm.OrderBy} {(parm.Sort == "descending" ? "desc" : "asc")}").ToPageList(parm.PageNum, parm.PageSize);
|
||||
page.Result = source.ToPageList(parm.PageNum, parm.PageSize);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Model;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System.Generate;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Infrastructure.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System.Generate;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
using Infrastructure.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysDictDataService
|
||||
{
|
||||
public List<SysDictData> SelectDictDataList(SysDictData dictData);
|
||||
public PagedInfo<SysDictData> SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo);
|
||||
public List<SysDictData> SelectDictDataByType(string dictType);
|
||||
public SysDictData SelectDictDataById(long dictCode);
|
||||
public long InsertDictData(SysDictData dict);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
@@ -11,7 +11,7 @@ namespace ZR.Service.System.IService
|
||||
public interface ISysDictService
|
||||
{
|
||||
public List<SysDictType> GetAll();
|
||||
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
|
||||
public PagedInfo<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
|
||||
|
||||
/// <summary>
|
||||
/// 校验字典类型称是否唯一
|
||||
|
||||
@@ -3,6 +3,7 @@ using ZR.Model;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.System;
|
||||
using Infrastructure.Model;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
@@ -16,7 +17,7 @@ namespace ZR.Service.System.IService
|
||||
/// <param name="operLog">操作日志对象</param>
|
||||
/// <param name="pager"></param>
|
||||
/// <returns>操作日志集合</returns>
|
||||
public List<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager);
|
||||
public PagedInfo<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager);
|
||||
|
||||
/// <summary>
|
||||
/// 清空操作日志
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Infrastructure.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Common;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
@@ -27,9 +29,9 @@ namespace ZR.Service.System
|
||||
/// </summary>
|
||||
/// <param name="dictData"></param>
|
||||
/// <returns></returns>
|
||||
public List<SysDictData> SelectDictDataList(SysDictData dictData)
|
||||
public PagedInfo<SysDictData> SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo)
|
||||
{
|
||||
return SysDictDataRepository.SelectDictDataList(dictData);
|
||||
return SysDictDataRepository.SelectDictDataList(dictData, pagerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
@@ -33,7 +33,7 @@ namespace ZR.Service.System
|
||||
/// </summary>
|
||||
/// <param name="dictType">实体模型</param>
|
||||
/// <returns></returns>
|
||||
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager)
|
||||
public PagedInfo<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager)
|
||||
{
|
||||
return DictRepository.SelectDictTypeList(dictType, pager);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Model;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
@@ -37,7 +38,7 @@ namespace ZR.Service.System
|
||||
/// <param name="operLog">操作日志对象</param>
|
||||
/// <param name="pager"></param>
|
||||
/// <returns>操作日志集合</returns>
|
||||
public List<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager)
|
||||
public PagedInfo<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager)
|
||||
{
|
||||
operLog.BeginTime = DateTimeHelper.GetBeginTime(operLog.BeginTime, -1);
|
||||
operLog.EndTime = DateTimeHelper.GetBeginTime(operLog.EndTime, 1);
|
||||
|
||||
Reference in New Issue
Block a user