修复排序错误
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using JNPF;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.ViewEngine;
|
||||
using Mapster;
|
||||
@@ -23,13 +24,15 @@ namespace Tnb.Vengine.AppService;
|
||||
public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
{
|
||||
private readonly IViewEngine _viewEngine;
|
||||
private readonly ICacheManager _cache;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public VmodelAppService(IDataAccess da, IViewEngine viewEngine) : base(da)
|
||||
public VmodelAppService(IDataAccess da, IViewEngine viewEngine, ICacheManager cache) : base(da)
|
||||
{
|
||||
_viewEngine = viewEngine;
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,21 +62,19 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
public override async Task<VmPagedOutput> GetListAsync(VmGetListInput input)
|
||||
public override async Task<PagedOutput<dynamic>> GetListAsync(VmGetListInput input)
|
||||
{
|
||||
return await ListAsync(input.ToQueryInput());
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override async Task<PagedOutput<dynamic>> ListAsync(VmQueryInput input)
|
||||
{
|
||||
VmPagedOutput ret = new();
|
||||
var q = _db.Queryable<Vmodel>().WhereIF(!string.IsNullOrEmpty(input.k), a => a.vmCode.Contains(input.k!) || a.vmName.Contains(input.k!));
|
||||
RefAsync<int> total = 0;
|
||||
var data = await q.OrderBy(input.sort).ToPageListAsync((input.pnum - 1) * input.psize, input.psize, total);
|
||||
ret.total = total;
|
||||
ret.items = data.Adapt<List<DObject>>();
|
||||
return ret;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<VmPagedOutput> ListAsync(VmQueryInput input)
|
||||
{
|
||||
return base.ListAsync(input);
|
||||
return PagedOutput.Create(total, data.Adapt<List<dynamic>>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,6 +103,7 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
vm.vmCode = vm.vmCode.ToKebab();
|
||||
vm.navProps.ForEach(a => a.naviModel = null);
|
||||
await _db.Updateable(vm).WhereColumns(a => a.id).ExecuteCommandAsync();
|
||||
await _cache.DelAsync(_dataAccess.GetVmodelCacheKey(vm.id));
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -111,6 +113,7 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
public override async Task<dynamic> DeleteAsync(VmDeleteInput input)
|
||||
{
|
||||
var ret = await _db.Deleteable<Vmodel>(input.id).ExecuteCommandAsync();
|
||||
await _cache.DelAsync(_dataAccess.GetVmodelCacheKey(input.id!));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user