fix 数据过滤
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user