优化分页统一返回

This commit is contained in:
不做码农 2021-11-28 11:11:34 +08:00
parent 79b3c306f9
commit 8dc832cdbd
37 changed files with 145 additions and 357 deletions

View File

@ -4,6 +4,10 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Model\PagedInfo.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AspectCore.Abstractions" Version="2.2.0" /> <PackageReference Include="AspectCore.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" /> <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />

View File

@ -19,7 +19,7 @@ using ZR.Common;
using ZR.Model; using ZR.Model;
using ZR.Model.System.Dto; using ZR.Model.System.Dto;
using ZR.Model.System.Generate; using ZR.Model.System.Generate;
using ZR.Model.Vo; using ZR.Service;
using ZR.Service.System.IService; using ZR.Service.System.IService;
namespace ZR.Admin.WebApi.Controllers namespace ZR.Admin.WebApi.Controllers
@ -72,9 +72,8 @@ namespace ZR.Admin.WebApi.Controllers
public IActionResult FindListTable(string dbName, string tableName, PagerInfo pager) public IActionResult FindListTable(string dbName, string tableName, PagerInfo pager)
{ {
List<DbTableInfo> list = _CodeGeneraterService.GetAllTables(dbName, tableName, pager); List<DbTableInfo> list = _CodeGeneraterService.GetAllTables(dbName, tableName, pager);
var vm = new VMPageResult<DbTableInfo>(list, pager);
return SUCCESS(vm); return SUCCESS(list.ToPage(pager));
} }
/// <summary> /// <summary>

View File

@ -38,10 +38,8 @@ namespace ZR.Admin.WebApi.Controllers.System
[HttpGet("list")] [HttpGet("list")]
public IActionResult List([FromQuery] SysDictData dictData, [FromQuery] PagerInfo pagerInfo) public IActionResult List([FromQuery] SysDictData dictData, [FromQuery] PagerInfo pagerInfo)
{ {
var list = SysDictDataService.SelectDictDataList(dictData); var list = SysDictDataService.SelectDictDataList(dictData, pagerInfo);
pagerInfo.TotalNum = list.Count; return SUCCESS(list);
var vm = new VMPageResult<SysDictData>(list, pagerInfo);
return SUCCESS(vm);
} }
/// <summary> /// <summary>
@ -107,7 +105,7 @@ namespace ZR.Admin.WebApi.Controllers.System
[HttpDelete("{dictCode}")] [HttpDelete("{dictCode}")]
public IActionResult Remove(string dictCode) public IActionResult Remove(string dictCode)
{ {
long[] dictCodes = ZR.Common.Tools.SpitLongArrary(dictCode); long[] dictCodes = Common.Tools.SpitLongArrary(dictCode);
return SUCCESS(SysDictDataService.DeleteDictDataByIds(dictCodes)); return SUCCESS(SysDictDataService.DeleteDictDataByIds(dictCodes));
} }

View File

@ -38,8 +38,7 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
var list = SysDictService.SelectDictTypeList(dict, pagerInfo); var list = SysDictService.SelectDictTypeList(dict, pagerInfo);
var vm = new VMPageResult<SysDictType>(list, pagerInfo); return SUCCESS(list, TIME_FORMAT_FULL);
return SUCCESS(vm, TIME_FORMAT_FULL);
} }
/// <summary> /// <summary>

View File

@ -11,7 +11,7 @@ using System.IO;
using ZR.Admin.WebApi.Filters; using ZR.Admin.WebApi.Filters;
using ZR.Model; using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
using ZR.Model.Vo; using ZR.Service;
using ZR.Service.System.IService; using ZR.Service.System.IService;
namespace ZR.Admin.WebApi.Controllers.System namespace ZR.Admin.WebApi.Controllers.System
@ -53,9 +53,7 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
var list = UserService.SelectUserList(user, pager); var list = UserService.SelectUserList(user, pager);
var vm = new VMPageResult<SysUser>(list, pager); return SUCCESS(list.ToPage(pager), TIME_FORMAT_FULL);
return SUCCESS(vm, TIME_FORMAT_FULL);
} }
/// <summary> /// <summary>

View File

@ -38,9 +38,8 @@ namespace ZR.Admin.WebApi.Controllers.monitor
public IActionResult LoignLogList([FromQuery] SysLogininfor sysLogininfoDto, [FromQuery] PagerInfo pagerInfo) public IActionResult LoignLogList([FromQuery] SysLogininfor sysLogininfoDto, [FromQuery] PagerInfo pagerInfo)
{ {
var list = sysLoginService.GetLoginLog(sysLogininfoDto, pagerInfo); var list = sysLoginService.GetLoginLog(sysLogininfoDto, pagerInfo);
var vMPage = new VMPageResult<SysLogininfor>(list, pagerInfo);
return ToResponse(ToJson(vMPage.TotalNum, vMPage), TIME_FORMAT_FULL_2); return ToResponse(ToJson(list.Count, list.ToPage(pagerInfo)), TIME_FORMAT_FULL_2);
} }
/// <summary> /// <summary>

View File

@ -41,9 +41,8 @@ namespace ZR.Admin.WebApi.Controllers.monitor
PagerInfo pagerInfo = new PagerInfo(sysOperLog.pageNum); PagerInfo pagerInfo = new PagerInfo(sysOperLog.pageNum);
var list = sysOperLogService.SelectOperLogList(sysOperLog, pagerInfo); var list = sysOperLogService.SelectOperLogList(sysOperLog, pagerInfo);
var vMPage = new VMPageResult<SysOperLog>(list, pagerInfo);
return ToResponse(ToJson(vMPage.TotalNum, vMPage), TIME_FORMAT_FULL_2); return ToResponse(ToJson(list.TotalNum, list), TIME_FORMAT_FULL_2);
} }
/// <summary> /// <summary>
@ -84,7 +83,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor
public IActionResult Export([FromQuery] SysOperLogDto sysOperLog) public IActionResult Export([FromQuery] SysOperLogDto sysOperLog)
{ {
var list = sysOperLogService.SelectOperLogList(sysOperLog, new PagerInfo(1, 10000)); var list = sysOperLogService.SelectOperLogList(sysOperLog, new PagerInfo(1, 10000));
string sFileName = ExportExcel(list, "operlog", "操作日志"); string sFileName = ExportExcel(list.Result, "operlog", "操作日志");
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName }); return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
} }

View File

@ -1,103 +0,0 @@
using Newtonsoft.Json;
using System.ComponentModel;
namespace ZRModel
{
/// <summary>
/// 通用json格式实体返回类
/// Author by zhaorui
/// </summary>
public class ApiResult
{
public int Code { get; set; }
public string Msg { get; set; }
/// <summary>
/// 如果data值为null则忽略序列化将不会返回data字段
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public object Data { get; set; }
public ApiResult()
{
Code = 0;
Msg = "fail";
}
public ApiResult OnSuccess()
{
Code = 100;
Msg = "success";
return this;
}
public ApiResult(int code, string msg, object data = null)
{
Code = code;
Msg = msg;
Data = data;
}
public ApiResult OnSuccess(object data = null)
{
Code = (int)ResultCode.SUCCESS;
Msg = "SUCCESS";
Data = data;
return this;
}
/// <summary>
/// 返回成功消息
/// </summary>
/// <param name="data">数据对象</param>
/// <returns>成功消息</returns>
public static ApiResult Success(object data) { return new ApiResult(100, "success", data); }
/// <summary>
/// 返回成功消息
/// </summary>
/// <param name="msg">返回内容</param>
/// <returns>成功消息</returns>
public static ApiResult Success(string msg) { return new ApiResult(100, msg, null); }
/// <summary>
/// 返回成功消息
/// </summary>
/// <param name="msg">返回内容</param>
/// <param name="data">数据对象</param>
/// <returns>成功消息</returns>
public static ApiResult Success(string msg, object data) { return new ApiResult(100, msg, data); }
/// <summary>
/// 返回失败消息
/// </summary>
/// <param name="code"></param>
/// <param name="msg"></param>
/// <returns></returns>
public static ApiResult Error(int code, string msg) { return new ApiResult(code, msg); }
/// <summary>
/// 返回失败消息
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public static ApiResult Error(string msg) { return new ApiResult(200, msg); }
}
public enum ResultCode
{
[Description("success")]
SUCCESS = 100,
[Description("参数错误")]
PARAM_ERROR = 101,
[Description("自定义错误")]
CUSTOM_ERROR = 200,
FAIL = 0,
[Description("程序出错啦")]
GLOBAL_ERROR = 104,
[Description("请先绑定手机号")]
NOBIND_PHONENUM = 102,
[Description("授权失败")]
OAUTH_FAIL = 201,
[Description("未授权")]
DENY = 401
}
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
namespace ZR.Model
{
/// <summary>
/// 分页扩展
/// </summary>
public static class PageExtension
{
/// <summary>
/// 读取列表
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source"></param>
/// <param name="parm"></param>
/// <returns></returns>
public static PagedInfo<T> ToPage<T>(this List<T> source, PagerInfo parm)
{
var page = new PagedInfo<T>
{
TotalPage = parm.TotalPage,
TotalNum = parm.TotalNum,
PageSize = parm.PageSize,
PageIndex = parm.PageNum,
Result = source
};
return page;
}
}
}

View File

@ -1,50 +0,0 @@

namespace ZRModel
{
/// <summary>
/// 获取配置文件POCO实体类
/// </summary>
public class OptionsSetting
{
/// <summary>
/// 1、喵播 2、fireStar
/// </summary>
public int Platform { get; set; }
public string AppName { get; set; }
public string Redis { get; set; }
public string Conn_Live { get; set; }
public string Conn_Admin { get; set; }
/// <summary>
/// mongodb连接字符串
/// </summary>
public string Mongo_Conn { get; set; }
public string Database { get; set; }
public LoggingOptions Logging { get; set; }
public MailOptions MailOptions { get; set; }
}
/// <summary>
/// 发送邮件数据配置
/// </summary>
public class MailOptions
{
public string From { get; set; }
public string Password { get; set; }
public string Host { get; set; }
public int Port { get; set; }
}
/// <summary>
/// 日志
/// </summary>
public class LoggingOptions
{
public LogLevelOptions LogLevel { get; set; }
}
public class LogLevelOptions
{
public string Default { get; set; }
public string Ssytem { get; set; }
public string Microsoft { get; set; }
}
}

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Infrastructure.Model namespace ZR.Model
{ {
/// <summary> /// <summary>
/// 分页参数 /// 分页参数
@ -20,34 +20,33 @@ namespace Infrastructure.Model
/// <summary> /// <summary>
/// 排序列 /// 排序列
/// </summary> /// </summary>
//public string Sort { get; set; } public string Sort { get; set; }
/// <summary> /// <summary>
/// 排序类型 /// 排序类型
/// </summary> /// </summary>
//public string SortType { get; set; } public string SortType { get; set; }
/// <summary> /// <summary>
/// 总记录数 /// 总记录数
/// </summary> /// </summary>
public int TotalCount { get; set; } public int TotalNum { get; set; }
/// <summary> /// <summary>
/// 总页数 /// 总页数
/// </summary> /// </summary>
//public int TotalPage public int TotalPage
//{ {
// get get
// { {
// if (TotalCount > 0) if (TotalNum > 0)
// { {
// return TotalCount % this.PageSize == 0 ? TotalCount / this.PageSize : TotalCount / this.PageSize + 1; return TotalNum % this.PageSize == 0 ? TotalNum / this.PageSize : TotalNum / this.PageSize + 1;
// } }
// else else
// { {
// return 0; return 0;
// } }
// } }
// set { } set { }
//} }
public int TotalPage { get; set; }
public List<T> Result { get; set; } public List<T> Result { get; set; }
public PagedInfo() public PagedInfo()
@ -59,8 +58,8 @@ namespace Infrastructure.Model
{ {
PageIndex = pageIndex; PageIndex = pageIndex;
PageSize = pageSize; PageSize = pageSize;
TotalCount = source.Count; TotalNum = source.Count;
TotalPage = (int)Math.Ceiling(TotalCount / (double)PageSize);//计算总页数 TotalPage = (int)Math.Ceiling(TotalNum / (double)PageSize);//计算总页数
} }
} }

View File

@ -18,9 +18,20 @@ namespace ZR.Model
/// <summary> /// <summary>
/// 总页码 /// 总页码
/// </summary> /// </summary>
public int TotalPageNum { get; set; } /// <summary>
/// 总页数
/// </summary>
public int TotalPage
{
get
{
return TotalNum > 0 ? TotalNum % PageSize == 0 ? TotalNum / PageSize : TotalNum / PageSize + 1 : 0;
}
set { }
}
public int PageSize { get => pageSize; set => pageSize = value; } public int PageSize { get => pageSize; set => pageSize = value; }
public string Sort { get; set; }
public string OrderBy { get; set; }
public PagerInfo() public PagerInfo()
{ {
PageNum = 1; PageNum = 1;

View File

@ -1,53 +0,0 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Data;
namespace ZR.Model.Vo
{
public class VMPageResult<T> where T : new()
{
public int Page { get; set; }
public int PageSize { get; set; }
public long TotalNum { get; set; }
//public int TotalPages { get; set; }
public IList<T> Result { get; set; }
public long EndPage { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DataTable Data { get; set; }
public VMPageResult()
{
}
/// <summary>
/// 集合使用
/// </summary>
/// <param name="result"></param>
/// <param name="pagerInfo"></param>
public VMPageResult(IList<T> result, PagerInfo pagerInfo)
{
this.Result = result;
this.TotalNum = pagerInfo.TotalNum;
this.PageSize = pagerInfo.PageSize;
this.Page = pagerInfo.PageNum;
//计算
this.EndPage = pagerInfo.TotalNum % PageSize == 0 ? pagerInfo.TotalNum / PageSize : pagerInfo.TotalNum / PageSize + 1;
}
/// <summary>
/// datable使用
/// </summary>
/// <param name="result"></param>
/// <param name="pagerInfo"></param>
public VMPageResult(DataTable result, PagerInfo pagerInfo)
{
this.Data = result;
this.TotalNum = pagerInfo.TotalNum;
this.PageSize = pagerInfo.PageSize;
this.Page = pagerInfo.PageNum;
//计算
this.EndPage = pagerInfo.TotalNum % PageSize == 0 ? pagerInfo.TotalNum / PageSize : pagerInfo.TotalNum / PageSize + 1;
}
}
}

View File

@ -4,11 +4,6 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="ApiResult.cs" />
<Compile Remove="OptionsSetting.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4.3" /> <PackageReference Include="SqlSugarCoreNoDrive" Version="5.0.4.3" />
@ -18,6 +13,7 @@
<ItemGroup> <ItemGroup>
<Folder Include="Dto\" /> <Folder Include="Dto\" />
<Folder Include="Enum\" /> <Folder Include="Enum\" />
<Folder Include="Vo\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -391,13 +391,13 @@ namespace ZR.Repository
public static PagedInfo<T> ToPage<T>(this ISugarQueryable<T> source, PagerInfo parm) public static PagedInfo<T> ToPage<T>(this ISugarQueryable<T> source, PagerInfo parm)
{ {
var page = new PagedInfo<T>(); var page = new PagedInfo<T>();
var total = source.Count(); var total = 0;
page.TotalCount = total;
page.PageSize = parm.PageSize; page.PageSize = parm.PageSize;
page.PageIndex = parm.PageNum; 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.OrderByIF(!string.IsNullOrEmpty(parm.Sort), $"{parm.OrderBy} {(parm.Sort == "desc" ? "desc" : "asc")}")
page.Result = source.ToPageList(parm.PageNum, parm.PageSize); .ToPageList(parm.PageNum, parm.PageSize, ref total);
page.TotalNum = total;
return page; return page;
} }

View File

@ -1,6 +1,9 @@
using Infrastructure.Attribute; using Infrastructure.Attribute;
using Infrastructure.Model;
using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
namespace ZR.Repository.System namespace ZR.Repository.System
@ -15,14 +18,15 @@ namespace ZR.Repository.System
/// 字典类型数据搜索 /// 字典类型数据搜索
/// </summary> /// </summary>
/// <param name="dictData"></param> /// <param name="dictData"></param>
/// <param name="pagerInfo"></param>
/// <returns></returns> /// <returns></returns>
public List<SysDictData> SelectDictDataList(SysDictData dictData) public PagedInfo<SysDictData> SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo)
{ {
return Context.Queryable<SysDictData>() var exp = Expressionable.Create<SysDictData>();
.WhereIF(!string.IsNullOrEmpty(dictData.DictLabel), it => it.DictLabel.Contains(dictData.DictLabel)) exp.AndIF(!string.IsNullOrEmpty(dictData.DictLabel), it => it.DictLabel.Contains(dictData.DictLabel));
.WhereIF(!string.IsNullOrEmpty(dictData.Status), it => it.Status == dictData.Status) exp.AndIF(!string.IsNullOrEmpty(dictData.Status), it => it.Status == dictData.Status);
.WhereIF(!string.IsNullOrEmpty(dictData.DictType), it => it.DictType == dictData.DictType) exp.AndIF(!string.IsNullOrEmpty(dictData.DictType), it => it.DictType == dictData.DictType);
.ToList(); return GetPages(exp.ToExpression(), pagerInfo);
} }
/// <summary> /// <summary>

View File

@ -1,7 +1,7 @@
using Infrastructure.Attribute; using Infrastructure.Attribute;
using System; using SqlSugar;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
namespace ZR.Repository.System namespace ZR.Repository.System
@ -22,17 +22,14 @@ namespace ZR.Repository.System
/// </summary> /// </summary>
/// <param name="dictType">实体模型</param> /// <param name="dictType">实体模型</param>
/// <returns></returns> /// <returns></returns>
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager) public PagedInfo<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager)
{ {
var totalNum = 0; var exp = Expressionable.Create<SysDictType>();
var list = Context exp.AndIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName));
.Queryable<SysDictType>() exp.AndIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status);
.WhereIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName)) exp.AndIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType == dictType.DictType);
.WhereIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status)
.WhereIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType == dictType.DictType) return GetPages(exp.ToExpression(), pager);
.ToPageList(pager.PageNum, pager.PageSize, ref totalNum);
pager.TotalNum = totalNum;
return list;
} }
/// <summary> /// <summary>

View File

@ -4,6 +4,8 @@ using System.Collections.Generic;
using ZR.Model; using ZR.Model;
using ZR.Model.System.Dto; using ZR.Model.System.Dto;
using ZR.Model.System; using ZR.Model.System;
using SqlSugar;
using Infrastructure.Model;
namespace ZR.Repository.System namespace ZR.Repository.System
{ {
@ -16,19 +18,16 @@ namespace ZR.Repository.System
/// <param name="sysOper"></param> /// <param name="sysOper"></param>
/// <param name="pagerInfo">分页数据</param> /// <param name="pagerInfo">分页数据</param>
/// <returns></returns> /// <returns></returns>
public List<SysOperLog> GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo) public PagedInfo<SysOperLog> GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo)
{ {
int totalCount = 0; var exp = Expressionable.Create<SysOperLog>();
var list = Context.Queryable<SysOperLog>() exp.And(it => it.operTime >= sysOper.BeginTime && it.operTime <= sysOper.EndTime);
.Where(it => it.operTime >= sysOper.BeginTime && it.operTime <= sysOper.EndTime) exp.AndIF(sysOper.Title.IfNotEmpty(), it => it.title.Contains(sysOper.Title));
.WhereIF(sysOper.Title.IfNotEmpty(), it => it.title.Contains(sysOper.Title)) exp.AndIF(sysOper.operName.IfNotEmpty(), it => it.operName.Contains(sysOper.operName));
.WhereIF(sysOper.operName.IfNotEmpty(), it => it.operName.Contains(sysOper.operName)) exp.AndIF(sysOper.BusinessType != -1, it => it.businessType == sysOper.BusinessType);
.WhereIF(sysOper.BusinessType != -1, it =>it.businessType == sysOper.BusinessType) exp.AndIF(sysOper.Status != -1, it => it.status == sysOper.Status);
.WhereIF(sysOper.Status != -1, it => it.status == sysOper.Status)
.OrderBy(it => it.OperId, SqlSugar.OrderByType.Desc) return GetPages(exp.ToExpression(), pagerInfo, x => x.OperId, OrderByType.Desc);
.ToPageList(pagerInfo.PageNum, pagerInfo.PageSize, ref totalCount);
pagerInfo.TotalNum = totalCount;
return list;
} }
/// <summary> /// <summary>

View File

@ -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;
}
}
}

View File

@ -1,11 +1,10 @@
using Infrastructure.Attribute; using Infrastructure.Attribute;
using Infrastructure.Extensions; using Infrastructure.Extensions;
using Infrastructure.Model;
using Newtonsoft.Json;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using ZR.Model;
using ZR.Model.System.Generate; using ZR.Model.System.Generate;
using ZR.Repository.System; using ZR.Repository.System;
using ZR.Service.System.IService; using ZR.Service.System.IService;

View File

@ -1,9 +1,5 @@
using Infrastructure.Model; using System.Collections.Generic;
using System; using ZR.Model;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.System.Generate; using ZR.Model.System.Generate;
namespace ZR.Service.System.IService namespace ZR.Service.System.IService

View File

@ -1,13 +1,15 @@
using System; using Infrastructure.Model;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
namespace ZR.Service.System.IService namespace ZR.Service.System.IService
{ {
public interface ISysDictDataService public interface ISysDictDataService
{ {
public List<SysDictData> SelectDictDataList(SysDictData dictData); public PagedInfo<SysDictData> SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo);
public List<SysDictData> SelectDictDataByType(string dictType); public List<SysDictData> SelectDictDataByType(string dictType);
public SysDictData SelectDictDataById(long dictCode); public SysDictData SelectDictDataById(long dictCode);
public long InsertDictData(SysDictData dict); public long InsertDictData(SysDictData dict);

View File

@ -1,6 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text; using System.Text;
using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
namespace ZR.Service.System.IService namespace ZR.Service.System.IService
@ -11,7 +11,7 @@ namespace ZR.Service.System.IService
public interface ISysDictService public interface ISysDictService
{ {
public List<SysDictType> GetAll(); public List<SysDictType> GetAll();
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager); public PagedInfo<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
/// <summary> /// <summary>
/// 校验字典类型称是否唯一 /// 校验字典类型称是否唯一

View File

@ -3,6 +3,7 @@ using ZR.Model;
using ZR.Model.System.Dto; using ZR.Model.System.Dto;
using ZR.Model.System; using ZR.Model.System;
using ZR.Service.System; using ZR.Service.System;
using Infrastructure.Model;
namespace ZR.Service.System.IService namespace ZR.Service.System.IService
{ {
@ -16,7 +17,7 @@ namespace ZR.Service.System.IService
/// <param name="operLog">操作日志对象</param> /// <param name="operLog">操作日志对象</param>
/// <param name="pager"></param> /// <param name="pager"></param>
/// <returns>操作日志集合</returns> /// <returns>操作日志集合</returns>
public List<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager); public PagedInfo<SysOperLog> SelectOperLogList(SysOperLogDto operLog, PagerInfo pager);
/// <summary> /// <summary>
/// 清空操作日志 /// 清空操作日志

View File

@ -1,8 +1,5 @@
using Infrastructure.Model; using System.Collections.Generic;
using System; using ZR.Model;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZR.Model.System; using ZR.Model.System;
namespace ZR.Service.System.IService namespace ZR.Service.System.IService

View File

@ -1,8 +1,10 @@
using Infrastructure.Attribute; using Infrastructure.Attribute;
using Infrastructure.Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ZR.Common; using ZR.Common;
using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
using ZR.Repository.System; using ZR.Repository.System;
using ZR.Service.System.IService; using ZR.Service.System.IService;
@ -27,9 +29,9 @@ namespace ZR.Service.System
/// </summary> /// </summary>
/// <param name="dictData"></param> /// <param name="dictData"></param>
/// <returns></returns> /// <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> /// <summary>

View File

@ -1,8 +1,8 @@
using Infrastructure; using Infrastructure;
using Infrastructure.Attribute; using Infrastructure.Attribute;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using ZR.Model;
using ZR.Model.System; using ZR.Model.System;
using ZR.Repository.System; using ZR.Repository.System;
using ZR.Service.System.IService; using ZR.Service.System.IService;
@ -33,7 +33,7 @@ namespace ZR.Service.System
/// </summary> /// </summary>
/// <param name="dictType">实体模型</param> /// <param name="dictType">实体模型</param>
/// <returns></returns> /// <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); return DictRepository.SelectDictTypeList(dictType, pager);
} }

View File

@ -6,6 +6,7 @@ using ZR.Model.System;
using ZR.Repository.System; using ZR.Repository.System;
using ZR.Service.System.IService; using ZR.Service.System.IService;
using Infrastructure; using Infrastructure;
using Infrastructure.Model;
namespace ZR.Service.System namespace ZR.Service.System
{ {
@ -37,7 +38,7 @@ namespace ZR.Service.System
/// <param name="operLog">操作日志对象</param> /// <param name="operLog">操作日志对象</param>
/// <param name="pager"></param> /// <param name="pager"></param>
/// <returns>操作日志集合</returns> /// <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.BeginTime = DateTimeHelper.GetBeginTime(operLog.BeginTime, -1);
operLog.EndTime = DateTimeHelper.GetBeginTime(operLog.EndTime, 1); operLog.EndTime = DateTimeHelper.GetBeginTime(operLog.EndTime, 1);

View File

@ -28,7 +28,7 @@ service.interceptors.request.use(config => {
//将token放到请求头发送给服务器,将tokenkey放在请求头中 //将token放到请求头发送给服务器,将tokenkey放在请求头中
config.headers.Token = getToken(); config.headers.Token = getToken();
} else { } else {
console.log(config) // console.log(config)
} }
return config; return config;
}, error => { }, error => {

View File

@ -204,7 +204,7 @@ export default {
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(res => { listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.dataList = res.data.result; this.dataList = res.data.result;
this.total = res.data.totalCount; this.total = res.data.totalNum;
} }
}) })
}, },

View File

@ -12,7 +12,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@ -291,7 +291,7 @@ export default {
this.loading = true; this.loading = true;
queryTasks(this.queryParams).then((response) => { queryTasks(this.queryParams).then((response) => {
this.dataTasks = response.data.result; this.dataTasks = response.data.result;
this.total = response.data.totalCount; this.total = response.data.totalNum;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -161,7 +161,7 @@ export default {
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then( listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => { (response) => {
this.jobLogList = response.data.result; this.jobLogList = response.data.result;
this.total = response.data.totalCount; this.total = response.data.totalNum;
this.loading = false; this.loading = false;
} }
); );

View File

@ -100,7 +100,7 @@ export default {
listArticle(this.queryParams).then((res) => { listArticle(this.queryParams).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.dataList = res.data.result; this.dataList = res.data.result;
this.total = res.data.totalCount; this.total = res.data.totalNum;
} }
}); });
}, },

View File

@ -170,7 +170,7 @@ export default {
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then( listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => { (response) => {
this.configList = response.data.result; this.configList = response.data.result;
this.total = response.data.totalCount; this.total = response.data.totalNum;
this.loading = false; this.loading = false;
} }
); );

View File

@ -160,7 +160,7 @@ export default {
this.loading = true; this.loading = true;
listPost(this.queryParams).then((response) => { listPost(this.queryParams).then((response) => {
this.postList = response.data.result; this.postList = response.data.result;
this.total = response.data.totalCount; this.total = response.data.totalNum;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -151,7 +151,7 @@ export default {
getGenTable(this.queryParams).then((res) => { getGenTable(this.queryParams).then((res) => {
this.tableData = res.data.result; this.tableData = res.data.result;
this.total = res.data.totalCount; this.total = res.data.totalNum;
this.tableloading = false; this.tableloading = false;
}); });
}, },