From 8dc832cdbde5a1052cda7f608bf2652c166dfb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sun, 28 Nov 2021 11:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E9=A1=B5=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Infrastructure.csproj | 4 + .../Controllers/CodeGeneratorController.cs | 5 +- .../System/SysDictDataController.cs | 8 +- .../System/SysDictTypeController.cs | 3 +- .../Controllers/System/SysUserController.cs | 6 +- .../System/monitor/SysLogininforController.cs | 3 +- .../System/monitor/SysOperlogController.cs | 5 +- ZR.Model/ApiResult.cs | 103 ------------------ ZR.Model/Extensions/QueryableExtension.cs | 30 +++++ ZR.Model/OptionsSetting.cs | 50 --------- .../Model => ZR.Model}/PagedInfo.cs | 43 ++++---- ZR.Model/PagerInfo.cs | 15 ++- ZR.Model/Vo/VMPageResult.cs | 53 --------- ZR.Model/ZR.Model.csproj | 6 +- ZR.Repository/BaseRepository.cs | 8 +- ZR.Repository/System/SysDictDataRepository.cs | 16 ++- ZR.Repository/System/SysDictRepository.cs | 21 ++-- ZR.Repository/System/SysOperLogRepository.cs | 23 ++-- ZR.Service/Extensions/QueryableExtension.cs | 36 ------ ZR.Service/System/GenTableService.cs | 3 +- .../System/IService/IGenTableService.cs | 8 +- .../System/IService/ISysDictDataService.cs | 6 +- ZR.Service/System/IService/ISysDictService.cs | 6 +- .../System/IService/ISysOperLogService.cs | 3 +- ZR.Service/System/IService/ISysRoleService.cs | 7 +- ZR.Service/System/SysDictDataService.cs | 6 +- ZR.Service/System/SysDictService.cs | 4 +- ZR.Service/System/SysOperLogService.cs | 3 +- ZR.Vue/src/utils/request.js | 2 +- ZR.Vue/src/views/business/gendemo/index.vue | 2 +- ZR.Vue/src/views/components/dictData.vue | 2 +- ZR.Vue/src/views/monitor/job/index.vue | 2 +- ZR.Vue/src/views/monitor/job/log.vue | 2 +- ZR.Vue/src/views/system/article/manager.vue | 2 +- ZR.Vue/src/views/system/config/index.vue | 2 +- ZR.Vue/src/views/system/post/index.vue | 2 +- ZR.Vue/src/views/tool/gen/index.vue | 2 +- 37 files changed, 145 insertions(+), 357 deletions(-) delete mode 100644 ZR.Model/ApiResult.cs create mode 100644 ZR.Model/Extensions/QueryableExtension.cs delete mode 100644 ZR.Model/OptionsSetting.cs rename {Infrastructure/Model => ZR.Model}/PagedInfo.cs (55%) delete mode 100644 ZR.Model/Vo/VMPageResult.cs delete mode 100644 ZR.Service/Extensions/QueryableExtension.cs diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index d878cb3..2884497 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -4,6 +4,10 @@ net5.0 + + + + diff --git a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs index 2b5355a..a398197 100644 --- a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs +++ b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs @@ -19,7 +19,7 @@ using ZR.Common; using ZR.Model; using ZR.Model.System.Dto; using ZR.Model.System.Generate; -using ZR.Model.Vo; +using ZR.Service; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers @@ -72,9 +72,8 @@ namespace ZR.Admin.WebApi.Controllers public IActionResult FindListTable(string dbName, string tableName, PagerInfo pager) { List list = _CodeGeneraterService.GetAllTables(dbName, tableName, pager); - var vm = new VMPageResult(list, pager); - return SUCCESS(vm); + return SUCCESS(list.ToPage(pager)); } /// diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs index c5fe262..86e178b 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysDictDataController.cs @@ -38,10 +38,8 @@ namespace ZR.Admin.WebApi.Controllers.System [HttpGet("list")] public IActionResult List([FromQuery] SysDictData dictData, [FromQuery] PagerInfo pagerInfo) { - var list = SysDictDataService.SelectDictDataList(dictData); - pagerInfo.TotalNum = list.Count; - var vm = new VMPageResult(list, pagerInfo); - return SUCCESS(vm); + var list = SysDictDataService.SelectDictDataList(dictData, pagerInfo); + return SUCCESS(list); } /// @@ -107,7 +105,7 @@ namespace ZR.Admin.WebApi.Controllers.System [HttpDelete("{dictCode}")] public IActionResult Remove(string dictCode) { - long[] dictCodes = ZR.Common.Tools.SpitLongArrary(dictCode); + long[] dictCodes = Common.Tools.SpitLongArrary(dictCode); return SUCCESS(SysDictDataService.DeleteDictDataByIds(dictCodes)); } diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs index 7efaf3f..1e66890 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs @@ -38,8 +38,7 @@ namespace ZR.Admin.WebApi.Controllers.System { var list = SysDictService.SelectDictTypeList(dict, pagerInfo); - var vm = new VMPageResult(list, pagerInfo); - return SUCCESS(vm, TIME_FORMAT_FULL); + return SUCCESS(list, TIME_FORMAT_FULL); } /// diff --git a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs index 9d333f6..5ad149f 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs @@ -11,7 +11,7 @@ using System.IO; using ZR.Admin.WebApi.Filters; using ZR.Model; using ZR.Model.System; -using ZR.Model.Vo; +using ZR.Service; using ZR.Service.System.IService; namespace ZR.Admin.WebApi.Controllers.System @@ -53,9 +53,7 @@ namespace ZR.Admin.WebApi.Controllers.System { var list = UserService.SelectUserList(user, pager); - var vm = new VMPageResult(list, pager); - - return SUCCESS(vm, TIME_FORMAT_FULL); + return SUCCESS(list.ToPage(pager), TIME_FORMAT_FULL); } /// diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs index 38be60d..84c1513 100644 --- a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs +++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs @@ -38,9 +38,8 @@ namespace ZR.Admin.WebApi.Controllers.monitor public IActionResult LoignLogList([FromQuery] SysLogininfor sysLogininfoDto, [FromQuery] PagerInfo pagerInfo) { var list = sysLoginService.GetLoginLog(sysLogininfoDto, pagerInfo); - var vMPage = new VMPageResult(list, pagerInfo); - return ToResponse(ToJson(vMPage.TotalNum, vMPage), TIME_FORMAT_FULL_2); + return ToResponse(ToJson(list.Count, list.ToPage(pagerInfo)), TIME_FORMAT_FULL_2); } /// diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs index 09ecf62..abefe0f 100644 --- a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs +++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs @@ -41,9 +41,8 @@ namespace ZR.Admin.WebApi.Controllers.monitor PagerInfo pagerInfo = new PagerInfo(sysOperLog.pageNum); var list = sysOperLogService.SelectOperLogList(sysOperLog, pagerInfo); - var vMPage = new VMPageResult(list, pagerInfo); - return ToResponse(ToJson(vMPage.TotalNum, vMPage), TIME_FORMAT_FULL_2); + return ToResponse(ToJson(list.TotalNum, list), TIME_FORMAT_FULL_2); } /// @@ -84,7 +83,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor public IActionResult Export([FromQuery] SysOperLogDto sysOperLog) { 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 }); } diff --git a/ZR.Model/ApiResult.cs b/ZR.Model/ApiResult.cs deleted file mode 100644 index 462f8e0..0000000 --- a/ZR.Model/ApiResult.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Newtonsoft.Json; -using System.ComponentModel; - -namespace ZRModel -{ - /// - /// 通用json格式实体返回类 - /// Author by zhaorui - /// - public class ApiResult - { - public int Code { get; set; } - public string Msg { get; set; } - /// - /// 如果data值为null,则忽略序列化将不会返回data字段 - /// - [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; - } - - /// - /// 返回成功消息 - /// - /// 数据对象 - /// 成功消息 - public static ApiResult Success(object data) { return new ApiResult(100, "success", data); } - - /// - /// 返回成功消息 - /// - /// 返回内容 - /// 成功消息 - public static ApiResult Success(string msg) { return new ApiResult(100, msg, null); } - - /// - /// 返回成功消息 - /// - /// 返回内容 - /// 数据对象 - /// 成功消息 - public static ApiResult Success(string msg, object data) { return new ApiResult(100, msg, data); } - - /// - /// 返回失败消息 - /// - /// - /// - /// - public static ApiResult Error(int code, string msg) { return new ApiResult(code, msg); } - - /// - /// 返回失败消息 - /// - /// - /// - 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 - } -} diff --git a/ZR.Model/Extensions/QueryableExtension.cs b/ZR.Model/Extensions/QueryableExtension.cs new file mode 100644 index 0000000..22a491f --- /dev/null +++ b/ZR.Model/Extensions/QueryableExtension.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace ZR.Model +{ + /// + /// 分页扩展 + /// + public static class PageExtension + { + /// + /// 读取列表 + /// + /// + /// + /// + /// + public static PagedInfo ToPage(this List source, PagerInfo parm) + { + var page = new PagedInfo + { + TotalPage = parm.TotalPage, + TotalNum = parm.TotalNum, + PageSize = parm.PageSize, + PageIndex = parm.PageNum, + Result = source + }; + return page; + } + } +} diff --git a/ZR.Model/OptionsSetting.cs b/ZR.Model/OptionsSetting.cs deleted file mode 100644 index 8c723fc..0000000 --- a/ZR.Model/OptionsSetting.cs +++ /dev/null @@ -1,50 +0,0 @@ - -namespace ZRModel -{ - /// - /// 获取配置文件POCO实体类 - /// - public class OptionsSetting - { - /// - /// 1、喵播 2、fireStar - /// - 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; } - /// - /// mongodb连接字符串 - /// - public string Mongo_Conn { get; set; } - public string Database { get; set; } - - public LoggingOptions Logging { get; set; } - public MailOptions MailOptions { get; set; } - } - /// - /// 发送邮件数据配置 - /// - public class MailOptions - { - public string From { get; set; } - public string Password { get; set; } - public string Host { get; set; } - public int Port { get; set; } - } - /// - /// 日志 - /// - 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; } - } - -} diff --git a/Infrastructure/Model/PagedInfo.cs b/ZR.Model/PagedInfo.cs similarity index 55% rename from Infrastructure/Model/PagedInfo.cs rename to ZR.Model/PagedInfo.cs index ff5c285..747deea 100644 --- a/Infrastructure/Model/PagedInfo.cs +++ b/ZR.Model/PagedInfo.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Infrastructure.Model +namespace ZR.Model { /// /// 分页参数 @@ -20,34 +20,33 @@ namespace Infrastructure.Model /// /// 排序列 /// - //public string Sort { get; set; } + public string Sort { get; set; } /// /// 排序类型 /// - //public string SortType { get; set; } + public string SortType { get; set; } /// /// 总记录数 /// - public int TotalCount { get; set; } + public int TotalNum { get; set; } /// /// 总页数 /// - //public int TotalPage - //{ - // get - // { - // if (TotalCount > 0) - // { - // return TotalCount % this.PageSize == 0 ? TotalCount / this.PageSize : TotalCount / this.PageSize + 1; - // } - // else - // { - // return 0; - // } - // } - // set { } - //} - public int TotalPage { get; set; } + public int TotalPage + { + get + { + if (TotalNum > 0) + { + return TotalNum % this.PageSize == 0 ? TotalNum / this.PageSize : TotalNum / this.PageSize + 1; + } + else + { + return 0; + } + } + set { } + } public List Result { get; set; } public PagedInfo() @@ -59,8 +58,8 @@ namespace Infrastructure.Model { PageIndex = pageIndex; PageSize = pageSize; - TotalCount = source.Count; - TotalPage = (int)Math.Ceiling(TotalCount / (double)PageSize);//计算总页数 + TotalNum = source.Count; + TotalPage = (int)Math.Ceiling(TotalNum / (double)PageSize);//计算总页数 } } diff --git a/ZR.Model/PagerInfo.cs b/ZR.Model/PagerInfo.cs index f3921ef..caefd5b 100644 --- a/ZR.Model/PagerInfo.cs +++ b/ZR.Model/PagerInfo.cs @@ -18,9 +18,20 @@ namespace ZR.Model /// /// 总页码 /// - public int TotalPageNum { get; set; } + /// + /// 总页数 + /// + 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 string Sort { get; set; } + public string OrderBy { get; set; } public PagerInfo() { PageNum = 1; diff --git a/ZR.Model/Vo/VMPageResult.cs b/ZR.Model/Vo/VMPageResult.cs deleted file mode 100644 index a6af85b..0000000 --- a/ZR.Model/Vo/VMPageResult.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Data; - -namespace ZR.Model.Vo -{ - public class VMPageResult 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 Result { get; set; } - public long EndPage { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public DataTable Data { get; set; } - - public VMPageResult() - { - } - - /// - /// 集合使用 - /// - /// - /// - public VMPageResult(IList 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; - } - - /// - /// datable使用 - /// - /// - /// - 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; - } - } - -} diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj index 9d0f89b..58886cf 100644 --- a/ZR.Model/ZR.Model.csproj +++ b/ZR.Model/ZR.Model.csproj @@ -4,11 +4,6 @@ netstandard2.1 - - - - - @@ -18,6 +13,7 @@ + diff --git a/ZR.Repository/BaseRepository.cs b/ZR.Repository/BaseRepository.cs index 3852a9a..71dc86a 100644 --- a/ZR.Repository/BaseRepository.cs +++ b/ZR.Repository/BaseRepository.cs @@ -391,13 +391,13 @@ namespace ZR.Repository public static PagedInfo ToPage(this ISugarQueryable source, PagerInfo parm) { var page = new PagedInfo(); - var total = source.Count(); - page.TotalCount = total; + var total = 0; 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); + page.Result = source.OrderByIF(!string.IsNullOrEmpty(parm.Sort), $"{parm.OrderBy} {(parm.Sort == "desc" ? "desc" : "asc")}") + .ToPageList(parm.PageNum, parm.PageSize, ref total); + page.TotalNum = total; return page; } diff --git a/ZR.Repository/System/SysDictDataRepository.cs b/ZR.Repository/System/SysDictDataRepository.cs index f5b205f..9012ec5 100644 --- a/ZR.Repository/System/SysDictDataRepository.cs +++ b/ZR.Repository/System/SysDictDataRepository.cs @@ -1,6 +1,9 @@ using Infrastructure.Attribute; +using Infrastructure.Model; +using SqlSugar; using System; using System.Collections.Generic; +using ZR.Model; using ZR.Model.System; namespace ZR.Repository.System @@ -15,14 +18,15 @@ namespace ZR.Repository.System /// 字典类型数据搜索 /// /// + /// /// - public List SelectDictDataList(SysDictData dictData) + public PagedInfo SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo) { - return Context.Queryable() - .WhereIF(!string.IsNullOrEmpty(dictData.DictLabel), it => it.DictLabel.Contains(dictData.DictLabel)) - .WhereIF(!string.IsNullOrEmpty(dictData.Status), it => it.Status == dictData.Status) - .WhereIF(!string.IsNullOrEmpty(dictData.DictType), it => it.DictType == dictData.DictType) - .ToList(); + var exp = Expressionable.Create(); + exp.AndIF(!string.IsNullOrEmpty(dictData.DictLabel), it => it.DictLabel.Contains(dictData.DictLabel)); + exp.AndIF(!string.IsNullOrEmpty(dictData.Status), it => it.Status == dictData.Status); + exp.AndIF(!string.IsNullOrEmpty(dictData.DictType), it => it.DictType == dictData.DictType); + return GetPages(exp.ToExpression(), pagerInfo); } /// diff --git a/ZR.Repository/System/SysDictRepository.cs b/ZR.Repository/System/SysDictRepository.cs index 648db57..3fc177b 100644 --- a/ZR.Repository/System/SysDictRepository.cs +++ b/ZR.Repository/System/SysDictRepository.cs @@ -1,7 +1,7 @@ using Infrastructure.Attribute; -using System; +using SqlSugar; using System.Collections.Generic; -using System.Text; +using ZR.Model; using ZR.Model.System; namespace ZR.Repository.System @@ -22,17 +22,14 @@ namespace ZR.Repository.System /// /// 实体模型 /// - public List SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager) + public PagedInfo SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager) { - var totalNum = 0; - var list = Context - .Queryable() - .WhereIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName)) - .WhereIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status) - .WhereIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType == dictType.DictType) - .ToPageList(pager.PageNum, pager.PageSize, ref totalNum); - pager.TotalNum = totalNum; - return list; + var exp = Expressionable.Create(); + exp.AndIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName)); + exp.AndIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status); + exp.AndIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType == dictType.DictType); + + return GetPages(exp.ToExpression(), pager); } /// diff --git a/ZR.Repository/System/SysOperLogRepository.cs b/ZR.Repository/System/SysOperLogRepository.cs index 7953394..3050170 100644 --- a/ZR.Repository/System/SysOperLogRepository.cs +++ b/ZR.Repository/System/SysOperLogRepository.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using ZR.Model; using ZR.Model.System.Dto; using ZR.Model.System; +using SqlSugar; +using Infrastructure.Model; namespace ZR.Repository.System { @@ -16,19 +18,16 @@ namespace ZR.Repository.System /// /// 分页数据 /// - public List GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo) + public PagedInfo GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo) { - int totalCount = 0; - var list = Context.Queryable() - .Where(it => it.operTime >= sysOper.BeginTime && it.operTime <= sysOper.EndTime) - .WhereIF(sysOper.Title.IfNotEmpty(), it => it.title.Contains(sysOper.Title)) - .WhereIF(sysOper.operName.IfNotEmpty(), it => it.operName.Contains(sysOper.operName)) - .WhereIF(sysOper.BusinessType != -1, it =>it.businessType == sysOper.BusinessType) - .WhereIF(sysOper.Status != -1, it => it.status == sysOper.Status) - .OrderBy(it => it.OperId, SqlSugar.OrderByType.Desc) - .ToPageList(pagerInfo.PageNum, pagerInfo.PageSize, ref totalCount); - pagerInfo.TotalNum = totalCount; - return list; + var exp = Expressionable.Create(); + exp.And(it => it.operTime >= sysOper.BeginTime && it.operTime <= sysOper.EndTime); + exp.AndIF(sysOper.Title.IfNotEmpty(), it => it.title.Contains(sysOper.Title)); + exp.AndIF(sysOper.operName.IfNotEmpty(), it => it.operName.Contains(sysOper.operName)); + exp.AndIF(sysOper.BusinessType != -1, it => it.businessType == sysOper.BusinessType); + exp.AndIF(sysOper.Status != -1, it => it.status == sysOper.Status); + + return GetPages(exp.ToExpression(), pagerInfo, x => x.OperId, OrderByType.Desc); } /// diff --git a/ZR.Service/Extensions/QueryableExtension.cs b/ZR.Service/Extensions/QueryableExtension.cs deleted file mode 100644 index d87b195..0000000 --- a/ZR.Service/Extensions/QueryableExtension.cs +++ /dev/null @@ -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 - { - /// - /// 读取列表 - /// - /// - /// - /// - /// - /// - public static PagedInfo ToPage(this ISugarQueryable source, PagerInfo parm) - { - var page = new PagedInfo(); - 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; - } - - } -} diff --git a/ZR.Service/System/GenTableService.cs b/ZR.Service/System/GenTableService.cs index b9a5ddb..9664f5f 100644 --- a/ZR.Service/System/GenTableService.cs +++ b/ZR.Service/System/GenTableService.cs @@ -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; diff --git a/ZR.Service/System/IService/IGenTableService.cs b/ZR.Service/System/IService/IGenTableService.cs index 7adc936..dd401f2 100644 --- a/ZR.Service/System/IService/IGenTableService.cs +++ b/ZR.Service/System/IService/IGenTableService.cs @@ -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 diff --git a/ZR.Service/System/IService/ISysDictDataService.cs b/ZR.Service/System/IService/ISysDictDataService.cs index 7d57d66..8380ffa 100644 --- a/ZR.Service/System/IService/ISysDictDataService.cs +++ b/ZR.Service/System/IService/ISysDictDataService.cs @@ -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 SelectDictDataList(SysDictData dictData); + public PagedInfo SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo); public List SelectDictDataByType(string dictType); public SysDictData SelectDictDataById(long dictCode); public long InsertDictData(SysDictData dict); diff --git a/ZR.Service/System/IService/ISysDictService.cs b/ZR.Service/System/IService/ISysDictService.cs index d1728f1..7e4313f 100644 --- a/ZR.Service/System/IService/ISysDictService.cs +++ b/ZR.Service/System/IService/ISysDictService.cs @@ -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 GetAll(); - public List SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager); + public PagedInfo SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager); /// /// 校验字典类型称是否唯一 diff --git a/ZR.Service/System/IService/ISysOperLogService.cs b/ZR.Service/System/IService/ISysOperLogService.cs index 7f9eb76..fe6948b 100644 --- a/ZR.Service/System/IService/ISysOperLogService.cs +++ b/ZR.Service/System/IService/ISysOperLogService.cs @@ -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 /// 操作日志对象 /// /// 操作日志集合 - public List SelectOperLogList(SysOperLogDto operLog, PagerInfo pager); + public PagedInfo SelectOperLogList(SysOperLogDto operLog, PagerInfo pager); /// /// 清空操作日志 diff --git a/ZR.Service/System/IService/ISysRoleService.cs b/ZR.Service/System/IService/ISysRoleService.cs index b4947f1..9c9f4a4 100644 --- a/ZR.Service/System/IService/ISysRoleService.cs +++ b/ZR.Service/System/IService/ISysRoleService.cs @@ -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 diff --git a/ZR.Service/System/SysDictDataService.cs b/ZR.Service/System/SysDictDataService.cs index 1e02c0c..7a13527 100644 --- a/ZR.Service/System/SysDictDataService.cs +++ b/ZR.Service/System/SysDictDataService.cs @@ -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 /// /// /// - public List SelectDictDataList(SysDictData dictData) + public PagedInfo SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo) { - return SysDictDataRepository.SelectDictDataList(dictData); + return SysDictDataRepository.SelectDictDataList(dictData, pagerInfo); } /// diff --git a/ZR.Service/System/SysDictService.cs b/ZR.Service/System/SysDictService.cs index 3bed701..ba21897 100644 --- a/ZR.Service/System/SysDictService.cs +++ b/ZR.Service/System/SysDictService.cs @@ -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 /// /// 实体模型 /// - public List SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager) + public PagedInfo SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager) { return DictRepository.SelectDictTypeList(dictType, pager); } diff --git a/ZR.Service/System/SysOperLogService.cs b/ZR.Service/System/SysOperLogService.cs index 1ff3eda..7af4626 100644 --- a/ZR.Service/System/SysOperLogService.cs +++ b/ZR.Service/System/SysOperLogService.cs @@ -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 /// 操作日志对象 /// /// 操作日志集合 - public List SelectOperLogList(SysOperLogDto operLog, PagerInfo pager) + public PagedInfo SelectOperLogList(SysOperLogDto operLog, PagerInfo pager) { operLog.BeginTime = DateTimeHelper.GetBeginTime(operLog.BeginTime, -1); operLog.EndTime = DateTimeHelper.GetBeginTime(operLog.EndTime, 1); diff --git a/ZR.Vue/src/utils/request.js b/ZR.Vue/src/utils/request.js index a58006c..53a54de 100644 --- a/ZR.Vue/src/utils/request.js +++ b/ZR.Vue/src/utils/request.js @@ -28,7 +28,7 @@ service.interceptors.request.use(config => { //将token放到请求头发送给服务器,将tokenkey放在请求头中 config.headers.Token = getToken(); } else { - console.log(config) + // console.log(config) } return config; }, error => { diff --git a/ZR.Vue/src/views/business/gendemo/index.vue b/ZR.Vue/src/views/business/gendemo/index.vue index 4fc82c3..81e7e13 100644 --- a/ZR.Vue/src/views/business/gendemo/index.vue +++ b/ZR.Vue/src/views/business/gendemo/index.vue @@ -204,7 +204,7 @@ export default { listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(res => { if (res.code == 200) { this.dataList = res.data.result; - this.total = res.data.totalCount; + this.total = res.data.totalNum; } }) }, diff --git a/ZR.Vue/src/views/components/dictData.vue b/ZR.Vue/src/views/components/dictData.vue index d83a2b2..1286a23 100644 --- a/ZR.Vue/src/views/components/dictData.vue +++ b/ZR.Vue/src/views/components/dictData.vue @@ -12,7 +12,7 @@ - 搜索 + 搜索 重置 diff --git a/ZR.Vue/src/views/monitor/job/index.vue b/ZR.Vue/src/views/monitor/job/index.vue index 06257f9..ef67bc3 100644 --- a/ZR.Vue/src/views/monitor/job/index.vue +++ b/ZR.Vue/src/views/monitor/job/index.vue @@ -291,7 +291,7 @@ export default { this.loading = true; queryTasks(this.queryParams).then((response) => { this.dataTasks = response.data.result; - this.total = response.data.totalCount; + this.total = response.data.totalNum; this.loading = false; }); }, diff --git a/ZR.Vue/src/views/monitor/job/log.vue b/ZR.Vue/src/views/monitor/job/log.vue index 58c13d8..9d639e4 100644 --- a/ZR.Vue/src/views/monitor/job/log.vue +++ b/ZR.Vue/src/views/monitor/job/log.vue @@ -161,7 +161,7 @@ export default { listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then( (response) => { this.jobLogList = response.data.result; - this.total = response.data.totalCount; + this.total = response.data.totalNum; this.loading = false; } ); diff --git a/ZR.Vue/src/views/system/article/manager.vue b/ZR.Vue/src/views/system/article/manager.vue index 0f4570d..efd795e 100644 --- a/ZR.Vue/src/views/system/article/manager.vue +++ b/ZR.Vue/src/views/system/article/manager.vue @@ -100,7 +100,7 @@ export default { listArticle(this.queryParams).then((res) => { if (res.code == 200) { this.dataList = res.data.result; - this.total = res.data.totalCount; + this.total = res.data.totalNum; } }); }, diff --git a/ZR.Vue/src/views/system/config/index.vue b/ZR.Vue/src/views/system/config/index.vue index d3aa42c..3623aaf 100644 --- a/ZR.Vue/src/views/system/config/index.vue +++ b/ZR.Vue/src/views/system/config/index.vue @@ -170,7 +170,7 @@ export default { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then( (response) => { this.configList = response.data.result; - this.total = response.data.totalCount; + this.total = response.data.totalNum; this.loading = false; } ); diff --git a/ZR.Vue/src/views/system/post/index.vue b/ZR.Vue/src/views/system/post/index.vue index 9513c8d..993ede9 100644 --- a/ZR.Vue/src/views/system/post/index.vue +++ b/ZR.Vue/src/views/system/post/index.vue @@ -160,7 +160,7 @@ export default { this.loading = true; listPost(this.queryParams).then((response) => { this.postList = response.data.result; - this.total = response.data.totalCount; + this.total = response.data.totalNum; this.loading = false; }); }, diff --git a/ZR.Vue/src/views/tool/gen/index.vue b/ZR.Vue/src/views/tool/gen/index.vue index 085450c..391fbfd 100644 --- a/ZR.Vue/src/views/tool/gen/index.vue +++ b/ZR.Vue/src/views/tool/gen/index.vue @@ -151,7 +151,7 @@ export default { getGenTable(this.queryParams).then((res) => { this.tableData = res.data.result; - this.total = res.data.totalCount; + this.total = res.data.totalNum; this.tableloading = false; }); },