fix 数据过滤

This commit is contained in:
2024-04-07 19:35:58 +08:00
parent 249a672195
commit 9ce6e3b5e8
2 changed files with 8 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
using Dlhis.Entity.Basic.Entity;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Core.DataAccess.Dto;
using Kurisu.Core.User.Abstractions;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
@@ -10,17 +11,22 @@ namespace Dlhis.Basic.MealUser.Services.Implements;
public class MealUserService : IMealUserService
{
private readonly IDbContext _dbContext;
private readonly ICurrentUser _currentUser;
public MealUserService(IDbContext dbContext)
public MealUserService(IDbContext dbContext, ICurrentUser currentUser)
{
_dbContext = dbContext;
_currentUser = currentUser;
}
public async Task<Pagination<MealUserResponse>> GetPageAsync(PageDto request)
{
var tenantId = _currentUser.GetStringTenantId();
var page = await _dbContext.Queryable<GainfoEntity>()
.LeftJoin<GainfoMealEntity>((x, meal) => x.No == meal.UserNo)
.LeftJoin<GainfoMealEntity>((x, meal) => x.Code == meal.UserCode)
.WhereIF(request.Search.IsPresent(), (x, meal) => x.Code == request.Search || x.Name == request.Search)
.Where(x => x.Factory == tenantId)
.Select((x, meal) => new MealUserResponse
{
Balance = meal.Balance,