35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using Dlhis.Basic.MealUser.Response;
|
|
using Dlhis.Entity.Basic.Entity;
|
|
using Kurisu.Core.DataAccess.Dto;
|
|
using Kurisu.SqlSugar.Extensions;
|
|
using Kurisu.SqlSugar.Services;
|
|
|
|
namespace Dlhis.Basic.MealUser.Services.Implements;
|
|
|
|
public class MealUserService : IMealUserService
|
|
{
|
|
private readonly IDbContext _dbContext;
|
|
|
|
public MealUserService(IDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
public async Task<Pagination<MealUserResponse>> GetPageAsync(PageDto request)
|
|
{
|
|
var page = await _dbContext.Queryable<GainfoMealEntity>()
|
|
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
|
.Select((x, ga) => new MealUserResponse
|
|
{
|
|
Balance = x.Balance,
|
|
BalanceOfRecharge = x.BalanceOfRecharge,
|
|
BalanceOfSubsidies = x.BalanceOfSubsidies,
|
|
UserCode = ga.Code,
|
|
UserNo = ga.No,
|
|
})
|
|
.ToPageListAsync(request);
|
|
|
|
return page;
|
|
}
|
|
}
|