update 动态参数查询page增加后端字段控制
This commit is contained in:
@@ -31,10 +31,11 @@ namespace Ewide.Core.Extension
|
||||
var type = typeof(T);
|
||||
var hasId = type.GetProperty("Id") != null;
|
||||
var hasSort = type.GetProperty("Sort") != null;
|
||||
var hasCreatedTime = type.GetProperty("CreatedTime") != null;
|
||||
|
||||
var defaultField = hasSort ? "Sort" : (hasId ? "Id" : "");
|
||||
var defaultField = hasCreatedTime ? "CreatedTime" : hasSort ? "Sort" : hasId ? "Id" : "";
|
||||
|
||||
// 约定默认每张表都有Id排序
|
||||
// 排序优先级 创建时间->序号->ID
|
||||
var orderStr = string.IsNullOrEmpty(defaultField) ? "" : defaultField + (descSort ? " Desc" : " Asc");
|
||||
|
||||
// 排序是否可用-排序字段和排序顺序都为非空才启用排序
|
||||
@@ -125,9 +126,9 @@ namespace Ewide.Core.Extension
|
||||
}
|
||||
|
||||
#region DAPPER
|
||||
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, object param = null, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, object param = null, IEnumerable<string> filterFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
{
|
||||
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, equalsFields, likeFields, dateTimeRangeFields, otherRangeFields, param);
|
||||
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, filterFields, param);
|
||||
var sql = searchJsonFitlerInfoGetService.GetWhereSql(baseSql);
|
||||
var sqlParam = searchJsonFitlerInfoGetService.sqlParameters;
|
||||
return await QueryPageData(source, sql, input, sqlParam, transaction, commandTimeout, commandType);
|
||||
|
||||
Reference in New Issue
Block a user