@@ -13,5 +13,35 @@ namespace Yi.Framework.Ddd.Application.Contracts
|
|||||||
/// 查询结束时间条件
|
/// 查询结束时间条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EndTime { get; set; }
|
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)
|
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
|
||||||
{
|
{
|
||||||
RefAsync<int> total = 0;
|
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!))
|
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(!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)
|
.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);
|
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||||
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
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)
|
public override async Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||||
{
|
{
|
||||||
RefAsync<int> total = 0;
|
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!))
|
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.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)
|
.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);
|
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||||
return new PagedResultDto<OperationLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
return new PagedResultDto<OperationLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,9 +181,13 @@ function handleSelectionChange(selection) {
|
|||||||
}
|
}
|
||||||
/** 排序触发事件 */
|
/** 排序触发事件 */
|
||||||
function handleSortChange(column, prop, order) {
|
function handleSortChange(column, prop, order) {
|
||||||
queryParams.value.orderByColumn = column.prop;
|
if (!column.order) {
|
||||||
queryParams.value.isAsc = column.order;
|
queryParams.value.orderByColumn = null;
|
||||||
getList();
|
} else {
|
||||||
|
queryParams.value.orderByColumn = column.prop;
|
||||||
|
}
|
||||||
|
queryParams.value.isAsc = column.order;
|
||||||
|
getList();
|
||||||
}
|
}
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
|
|||||||
@@ -202,7 +202,8 @@ const data = reactive({
|
|||||||
title: undefined,
|
title: undefined,
|
||||||
operUser: undefined,
|
operUser: undefined,
|
||||||
operType: undefined,
|
operType: undefined,
|
||||||
state: undefined
|
state: undefined,
|
||||||
|
orderByColumn: undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -240,8 +241,12 @@ function handleSelectionChange(selection) {
|
|||||||
}
|
}
|
||||||
/** 排序触发事件 */
|
/** 排序触发事件 */
|
||||||
function handleSortChange(column, prop, order) {
|
function handleSortChange(column, prop, order) {
|
||||||
queryParams.value.orderByColumn = column.prop;
|
if (!column.order) {
|
||||||
queryParams.value.isAsc = column.order;
|
queryParams.value.orderByColumn = null;
|
||||||
|
} else {
|
||||||
|
queryParams.value.orderByColumn = column.prop;
|
||||||
|
}
|
||||||
|
queryParams.value.isAsc = column.order;
|
||||||
getList();
|
getList();
|
||||||
}
|
}
|
||||||
/** 详细按钮操作 */
|
/** 详细按钮操作 */
|
||||||
|
|||||||
Reference in New Issue
Block a user