Infrastructure/OpenAuth.App/ServiceApp/Achievement/InsAiShpApp.cs

32 lines
1.1 KiB
C#

using Infrastructure;
using OpenAuth.App.BaseApp.Base;
using OpenAuth.App.Interface;
using OpenAuth.App.ServiceApp.request;
using OpenAuth.Repository;
using OpenAuth.Repository.Domain;
using SqlSugar;
namespace OpenAuth.App.ServiceApp.Achievement;
public class InsAiShpApp : SqlSugarBaseApp<InsAishp, SugarDbContext>
{
public InsAiShpApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<InsAishp> repository,
IAuth auth) : base(unitWork, repository, auth)
{
}
public async Task<PageInfo<List<InsAishp>>> Load(InsAishpQuery req)
{
RefAsync<int> total = 0;
var result = await Repository.AsQueryable()
.WhereIF(req.StartTime != null, p => p.ShpDate >= req.StartTime)
.WhereIF(req.EndTime != null, p => p.ShpDate <= req.EndTime)
.WhereIF(!string.IsNullOrEmpty(req.Name), p => p.ShpName.Contains(req.Name))
.ToPageListAsync(req.page, req.limit, total);
return new PageInfo<List<InsAishp>>
{
Items = result,
Total = total
};
}
}