@@ -13,5 +13,35 @@ namespace Yi.Framework.Ddd.Application.Contracts
|
||||
/// 查询结束时间条件
|
||||
/// </summary>
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序列名,字段名对应前端
|
||||
/// </summary>
|
||||
public string? OrderByColumn { get; set; }
|
||||
/// <summary>
|
||||
/// 是否顺序,字段名对应前端
|
||||
/// </summary>
|
||||
public string? IsAsc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否顺序
|
||||
/// </summary>
|
||||
public bool CanAsc => IsAsc?.ToLower() == "ascending" ? true : false;
|
||||
private string _sorting;
|
||||
//排序引用
|
||||
public new string? Sorting
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!OrderByColumn.IsNullOrWhiteSpace())
|
||||
{
|
||||
return $"{OrderByColumn} {(CanAsc ? "ASC" : "DESC")}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return _sorting;
|
||||
}
|
||||
}
|
||||
set => _sorting = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,12 @@ namespace Yi.Framework.Rbac.Application.Services.RecordLog
|
||||
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
if (input.Sorting.IsNullOrWhiteSpace())
|
||||
input.Sorting = $"{nameof(LoginLogAggregateRoot.CreationTime)} Desc";
|
||||
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.LoginIp), x => x.LoginIp.Contains(input.LoginIp!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.LoginUser), x => x.LoginUser!.Contains(input.LoginUser!))
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.OrderByDescending(x => x.CreationTime)
|
||||
.OrderBy(input.Sorting)
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
@@ -24,10 +24,12 @@ namespace Yi.Framework.Rbac.Application.Services.RecordLog
|
||||
public override async Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
if (input.Sorting.IsNullOrWhiteSpace())
|
||||
input.Sorting = $"{nameof(OperationLogEntity.CreationTime)} Desc";
|
||||
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.OperUser), x => x.OperUser.Contains(input.OperUser!))
|
||||
.WhereIF(input.OperType is not null, x => x.OperType == input.OperType)
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.OrderByDescending(x => x.CreationTime)
|
||||
.OrderBy(input.Sorting)
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
return new PagedResultDto<OperationLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,11 @@ function handleSelectionChange(selection) {
|
||||
}
|
||||
/** 排序触发事件 */
|
||||
function handleSortChange(column, prop, order) {
|
||||
if (!column.order) {
|
||||
queryParams.value.orderByColumn = null;
|
||||
} else {
|
||||
queryParams.value.orderByColumn = column.prop;
|
||||
}
|
||||
queryParams.value.isAsc = column.order;
|
||||
getList();
|
||||
}
|
||||
|
||||
@@ -202,7 +202,8 @@ const data = reactive({
|
||||
title: undefined,
|
||||
operUser: undefined,
|
||||
operType: undefined,
|
||||
state: undefined
|
||||
state: undefined,
|
||||
orderByColumn: undefined
|
||||
}
|
||||
});
|
||||
|
||||
@@ -240,7 +241,11 @@ function handleSelectionChange(selection) {
|
||||
}
|
||||
/** 排序触发事件 */
|
||||
function handleSortChange(column, prop, order) {
|
||||
if (!column.order) {
|
||||
queryParams.value.orderByColumn = null;
|
||||
} else {
|
||||
queryParams.value.orderByColumn = column.prop;
|
||||
}
|
||||
queryParams.value.isAsc = column.order;
|
||||
getList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user