Merge branch 'master' of http://118.178.224.202:3000/ewide/ewide_core
This commit is contained in:
@@ -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; }
|
||||
|
||||
@@ -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<HouseProjectOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return XnPageResult<HouseProjectOutput>.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<HouseProjectOutput>()).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<HouseProjectOutput>.PageResult(projects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Ewide.Core
|
||||
/// 管理员类型-超级管理员_1、非管理员_2
|
||||
/// </summary>
|
||||
[Comment("管理员类型-超级管理员_1、非管理员_2")]
|
||||
public AdminType AdminType { get; set; }
|
||||
public AdminType AdminType { get; set; } = AdminType.None;
|
||||
|
||||
/// <summary>
|
||||
/// 状态-正常_0、停用_1、删除_2
|
||||
|
||||
@@ -2528,27 +2528,27 @@
|
||||
</summary>
|
||||
<param name="dict"></param>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.XnInputBase">
|
||||
<member name="T:Ewide.Core.InputBase">
|
||||
<summary>
|
||||
通用输入扩展参数(带权限)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnInputBase.GrantMenuIdList">
|
||||
<member name="P:Ewide.Core.InputBase.GrantMenuIdList">
|
||||
<summary>
|
||||
授权菜单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnInputBase.GrantRoleIdList">
|
||||
<member name="P:Ewide.Core.InputBase.GrantRoleIdList">
|
||||
<summary>
|
||||
授权角色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnInputBase.GrantOrgIdList">
|
||||
<member name="P:Ewide.Core.InputBase.GrantOrgIdList">
|
||||
<summary>
|
||||
授权数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnInputBase.GrantAreaCodeList">
|
||||
<member name="P:Ewide.Core.InputBase.GrantAreaCodeList">
|
||||
<summary>
|
||||
授权区域
|
||||
</summary>
|
||||
@@ -2563,7 +2563,7 @@
|
||||
搜索值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.PageInputBase.PageNo">
|
||||
<member name="P:Ewide.Core.PageInputBase.PageIndex">
|
||||
<summary>
|
||||
当前页码
|
||||
</summary>
|
||||
@@ -2598,25 +2598,25 @@
|
||||
降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.XnPageResult`1">
|
||||
<member name="T:Ewide.Core.PageDataResult`1">
|
||||
<summary>
|
||||
小诺分页列表结果
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.XnRestfulResultProvider">
|
||||
<member name="T:Ewide.Core.RestfulResultProvider">
|
||||
<summary>
|
||||
规范化RESTful风格返回值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.XnRestfulResultProvider.OnException(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)">
|
||||
<member name="M:Ewide.Core.RestfulResultProvider.OnException(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)">
|
||||
<summary>
|
||||
异常返回值
|
||||
</summary>
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.XnRestfulResultProvider.OnResponseStatusCodes(Microsoft.AspNetCore.Http.HttpContext,System.Int32,Furion.UnifyResult.UnifyResultStatusCodesOptions)">
|
||||
<member name="M:Ewide.Core.RestfulResultProvider.OnResponseStatusCodes(Microsoft.AspNetCore.Http.HttpContext,System.Int32,Furion.UnifyResult.UnifyResultStatusCodesOptions)">
|
||||
<summary>
|
||||
处理输出状态码
|
||||
</summary>
|
||||
@@ -2625,14 +2625,14 @@
|
||||
<param name="options"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.XnRestfulResultProvider.OnSucceeded(Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext)">
|
||||
<member name="M:Ewide.Core.RestfulResultProvider.OnSucceeded(Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext)">
|
||||
<summary>
|
||||
成功返回值
|
||||
</summary>
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.XnRestfulResultProvider.OnValidateFailed(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Collections.Generic.IEnumerable{Furion.DataValidation.ValidateFailedModel},System.String)">
|
||||
<member name="M:Ewide.Core.RestfulResultProvider.OnValidateFailed(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Collections.Generic.IEnumerable{Furion.DataValidation.ValidateFailedModel},System.String)">
|
||||
<summary>
|
||||
验证失败返回值
|
||||
</summary>
|
||||
@@ -2642,38 +2642,38 @@
|
||||
<param name="validateFailedMessage"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.XnRestfulResult`1">
|
||||
<member name="T:Ewide.Core.RestfulResult`1">
|
||||
<summary>
|
||||
RESTful风格---XIAONUO返回格式
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Success">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Success">
|
||||
<summary>
|
||||
执行成功
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Code">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Code">
|
||||
<summary>
|
||||
状态码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Message">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Message">
|
||||
<summary>
|
||||
错误信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Data">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Data">
|
||||
<summary>
|
||||
数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Extras">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Extras">
|
||||
<summary>
|
||||
附加数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.XnRestfulResult`1.Timestamp">
|
||||
<member name="P:Ewide.Core.RestfulResult`1.Timestamp">
|
||||
<summary>
|
||||
时间戳
|
||||
</summary>
|
||||
@@ -3696,51 +3696,6 @@
|
||||
表名称描述(注释)(功能名)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.AuthorName">
|
||||
<summary>
|
||||
作者姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.TablePrefix">
|
||||
<summary>
|
||||
是否移除表前缀
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.GenerateType">
|
||||
<summary>
|
||||
生成方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.TableName">
|
||||
<summary>
|
||||
数据库表名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.TableNameAss">
|
||||
<summary>
|
||||
数据库表名(经过组装的)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.PackageName">
|
||||
<summary>
|
||||
代码包名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.CreateTimestring">
|
||||
<summary>
|
||||
生成时间(string类型的)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.ConfigList">
|
||||
<summary>
|
||||
数据库表中字段集合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.XnCodeGenOutput.BusName">
|
||||
<summary>
|
||||
业务名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.Service.ConfigInput">
|
||||
<summary>
|
||||
参数配置
|
||||
@@ -6793,6 +6748,16 @@
|
||||
状态-正常_0、停用_1、删除_2
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.UserOutput.OrgName">
|
||||
<summary>
|
||||
所在机构名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.UserOutput.RoleName">
|
||||
<summary>
|
||||
角色名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.UserOutput.SysEmpInfo">
|
||||
<summary>
|
||||
员工信息
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ewide.Core
|
||||
/// <summary>
|
||||
/// 通用输入扩展参数(带权限)
|
||||
/// </summary>
|
||||
public class XnInputBase : PageInputBase
|
||||
public class InputBase : PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 授权菜单
|
||||
@@ -40,7 +40,7 @@ namespace Ewide.Core
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public virtual int PageNo { get; set; } = 1;
|
||||
public virtual int PageIndex { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码容量
|
||||
38
Api/Ewide.Core/Extension/PageDataResult.cs
Normal file
38
Api/Ewide.Core/Extension/PageDataResult.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 小诺分页列表结果
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static class PageDataResult<T> where T : new()
|
||||
{
|
||||
public static dynamic PageResult(PagedList<T> 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,34 +43,86 @@ namespace Ewide.Core.Extension
|
||||
|
||||
public static Task<PagedList<T>> ToPageData<T>(this IQueryable<T> source, PageInputBase input) where T : new()
|
||||
{
|
||||
return source.OrderBy(OrderBuilder<T>(input)).ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return source.OrderBy(OrderBuilder<T>(input)).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public static Task<PagedList<O>> ToPageData<T, O>(this IQueryable<T> source, PageInputBase input) where O : new()
|
||||
{
|
||||
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>()).ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>()).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public static Task<IEnumerable<dynamic>> 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<PagedList> 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.PageIndex,
|
||||
PageSize = input.PageSize,
|
||||
Items = data,
|
||||
TotalCount = count,
|
||||
TotalPages = (int)Math.Ceiling((decimal)count / (decimal)input.PageSize)
|
||||
};
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public static Task<IEnumerable<T>> QueryPageData<T>(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
public async static Task<PagedList<T>> QueryPageData<T>(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<T>(
|
||||
var count = await source.PageTotalCount(
|
||||
sql,
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var data = await source.QueryAsync<T>(
|
||||
PageSqlBuilder(sql, input),
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var page = new PagedList<T>
|
||||
{
|
||||
PageIndex = input.PageIndex,
|
||||
PageSize = input.PageSize,
|
||||
Items = data,
|
||||
TotalCount = count,
|
||||
TotalPages = (int)Math.Ceiling((decimal)count / (decimal)input.PageSize)
|
||||
};
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
private async static Task<int> 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<int>(
|
||||
countSql,
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType);
|
||||
var count = countAsync.SingleOrDefault();
|
||||
return count;
|
||||
}
|
||||
|
||||
private static string PageSqlBuilder(string sql , PageInputBase input)
|
||||
@@ -79,9 +131,10 @@ 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;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Ewide.Core
|
||||
/// <summary>
|
||||
/// 规范化RESTful风格返回值
|
||||
/// </summary>
|
||||
[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<object>
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCode,
|
||||
Success = false,
|
||||
@@ -65,7 +65,7 @@ namespace Ewide.Core
|
||||
{
|
||||
// 处理 401 状态码
|
||||
case StatusCodes.Status401Unauthorized:
|
||||
await context.Response.WriteAsJsonAsync(new XnRestfulResult<object>
|
||||
await context.Response.WriteAsJsonAsync(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCodes.Status401Unauthorized,
|
||||
Success = false,
|
||||
@@ -77,7 +77,7 @@ namespace Ewide.Core
|
||||
break;
|
||||
// 处理 403 状态码
|
||||
case StatusCodes.Status403Forbidden:
|
||||
await context.Response.WriteAsJsonAsync(new XnRestfulResult<object>
|
||||
await context.Response.WriteAsJsonAsync(new RestfulResult<object>
|
||||
{
|
||||
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<object>
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK, // 处理没有返回值情况 204
|
||||
Success = true,
|
||||
@@ -129,7 +129,7 @@ namespace Ewide.Core
|
||||
/// <returns></returns>
|
||||
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, IEnumerable<ValidateFailedModel> validationResults, string validateFailedMessage)
|
||||
{
|
||||
return DisplayJson(new XnRestfulResult<object>
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCodes.Status400BadRequest,
|
||||
Success = false,
|
||||
@@ -146,7 +146,7 @@ namespace Ewide.Core
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[SkipScan]
|
||||
public class XnRestfulResult<T>
|
||||
public class RestfulResult<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行成功
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 小诺分页列表结果
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static class XnPageResult<T> where T : new()
|
||||
{
|
||||
public static dynamic PageResult(PagedList<T> page)
|
||||
{
|
||||
return new
|
||||
{
|
||||
PageNo = page.PageIndex,
|
||||
PageSize = page.PageSize,
|
||||
TotalPage = page.TotalPages,
|
||||
TotalRows = page.TotalCount,
|
||||
Rows = page.Items //.Adapt<List<T>>(),
|
||||
//Rainbow = PageUtil.Rainbow(page.PageIndex, page.TotalPages, PageUtil.RAINBOW_NUM)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ namespace Ewide.Core.Service
|
||||
u => EF.Functions.Like(u.Code, $"%{input.Code.Trim()}%")
|
||||
)
|
||||
.ToPageData(input);
|
||||
return XnPageResult<SysApp>.PageResult(apps);
|
||||
return PageDataResult<SysApp>.PageResult(apps);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<SysAreaCode>.PageResult(AreaCodes);
|
||||
return PageDataResult<SysAreaCode>.PageResult(AreaCodes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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<SysCodeGen>.PageResult(codeGens);
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<SysCodeGen>.PageResult(codeGens);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 代码生成参数类
|
||||
/// </summary>
|
||||
public class CodeGenInput : XnInputBase
|
||||
public class CodeGenInput : InputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 作者姓名
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
public class XnCodeGenOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 作者姓名
|
||||
/// </summary>
|
||||
public string AuthorName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否移除表前缀
|
||||
/// </summary>
|
||||
public string TablePrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成方式
|
||||
/// </summary>
|
||||
public string GenerateType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名(经过组装的)
|
||||
/// </summary>
|
||||
public string TableNameAss { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代码包名
|
||||
/// </summary>
|
||||
public string PackageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成时间(string类型的)
|
||||
/// </summary>
|
||||
public string CreateTimestring { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表中字段集合
|
||||
/// </summary>
|
||||
public List<SysCodeGenConfig> ConfigList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务名
|
||||
/// </summary>
|
||||
public string BusName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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<SysConfig>.PageResult(configs);
|
||||
return PageDataResult<SysConfig>.PageResult(configs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Ewide.Core.Service
|
||||
//.Select(u => u.Adapt<DictDataOutput>())
|
||||
// .ToPagedListAsync(input.PageNo, input.PageSize)
|
||||
.ToPageData<SysDictData, DictDataOutput>(input);
|
||||
return XnPageResult<DictDataOutput>.PageResult(dictDatas);
|
||||
return PageDataResult<DictDataOutput>.PageResult(dictDatas);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<SysDictType>.PageResult(dictTypes);
|
||||
return PageDataResult<SysDictType>.PageResult(dictTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<FileOutput>())
|
||||
.ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return XnPageResult<FileOutput>.PageResult(files);
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<FileOutput>.PageResult(files);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<SysLogOp, OpLogOutput>(input);
|
||||
return XnPageResult<OpLogOutput>.PageResult(opLogs);
|
||||
return PageDataResult<OpLogOutput>.PageResult(opLogs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<SysLogVis, VisLogOutput>(input);
|
||||
return XnPageResult<VisLogOutput>.PageResult(visLogs);
|
||||
return PageDataResult<VisLogOutput>.PageResult(visLogs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<SysNotice>.PageResult(notices);
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<SysNotice>.PageResult(notices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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<NoticeReceiveOutput>())
|
||||
.ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return XnPageResult<NoticeReceiveOutput>.PageResult(notices);
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<NoticeReceiveOutput>.PageResult(notices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 组织机构参数
|
||||
/// </summary>
|
||||
public class OrgInput : XnInputBase
|
||||
public class OrgInput : InputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 父Id
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Ewide.Core.Service
|
||||
.ToPageData<SysOrg,OrgOutput>(input);
|
||||
//.Select(u => u.Adapt<OrgOutput>())
|
||||
//.ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return XnPageResult<OrgOutput>.PageResult(orgs);
|
||||
return PageDataResult<OrgOutput>.PageResult(orgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<SysPos>.PageResult(pos);
|
||||
return PageDataResult<SysPos>.PageResult(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 角色参数
|
||||
/// </summary>
|
||||
public class RoleInput : XnInputBase
|
||||
public class RoleInput : InputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
|
||||
@@ -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<SysRole>.PageResult(roles);
|
||||
return PageDataResult<SysRole>.PageResult(roles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<TenantOutput>())
|
||||
.ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
return XnPageResult<TenantOutput>.PageResult(tenants);
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<TenantOutput>.PageResult(tenants);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<JobInput>())
|
||||
.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<JobInput>.PageResult(timers);
|
||||
return PageDataResult<JobInput>.PageResult(timers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 用户参数
|
||||
/// </summary>
|
||||
public class UserInput : XnInputBase
|
||||
public class UserInput : InputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号
|
||||
|
||||
@@ -62,6 +62,16 @@ namespace Ewide.Core.Service
|
||||
/// </summary>
|
||||
public virtual int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所在机构名称
|
||||
/// </summary>
|
||||
public virtual string OrgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
public virtual string RoleName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 员工信息
|
||||
/// </summary>
|
||||
|
||||
@@ -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<UserOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
|
||||
.Select(u => u.n.u.Adapt<UserOutput>()).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
|
||||
//var emps = new List<Task<EmpOutput>>();
|
||||
//users.Items.ToList().ForEach(u =>
|
||||
@@ -81,7 +81,7 @@ namespace Ewide.Core.Service
|
||||
{
|
||||
user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id);
|
||||
}
|
||||
return XnPageResult<UserOutput>.PageResult(users);
|
||||
return PageDataResult<UserOutput>.PageResult(users);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -54,6 +54,22 @@ namespace Ewide.Core
|
||||
if (_rootParentIds.Contains(u.GetPid()))
|
||||
results.Add(u);
|
||||
});
|
||||
|
||||
// 在未获取到根节点的情况下, 直接将最上级作为根节点
|
||||
if (results.Count < 1)
|
||||
{
|
||||
var ids = new List<string>();
|
||||
nodes.ForEach(u => {
|
||||
ids.Add(u.GetId());
|
||||
});
|
||||
|
||||
nodes.ForEach(u =>
|
||||
{
|
||||
if (!ids.Contains(u.GetPid()))
|
||||
results.Add(u);
|
||||
});
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Ewide.Web.Core
|
||||
|
||||
services.AddControllersWithViews()
|
||||
.AddMvcFilter<RequestActionFilter>()
|
||||
.AddInjectWithUnifyResult<XnRestfulResultProvider>()
|
||||
.AddInjectWithUnifyResult<RestfulResultProvider>()
|
||||
// 在管道中增加NewtonsoftJson,防止参数类型严格验证
|
||||
.AddNewtonsoftJson(options => {
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
@@ -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 (
|
||||
<section>
|
||||
<div class="yo-action-bar">
|
||||
@@ -101,6 +104,7 @@ export default {
|
||||
<template slot={name}>{this.$slots[name]}</template>
|
||||
))}
|
||||
</a-list>
|
||||
<a-pagination size="small" {... { props: this.pagination }} onChange={this.onListChange} onShowSizeChange={this.onListChange} />
|
||||
</section>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user