From 68e50c1639585ca85c81fb311bb7d183c7bc5f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 27 May 2021 14:40:41 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=20=E4=B8=8B=E7=BA=A7=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=8D=E5=BA=94=E8=AF=A5=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=88=B0=E4=B8=8A=E7=BA=A7=E6=A0=91=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Core/Service/Org/SysOrgService.cs | 21 +++++++++++---------- Api/Ewide.Core/Util/TreeBuildUtil.cs | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Api/Ewide.Core/Service/Org/SysOrgService.cs b/Api/Ewide.Core/Service/Org/SysOrgService.cs index 812ab4c..2a9635d 100644 --- a/Api/Ewide.Core/Service/Org/SysOrgService.cs +++ b/Api/Ewide.Core/Service/Org/SysOrgService.cs @@ -83,17 +83,18 @@ namespace Ewide.Core.Service if (dataScopes.Count < 1) return dataScopeList; - // 此处获取所有的上级节点,用于构造完整树 - dataScopes.ForEach(u => - { - var sysOrg = _sysOrgRep.DetachedEntities.FirstOrDefault(c => c.Id == u); - var parentAndChildIdListWithSelf = sysOrg.Pids.TrimEnd(',').Replace("[", "").Replace("]", "") - .Split(",").ToList(); - dataScopeList.AddRange(parentAndChildIdListWithSelf); + // 不需要去查找上级节点 - // 添加本级(不知道为什么框架在这里排除了本级) - dataScopeList.Add(u); - }); + // 此处获取所有的上级节点,用于构造完整树 + //dataScopes.ForEach(u => + //{ + // var sysOrg = _sysOrgRep.DetachedEntities.FirstOrDefault(c => c.Id == u); + // var parentAndChildIdListWithSelf = sysOrg.Pids.TrimEnd(',').Replace("[", "").Replace("]", "") + // .Split(",").ToList(); + // dataScopeList.AddRange(parentAndChildIdListWithSelf); + //}); + + dataScopeList = dataScopes; } return dataScopeList.Distinct().ToList(); } diff --git a/Api/Ewide.Core/Util/TreeBuildUtil.cs b/Api/Ewide.Core/Util/TreeBuildUtil.cs index d68ab46..155bb81 100644 --- a/Api/Ewide.Core/Util/TreeBuildUtil.cs +++ b/Api/Ewide.Core/Util/TreeBuildUtil.cs @@ -54,6 +54,22 @@ namespace Ewide.Core if (_rootParentIds.Contains(u.GetPid())) results.Add(u); }); + + // 在未获取到根节点的情况下, 直接将最上级作为根节点 + if (results.Count < 1) + { + var ids = new List(); + nodes.ForEach(u => { + ids.Add(u.GetId()); + }); + + nodes.ForEach(u => + { + if (!ids.Contains(u.GetPid())) + results.Add(u); + }); + } + return results; } From bbce103b4f7ac86cd12c55486503138626ff339c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 27 May 2021 17:12:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Core/Entity/SysUser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Api/Ewide.Core/Entity/SysUser.cs b/Api/Ewide.Core/Entity/SysUser.cs index 8c292c8..8255917 100644 --- a/Api/Ewide.Core/Entity/SysUser.cs +++ b/Api/Ewide.Core/Entity/SysUser.cs @@ -107,7 +107,7 @@ namespace Ewide.Core /// 管理员类型-超级管理员_1、非管理员_2 /// [Comment("管理员类型-超级管理员_1、非管理员_2")] - public AdminType AdminType { get; set; } + public AdminType AdminType { get; set; } = AdminType.None; /// /// 状态-正常_0、停用_1、删除_2 From f612f7e4e9334bdf11fc201e2e52525411dfc39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 27 May 2021 19:37:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update=20=E5=AF=B9dapper=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=BF=94=E5=9B=9E=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Core/Extension/PageExtensions.cs | 61 ++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/Api/Ewide.Core/Extension/PageExtensions.cs b/Api/Ewide.Core/Extension/PageExtensions.cs index dd99564..ba9a606 100644 --- a/Api/Ewide.Core/Extension/PageExtensions.cs +++ b/Api/Ewide.Core/Extension/PageExtensions.cs @@ -51,26 +51,78 @@ namespace Ewide.Core.Extension return source.OrderBy(OrderBuilder(input)).Select(u => u.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); } - public static Task> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) + #region DAPPER + public async static Task QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) { - return source.QueryAsync( + var count = await source.PageTotalCount( + sql, + param: param, + transaction: transaction, + commandTimeout: commandTimeout, + commandType: commandType + ); + + var data = await source.QueryAsync( PageSqlBuilder(sql, input), param: param, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType ); + + var page = new PagedList + { + PageIndex = input.PageNo, + PageSize = input.PageSize, + Items = data, + TotalCount = count, + TotalPages = (int)Math.Ceiling((decimal)count / (decimal)input.PageSize) + }; + + return page; } - public static Task> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public async static Task> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) where T : new() { - return source.QueryAsync( + var count = await source.PageTotalCount( + sql, + param: param, + transaction: transaction, + commandTimeout: commandTimeout, + commandType: commandType + ); + + var data = await source.QueryAsync( PageSqlBuilder(sql, input), param: param, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType ); + + var page = new PagedList + { + PageIndex = input.PageNo, + PageSize = input.PageSize, + Items = data, + TotalCount = count, + TotalPages = (int)Math.Ceiling((decimal)count / (decimal)input.PageSize) + }; + + return page; + } + + private async static Task PageTotalCount(this IDapperRepository source, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) + { + var countSql = String.Format("SELECT COUNT(0) FROM ({0}) T", sql); + var countAsync = await source.QueryAsync( + countSql, + param: param, + transaction: transaction, + commandTimeout: commandTimeout, + commandType: commandType); + var count = countAsync.SingleOrDefault(); + return count; } private static string PageSqlBuilder(string sql , PageInputBase input) @@ -83,5 +135,6 @@ namespace Ewide.Core.Extension sql += String.Join("", sqlStrList); return sql; } + #endregion } } From c023f86f6e53ca623bfc7cefd0c4d190532a5563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 27 May 2021 21:07:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?update=20=E5=88=A0=E9=99=A4=E6=89=80?= =?UTF-8?q?=E6=9C=89Xn=E5=89=8D=E7=BC=80,=20=E8=A7=84=E8=8C=83=E4=BA=86?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=88=86=E9=A1=B5=E5=8F=82=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/HouseProjectInfoInput.cs | 2 +- .../HouseProjectInfoService.cs | 4 +- Api/Ewide.Core/Ewide.Core.xml | 93 ++++++------------- .../{XnInputBase.cs => InputBase.cs} | 4 +- Api/Ewide.Core/Extension/PageDataResult.cs | 38 ++++++++ Api/Ewide.Core/Extension/PageExtensions.cs | 10 +- ...ltProvider.cs => RestfulResultProvider.cs} | 16 ++-- Api/Ewide.Core/Extension/XnPageResult.cs | 24 ----- Api/Ewide.Core/Service/App/SysAppService.cs | 2 +- .../Service/Area/AreaCodeService.cs | 2 +- .../Service/Area/Dto/AreaCodeInput.cs | 2 +- .../Service/CodeGen/CodeGenService.cs | 4 +- .../Service/CodeGen/Dto/CodeGenInput.cs | 2 +- .../Service/CodeGen/Dto/XnCodeGenOutput.cs | 52 ----------- .../Service/Config/SysConfigService.cs | 2 +- .../Service/Dict/SysDictDataService.cs | 2 +- .../Service/Dict/SysDictTypeService.cs | 2 +- Api/Ewide.Core/Service/File/SysFileService.cs | 4 +- Api/Ewide.Core/Service/Log/SysOpLogService.cs | 2 +- .../Service/Log/SysVisLogService.cs | 2 +- .../Service/Notice/SysNoticeService.cs | 8 +- Api/Ewide.Core/Service/Org/Dto/OrgInput.cs | 2 +- Api/Ewide.Core/Service/Org/SysOrgService.cs | 2 +- Api/Ewide.Core/Service/Pos/SysPosService.cs | 2 +- Api/Ewide.Core/Service/Role/Dto/RoleInput.cs | 2 +- Api/Ewide.Core/Service/Role/SysRoleService.cs | 2 +- .../Service/Tenant/SysTenantService.cs | 4 +- .../Service/Timer/SysTimerService.cs | 4 +- Api/Ewide.Core/Service/User/Dto/UserInput.cs | 2 +- Api/Ewide.Core/Service/User/Dto/UserOutput.cs | 10 ++ Api/Ewide.Core/Service/User/SysUserService.cs | 4 +- Api/Ewide.Web.Core/Startup.cs | 2 +- Web/src/components/yoList/index.js | 24 +++-- Web/src/components/yoTable/index.js | 14 +-- 34 files changed, 146 insertions(+), 205 deletions(-) rename Api/Ewide.Core/Extension/{XnInputBase.cs => InputBase.cs} (95%) create mode 100644 Api/Ewide.Core/Extension/PageDataResult.cs rename Api/Ewide.Core/Extension/{XnRestfulResultProvider.cs => RestfulResultProvider.cs} (93%) delete mode 100644 Api/Ewide.Core/Extension/XnPageResult.cs delete mode 100644 Api/Ewide.Core/Service/CodeGen/Dto/XnCodeGenOutput.cs diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs index 6efcdff..b2e4e17 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Ewide.Application.Service.HouseProjectInfo.Dto { - public class HouseProjectInfoInput : XnInputBase + public class HouseProjectInfoInput : InputBase { public string Name { get; set; } public string Note { get; set; } diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs index 0d83f1c..3efac64 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs @@ -92,8 +92,8 @@ namespace Ewide.Application.Service.HouseProjectInfo .Where(!string.IsNullOrEmpty(input.Note), x => x.p.Note.Contains(input.Note)) .Where(!string.IsNullOrEmpty(input.AreaCode), x => x.p.AreaCode == input.AreaCode) .Where(!string.IsNullOrEmpty(input.pid) , x=> x.p.AreaCode.Contains(input.pid)) - .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(projects); + .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(projects); } /// diff --git a/Api/Ewide.Core/Ewide.Core.xml b/Api/Ewide.Core/Ewide.Core.xml index 3764d24..90e1500 100644 --- a/Api/Ewide.Core/Ewide.Core.xml +++ b/Api/Ewide.Core/Ewide.Core.xml @@ -2528,27 +2528,27 @@ - + 通用输入扩展参数(带权限) - + 授权菜单 - + 授权角色 - + 授权数据 - + 授权区域 @@ -2563,7 +2563,7 @@ 搜索值 - + 当前页码 @@ -2598,25 +2598,25 @@ 降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样) - + 小诺分页列表结果 - + 规范化RESTful风格返回值 - + 异常返回值 - + 处理输出状态码 @@ -2625,14 +2625,14 @@ - + 成功返回值 - + 验证失败返回值 @@ -2642,38 +2642,38 @@ - + RESTful风格---XIAONUO返回格式 - + 执行成功 - + 状态码 - + 错误信息 - + 数据 - + 附加数据 - + 时间戳 @@ -3696,51 +3696,6 @@ 表名称描述(注释)(功能名) - - - 作者姓名 - - - - - 是否移除表前缀 - - - - - 生成方式 - - - - - 数据库表名 - - - - - 数据库表名(经过组装的) - - - - - 代码包名 - - - - - 生成时间(string类型的) - - - - - 数据库表中字段集合 - - - - - 业务名 - - 参数配置 @@ -6793,6 +6748,16 @@ 状态-正常_0、停用_1、删除_2 + + + 所在机构名称 + + + + + 角色名称 + + 员工信息 diff --git a/Api/Ewide.Core/Extension/XnInputBase.cs b/Api/Ewide.Core/Extension/InputBase.cs similarity index 95% rename from Api/Ewide.Core/Extension/XnInputBase.cs rename to Api/Ewide.Core/Extension/InputBase.cs index 0121260..35c8520 100644 --- a/Api/Ewide.Core/Extension/XnInputBase.cs +++ b/Api/Ewide.Core/Extension/InputBase.cs @@ -5,7 +5,7 @@ namespace Ewide.Core /// /// 通用输入扩展参数(带权限) /// - public class XnInputBase : PageInputBase + public class InputBase : PageInputBase { /// /// 授权菜单 @@ -40,7 +40,7 @@ namespace Ewide.Core /// /// 当前页码 /// - public virtual int PageNo { get; set; } = 1; + public virtual int PageIndex { get; set; } = 1; /// /// 页码容量 diff --git a/Api/Ewide.Core/Extension/PageDataResult.cs b/Api/Ewide.Core/Extension/PageDataResult.cs new file mode 100644 index 0000000..22d6269 --- /dev/null +++ b/Api/Ewide.Core/Extension/PageDataResult.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Ewide.Core +{ + /// + /// 小诺分页列表结果 + /// + /// + public static class PageDataResult where T : new() + { + public static dynamic PageResult(PagedList page) + { + return new + { + PageIndex = page.PageIndex, + PageSize = page.PageSize, + TotalPage = page.TotalPages, + TotalCount = page.TotalCount, + Items = page.Items + }; + } + } + + public static class PageDataResult + { + public static dynamic PageResult(PagedList page) + { + return new + { + PageIndex = page.PageIndex, + PageSize = page.PageSize, + TotalPage = page.TotalPages, + TotalCount = page.TotalCount, + Items = page.Items + }; + } + } +} diff --git a/Api/Ewide.Core/Extension/PageExtensions.cs b/Api/Ewide.Core/Extension/PageExtensions.cs index ba9a606..55b500b 100644 --- a/Api/Ewide.Core/Extension/PageExtensions.cs +++ b/Api/Ewide.Core/Extension/PageExtensions.cs @@ -43,12 +43,12 @@ namespace Ewide.Core.Extension public static Task> ToPageData(this IQueryable source, PageInputBase input) where T : new() { - return source.OrderBy(OrderBuilder(input)).ToPagedListAsync(input.PageNo, input.PageSize); + return source.OrderBy(OrderBuilder(input)).ToPagedListAsync(input.PageIndex, input.PageSize); } public static Task> ToPageData(this IQueryable source, PageInputBase input) where O : new() { - return source.OrderBy(OrderBuilder(input)).Select(u => u.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); + return source.OrderBy(OrderBuilder(input)).Select(u => u.Adapt()).ToPagedListAsync(input.PageIndex, input.PageSize); } #region DAPPER @@ -72,7 +72,7 @@ namespace Ewide.Core.Extension var page = new PagedList { - PageIndex = input.PageNo, + PageIndex = input.PageIndex, PageSize = input.PageSize, Items = data, TotalCount = count, @@ -102,7 +102,7 @@ namespace Ewide.Core.Extension var page = new PagedList { - PageIndex = input.PageNo, + PageIndex = input.PageIndex, PageSize = input.PageSize, Items = data, TotalCount = count, @@ -131,7 +131,7 @@ namespace Ewide.Core.Extension var orderStr = OrderBuilder(input); if (!string.IsNullOrEmpty(orderStr)) sqlStrList.Add(" ORDER BY " + orderStr); // input.PageSize = 0表示不分页 - if (input.PageSize != 0) sqlStrList.Add(" LIMIT " + ((input.PageNo - 1) * input.PageSize).ToString() + "," + input.PageSize.ToString()); + if (input.PageSize != 0) sqlStrList.Add(" LIMIT " + ((input.PageIndex - 1) * input.PageSize).ToString() + "," + input.PageSize.ToString()); sql += String.Join("", sqlStrList); return sql; } diff --git a/Api/Ewide.Core/Extension/XnRestfulResultProvider.cs b/Api/Ewide.Core/Extension/RestfulResultProvider.cs similarity index 93% rename from Api/Ewide.Core/Extension/XnRestfulResultProvider.cs rename to Api/Ewide.Core/Extension/RestfulResultProvider.cs index 1e6aaff..9216ce0 100644 --- a/Api/Ewide.Core/Extension/XnRestfulResultProvider.cs +++ b/Api/Ewide.Core/Extension/RestfulResultProvider.cs @@ -15,8 +15,8 @@ namespace Ewide.Core /// /// 规范化RESTful风格返回值 /// - [SkipScan, UnifyModel(typeof(XnRestfulResult<>))] - public class XnRestfulResultProvider : IUnifyResultProvider + [SkipScan, UnifyModel(typeof(RestfulResult<>))] + public class RestfulResultProvider : IUnifyResultProvider { private IActionResult DisplayJson(object data) { @@ -41,7 +41,7 @@ namespace Ewide.Core // 解析异常信息 var (StatusCode, ErrorCode, Errors) = UnifyContext.GetExceptionMetadata(context); - return DisplayJson(new XnRestfulResult + return DisplayJson(new RestfulResult { Code = StatusCode, Success = false, @@ -65,7 +65,7 @@ namespace Ewide.Core { // 处理 401 状态码 case StatusCodes.Status401Unauthorized: - await context.Response.WriteAsJsonAsync(new XnRestfulResult + await context.Response.WriteAsJsonAsync(new RestfulResult { Code = StatusCodes.Status401Unauthorized, Success = false, @@ -77,7 +77,7 @@ namespace Ewide.Core break; // 处理 403 状态码 case StatusCodes.Status403Forbidden: - await context.Response.WriteAsJsonAsync(new XnRestfulResult + await context.Response.WriteAsJsonAsync(new RestfulResult { Code = StatusCodes.Status403Forbidden, Success = false, @@ -108,7 +108,7 @@ namespace Ewide.Core else if (context.Result is EmptyResult) data = null; else return null; - return DisplayJson(new XnRestfulResult + return DisplayJson(new RestfulResult { Code = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK, // 处理没有返回值情况 204 Success = true, @@ -129,7 +129,7 @@ namespace Ewide.Core /// public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, IEnumerable validationResults, string validateFailedMessage) { - return DisplayJson(new XnRestfulResult + return DisplayJson(new RestfulResult { Code = StatusCodes.Status400BadRequest, Success = false, @@ -146,7 +146,7 @@ namespace Ewide.Core /// /// [SkipScan] - public class XnRestfulResult + public class RestfulResult { /// /// 执行成功 diff --git a/Api/Ewide.Core/Extension/XnPageResult.cs b/Api/Ewide.Core/Extension/XnPageResult.cs deleted file mode 100644 index e3e1686..0000000 --- a/Api/Ewide.Core/Extension/XnPageResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections.Generic; - -namespace Ewide.Core -{ - /// - /// 小诺分页列表结果 - /// - /// - public static class XnPageResult where T : new() - { - public static dynamic PageResult(PagedList page) - { - return new - { - PageNo = page.PageIndex, - PageSize = page.PageSize, - TotalPage = page.TotalPages, - TotalRows = page.TotalCount, - Rows = page.Items //.Adapt>(), - //Rainbow = PageUtil.Rainbow(page.PageIndex, page.TotalPages, PageUtil.RAINBOW_NUM) - }; - } - } -} diff --git a/Api/Ewide.Core/Service/App/SysAppService.cs b/Api/Ewide.Core/Service/App/SysAppService.cs index ea207cd..4fc67c8 100644 --- a/Api/Ewide.Core/Service/App/SysAppService.cs +++ b/Api/Ewide.Core/Service/App/SysAppService.cs @@ -80,7 +80,7 @@ namespace Ewide.Core.Service u => EF.Functions.Like(u.Code, $"%{input.Code.Trim()}%") ) .ToPageData(input); - return XnPageResult.PageResult(apps); + return PageDataResult.PageResult(apps); } /// diff --git a/Api/Ewide.Core/Service/Area/AreaCodeService.cs b/Api/Ewide.Core/Service/Area/AreaCodeService.cs index c076a67..32838d7 100644 --- a/Api/Ewide.Core/Service/Area/AreaCodeService.cs +++ b/Api/Ewide.Core/Service/Area/AreaCodeService.cs @@ -118,7 +118,7 @@ namespace Ewide.Core.Service.Area .Where(!string.IsNullOrEmpty(input.Name), a => a.Name.Contains(input.Name)) .Where(!string.IsNullOrEmpty(input.Pcode), a => a.Code.StartsWith(input.Pcode)) .ToPageData(input); - return XnPageResult.PageResult(AreaCodes); + return PageDataResult.PageResult(AreaCodes); } /// diff --git a/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs b/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs index 7ef0404..0f7cde3 100644 --- a/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs +++ b/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Ewide.Core.Service.Area.Dto { - public class AreaCodeInput : XnInputBase + public class AreaCodeInput : InputBase { public string Code { get; set; } public string AdCode { get; set; } diff --git a/Api/Ewide.Core/Service/CodeGen/CodeGenService.cs b/Api/Ewide.Core/Service/CodeGen/CodeGenService.cs index 35f82ed..66aa15d 100644 --- a/Api/Ewide.Core/Service/CodeGen/CodeGenService.cs +++ b/Api/Ewide.Core/Service/CodeGen/CodeGenService.cs @@ -50,8 +50,8 @@ namespace Ewide.Core.Service.CodeGen var tableName = !string.IsNullOrEmpty(input.TableName?.Trim()); var codeGens = await _sysCodeGenRep.DetachedEntities .Where((tableName, u => EF.Functions.Like(u.TableName, $"%{input.TableName.Trim()}%"))) - .ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(codeGens); + .ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(codeGens); } /// diff --git a/Api/Ewide.Core/Service/CodeGen/Dto/CodeGenInput.cs b/Api/Ewide.Core/Service/CodeGen/Dto/CodeGenInput.cs index 3e4a5b9..a02fafb 100644 --- a/Api/Ewide.Core/Service/CodeGen/Dto/CodeGenInput.cs +++ b/Api/Ewide.Core/Service/CodeGen/Dto/CodeGenInput.cs @@ -5,7 +5,7 @@ namespace Ewide.Core.Service /// /// 代码生成参数类 /// - public class CodeGenInput : XnInputBase + public class CodeGenInput : InputBase { /// /// 作者姓名 diff --git a/Api/Ewide.Core/Service/CodeGen/Dto/XnCodeGenOutput.cs b/Api/Ewide.Core/Service/CodeGen/Dto/XnCodeGenOutput.cs deleted file mode 100644 index 9f4e2f3..0000000 --- a/Api/Ewide.Core/Service/CodeGen/Dto/XnCodeGenOutput.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; - -namespace Ewide.Core.Service -{ - public class XnCodeGenOutput - { - /// - /// 作者姓名 - /// - public string AuthorName { get; set; } - - /// - /// 是否移除表前缀 - /// - public string TablePrefix { get; set; } - - /// - /// 生成方式 - /// - public string GenerateType { get; set; } - - /// - /// 数据库表名 - /// - public string TableName { get; set; } - - /// - /// 数据库表名(经过组装的) - /// - public string TableNameAss { get; set; } - - /// - /// 代码包名 - /// - public string PackageName { get; set; } - - /// - /// 生成时间(string类型的) - /// - public string CreateTimestring { get; set; } - - /// - /// 数据库表中字段集合 - /// - public List ConfigList { get; set; } - - /// - /// 业务名 - /// - public string BusName { get; set; } - } -} diff --git a/Api/Ewide.Core/Service/Config/SysConfigService.cs b/Api/Ewide.Core/Service/Config/SysConfigService.cs index 62c0714..724fdb8 100644 --- a/Api/Ewide.Core/Service/Config/SysConfigService.cs +++ b/Api/Ewide.Core/Service/Config/SysConfigService.cs @@ -44,7 +44,7 @@ namespace Ewide.Core.Service (groupCode, u => EF.Functions.Like(u.Code, $"%{input.GroupCode.Trim()}%"))) .Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.GroupCode) .ToPageData(input); - return XnPageResult.PageResult(configs); + return PageDataResult.PageResult(configs); } /// diff --git a/Api/Ewide.Core/Service/Dict/SysDictDataService.cs b/Api/Ewide.Core/Service/Dict/SysDictDataService.cs index b301f7d..07b1bca 100644 --- a/Api/Ewide.Core/Service/Dict/SysDictDataService.cs +++ b/Api/Ewide.Core/Service/Dict/SysDictDataService.cs @@ -46,7 +46,7 @@ namespace Ewide.Core.Service //.Select(u => u.Adapt()) // .ToPagedListAsync(input.PageNo, input.PageSize) .ToPageData(input); - return XnPageResult.PageResult(dictDatas); + return PageDataResult.PageResult(dictDatas); } /// diff --git a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs index ed9653a..1caa7bc 100644 --- a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs +++ b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs @@ -50,7 +50,7 @@ namespace Ewide.Core.Service .Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.Sort) //.ToPagedListAsync(input.PageNo, input.PageSize); .ToPageData(input); - return XnPageResult.PageResult(dictTypes); + return PageDataResult.PageResult(dictTypes); } /// diff --git a/Api/Ewide.Core/Service/File/SysFileService.cs b/Api/Ewide.Core/Service/File/SysFileService.cs index 787f49c..1ab43b9 100644 --- a/Api/Ewide.Core/Service/File/SysFileService.cs +++ b/Api/Ewide.Core/Service/File/SysFileService.cs @@ -51,8 +51,8 @@ namespace Ewide.Core.Service .Where(fileBucket, u => EF.Functions.Like(u.FileBucket, $"%{input.FileBucket.Trim()}%")) .Where(fileOriginName, u => EF.Functions.Like(u.FileOriginName, $"%{input.FileOriginName.Trim()}%")) .Select(u => u.Adapt()) - .ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(files); + .ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(files); } /// diff --git a/Api/Ewide.Core/Service/Log/SysOpLogService.cs b/Api/Ewide.Core/Service/Log/SysOpLogService.cs index 66d8f75..7c23226 100644 --- a/Api/Ewide.Core/Service/Log/SysOpLogService.cs +++ b/Api/Ewide.Core/Service/Log/SysOpLogService.cs @@ -44,7 +44,7 @@ namespace Ewide.Core.Service .Where(searchBeginTime, u => u.OpTime >= DateTime.Parse(input.SearchBeginTime.Trim()) && u.OpTime <= DateTime.Parse(input.SearchEndTime.Trim())) .ToPageData(input); - return XnPageResult.PageResult(opLogs); + return PageDataResult.PageResult(opLogs); } /// diff --git a/Api/Ewide.Core/Service/Log/SysVisLogService.cs b/Api/Ewide.Core/Service/Log/SysVisLogService.cs index dadebb3..2d307c1 100644 --- a/Api/Ewide.Core/Service/Log/SysVisLogService.cs +++ b/Api/Ewide.Core/Service/Log/SysVisLogService.cs @@ -43,7 +43,7 @@ namespace Ewide.Core.Service .Where(searchBeginTime, u => u.VisTime >= DateTime.Parse(input.SearchBeginTime.Trim()) && u.VisTime <= DateTime.Parse(input.SearchEndTime.Trim())) .ToPageData(input); - return XnPageResult.PageResult(visLogs); + return PageDataResult.PageResult(visLogs); } /// diff --git a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs index e931b0e..13809e5 100644 --- a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs +++ b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs @@ -51,8 +51,8 @@ namespace Ewide.Core.Service.Notice EF.Functions.Like(u.Content, $"%{input.SearchValue.Trim()}%")) .Where(input.Type > 0, u => u.Type == input.Type) .Where(u => u.Status != (int)NoticeStatus.DELETED) - .ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(notices); + .ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(notices); } /// @@ -203,8 +203,8 @@ namespace Ewide.Core.Service.Notice .Where(input.Type > 0, u => u.u.Type == input.Type) .Where(u => u.u.Status != (int)NoticeStatus.DELETED) .Select(u => u.u.Adapt()) - .ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(notices); + .ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(notices); } /// diff --git a/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs b/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs index d58a595..0c7a293 100644 --- a/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs +++ b/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs @@ -5,7 +5,7 @@ namespace Ewide.Core.Service /// /// 组织机构参数 /// - public class OrgInput : XnInputBase + public class OrgInput : InputBase { /// /// 父Id diff --git a/Api/Ewide.Core/Service/Org/SysOrgService.cs b/Api/Ewide.Core/Service/Org/SysOrgService.cs index 2a9635d..f51b58f 100644 --- a/Api/Ewide.Core/Service/Org/SysOrgService.cs +++ b/Api/Ewide.Core/Service/Org/SysOrgService.cs @@ -66,7 +66,7 @@ namespace Ewide.Core.Service .ToPageData(input); //.Select(u => u.Adapt()) //.ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(orgs); + return PageDataResult.PageResult(orgs); } /// diff --git a/Api/Ewide.Core/Service/Pos/SysPosService.cs b/Api/Ewide.Core/Service/Pos/SysPosService.cs index 2e3573c..6366178 100644 --- a/Api/Ewide.Core/Service/Pos/SysPosService.cs +++ b/Api/Ewide.Core/Service/Pos/SysPosService.cs @@ -48,7 +48,7 @@ namespace Ewide.Core.Service .Where(u => u.Status == CommonStatus.ENABLE).OrderBy(u => u.Sort) .ToPageData(input); //.ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(pos); + return PageDataResult.PageResult(pos); } /// diff --git a/Api/Ewide.Core/Service/Role/Dto/RoleInput.cs b/Api/Ewide.Core/Service/Role/Dto/RoleInput.cs index 0a0e7c5..c2d9520 100644 --- a/Api/Ewide.Core/Service/Role/Dto/RoleInput.cs +++ b/Api/Ewide.Core/Service/Role/Dto/RoleInput.cs @@ -5,7 +5,7 @@ namespace Ewide.Core.Service /// /// 角色参数 /// - public class RoleInput : XnInputBase + public class RoleInput : InputBase { /// /// 名称 diff --git a/Api/Ewide.Core/Service/Role/SysRoleService.cs b/Api/Ewide.Core/Service/Role/SysRoleService.cs index 7813dba..9646c1a 100644 --- a/Api/Ewide.Core/Service/Role/SysRoleService.cs +++ b/Api/Ewide.Core/Service/Role/SysRoleService.cs @@ -70,7 +70,7 @@ namespace Ewide.Core.Service (code, u => EF.Functions.Like(u.Code, $"%{input.Code.Trim()}%"))) .Where(u => u.Status == (int)CommonStatus.ENABLE).OrderBy(u => u.Sort) .ToPageData(input); - return XnPageResult.PageResult(roles); + return PageDataResult.PageResult(roles); } /// diff --git a/Api/Ewide.Core/Service/Tenant/SysTenantService.cs b/Api/Ewide.Core/Service/Tenant/SysTenantService.cs index 5bf7b2c..4314b01 100644 --- a/Api/Ewide.Core/Service/Tenant/SysTenantService.cs +++ b/Api/Ewide.Core/Service/Tenant/SysTenantService.cs @@ -38,8 +38,8 @@ namespace Ewide.Core.Service .Where((name, u => EF.Functions.Like(u.Name, $"%{input.Name.Trim()}%")), (host, u => EF.Functions.Like(u.Host, $"%{input.Host.Trim()}%"))) .Select(u => u.Adapt()) - .ToPagedListAsync(input.PageNo, input.PageSize); - return XnPageResult.PageResult(tenants); + .ToPagedListAsync(input.PageIndex, input.PageSize); + return PageDataResult.PageResult(tenants); } /// diff --git a/Api/Ewide.Core/Service/Timer/SysTimerService.cs b/Api/Ewide.Core/Service/Timer/SysTimerService.cs index 690b239..96f57d4 100644 --- a/Api/Ewide.Core/Service/Timer/SysTimerService.cs +++ b/Api/Ewide.Core/Service/Timer/SysTimerService.cs @@ -40,13 +40,13 @@ namespace Ewide.Core.Service var timers = await _sysTimerRep.DetachedEntities .Where((jobName, u => EF.Functions.Like(u.JobName, $"%{input.JobName.Trim()}%"))) .Select(u => u.Adapt()) - .ToPagedListAsync(input.PageNo, input.PageSize); + .ToPagedListAsync(input.PageIndex, input.PageSize); timers.Items.ToList().ForEach(u => { u.DisplayState = jobList.Find(m => m.JobName == u.JobName)?.DisplayState; }); - return XnPageResult.PageResult(timers); + return PageDataResult.PageResult(timers); } /// diff --git a/Api/Ewide.Core/Service/User/Dto/UserInput.cs b/Api/Ewide.Core/Service/User/Dto/UserInput.cs index c31572b..28068f9 100644 --- a/Api/Ewide.Core/Service/User/Dto/UserInput.cs +++ b/Api/Ewide.Core/Service/User/Dto/UserInput.cs @@ -6,7 +6,7 @@ namespace Ewide.Core.Service /// /// 用户参数 /// - public class UserInput : XnInputBase + public class UserInput : InputBase { /// /// 账号 diff --git a/Api/Ewide.Core/Service/User/Dto/UserOutput.cs b/Api/Ewide.Core/Service/User/Dto/UserOutput.cs index 88bb1c9..384bbb6 100644 --- a/Api/Ewide.Core/Service/User/Dto/UserOutput.cs +++ b/Api/Ewide.Core/Service/User/Dto/UserOutput.cs @@ -62,6 +62,16 @@ namespace Ewide.Core.Service /// public virtual int Status { get; set; } + /// + /// 所在机构名称 + /// + public virtual string OrgName { get; set; } + + /// + /// 角色名称 + /// + public virtual string RoleName { get; set; } + /// /// 员工信息 /// diff --git a/Api/Ewide.Core/Service/User/SysUserService.cs b/Api/Ewide.Core/Service/User/SysUserService.cs index 913e0e8..48ab4ad 100644 --- a/Api/Ewide.Core/Service/User/SysUserService.cs +++ b/Api/Ewide.Core/Service/User/SysUserService.cs @@ -69,7 +69,7 @@ namespace Ewide.Core.Service .Where(input.SearchStatus >= 0, x => x.n.u.Status == input.SearchStatus) .Where(!superAdmin, x => x.n.u.AdminType != AdminType.SuperAdmin) .Where(!superAdmin && dataScopes.Count > 0, x => dataScopes.Contains(x.n.e.OrgId)) - .Select(u => u.n.u.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); + .Select(u => u.n.u.Adapt()).ToPagedListAsync(input.PageIndex, input.PageSize); //var emps = new List>(); //users.Items.ToList().ForEach(u => @@ -81,7 +81,7 @@ namespace Ewide.Core.Service { user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id); } - return XnPageResult.PageResult(users); + return PageDataResult.PageResult(users); } /// diff --git a/Api/Ewide.Web.Core/Startup.cs b/Api/Ewide.Web.Core/Startup.cs index 72bab9d..c788192 100644 --- a/Api/Ewide.Web.Core/Startup.cs +++ b/Api/Ewide.Web.Core/Startup.cs @@ -23,7 +23,7 @@ namespace Ewide.Web.Core services.AddControllersWithViews() .AddMvcFilter() - .AddInjectWithUnifyResult() + .AddInjectWithUnifyResult() // 在管道中增加NewtonsoftJson,防止参数类型严格验证 .AddNewtonsoftJson(options => { options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; diff --git a/Web/src/components/yoList/index.js b/Web/src/components/yoList/index.js index 29a6665..b532d75 100644 --- a/Web/src/components/yoList/index.js +++ b/Web/src/components/yoList/index.js @@ -1,6 +1,6 @@ export default { props: { - pageNo: { + pageIndex: { default: 1, type: Number, }, @@ -21,7 +21,7 @@ export default { data: [], pagination: { - current: this.pageNo, + current: this.pageIndex, pageSize: this.pageSize, total: 0, size: 'small', @@ -52,38 +52,41 @@ export default { this.onLoading() this.loadData({ - pageNo: this.pagination.current, + pageIndex: this.pagination.current, pageSize: this.pagination.pageSize, ...this.sorter }).then((res) => { - this.data = res.rows - this.pagination.total = res.totalRows + this.data = res.rows || res.data || res.items + this.pagination.total = res.totalCount this.onLoaded() }) }, onReloadData(refresh = false) { if (refresh && refresh.constructor === Boolean && this.pagination.constructor === Object) { - this.pagination.current = this.pageNo + this.pagination.current = this.pageIndex this.pagination.pageSize = this.pageSize } this.onLoadData() }, + onListChange(current, pageSize) { + this.pagination.current = current + this.pagination.pageSize = pageSize + this.onLoadData() + } + }, render() { const props = { loading: this.loading, - pagination: this.pagination, dataSource: this.data, rowKey: record => record.id, ...this.$attrs } - const on = { - //change: this.onTableChange - } + const on = {} return (
@@ -101,6 +104,7 @@ export default { ))} +
) }, diff --git a/Web/src/components/yoTable/index.js b/Web/src/components/yoTable/index.js index 4c64ca2..a698cf9 100644 --- a/Web/src/components/yoTable/index.js +++ b/Web/src/components/yoTable/index.js @@ -3,7 +3,7 @@ import ColumnSetting from './column' export default { props: { - pageNo: { + pageIndex: { default: 1, type: Number, }, @@ -33,7 +33,7 @@ export default { data: [], pagination: { - current: this.pageNo, + current: this.pageIndex, pageSize: this.pageSize, total: 0, size: 'small', @@ -102,15 +102,15 @@ export default { this.onLoading() this.loadData({ - pageNo: this.pagination.current, + pageIndex: this.pagination.current, pageSize: this.pagination.pageSize, ...this.sorter }).then((res) => { - if (res.rows) { + if (res.rows || res.data || res.items) { // 普通表格 this.type = 'table' - this.data = res.rows - this.pagination.total = res.totalRows + this.data = res.rows || res.data || res.items + this.pagination.total = res.totalCount } else if (res) { // 树形表格 this.type = 'tree' @@ -124,7 +124,7 @@ export default { onReloadData(refresh = false) { if (refresh && refresh.constructor === Boolean && this.pagination.constructor === Object) { - this.pagination.current = this.pageNo + this.pagination.current = this.pageIndex this.pagination.pageSize = this.pageSize } this.onLoadData()