fix 就餐人员列表查询根据消费记录显示
This commit is contained in:
@@ -28,12 +28,12 @@ public class GainfoMealService : IGainfoMealService
|
|||||||
public async Task<Pagination<GainfoMealResponse>> GetPageAsync(GainfoMealPageRequest request)
|
public async Task<Pagination<GainfoMealResponse>> GetPageAsync(GainfoMealPageRequest request)
|
||||||
{
|
{
|
||||||
var factory = _currentUser.GetStringTenantId();
|
var factory = _currentUser.GetStringTenantId();
|
||||||
var factories = await GetWalletFactoriesAsync(_currentUser.GetStringTenantId());
|
var factories = await GetWalletFactoriesAsync(factory);
|
||||||
|
|
||||||
return await _dbContext.Queryable<GainfoEntity>().AS(request.IsLeave ? "GainfoLeave" : "Gainfo")
|
return await _dbContext.Queryable<GainfoEntity>().AS(request.IsLeave ? "GainfoLeave" : "Gainfo")
|
||||||
.LeftJoin<DepartmentEntity>((x, dept) => dept.No == x.DepartmentNo)
|
.LeftJoin<DepartmentEntity>((x, dept) => dept.No == x.DepartmentNo)
|
||||||
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search)
|
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search)
|
||||||
.Where(x => x.Factory == factory)
|
.Where(x => SqlFunc.Subqueryable<BalanceRecordEntity>().Where(p => p.UserCode == x.Code && p.TenantId == factory).Any())
|
||||||
.WhereIF(request.IsLeave && request.SearchDateTimePeriod.HasValue(), x => x.ResignationDate >= request.SearchDateTimePeriod.Start &&
|
.WhereIF(request.IsLeave && request.SearchDateTimePeriod.HasValue(), x => x.ResignationDate >= request.SearchDateTimePeriod.Start &&
|
||||||
x.ResignationDate <= request.SearchDateTimePeriod.End)
|
x.ResignationDate <= request.SearchDateTimePeriod.End)
|
||||||
.Select((x, dept) => new GainfoMealResponse
|
.Select((x, dept) => new GainfoMealResponse
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Dlhis.Canteen.Order.Repository;
|
||||||
using Dlhis.Canteen.Order.Response;
|
using Dlhis.Canteen.Order.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.Entity.Canteen.Entities;
|
using Dlhis.Entity.Canteen.Entities;
|
||||||
@@ -8,12 +9,12 @@ namespace Dlhis.Canteen.Order.Services.Implements;
|
|||||||
public class MiddleService : IMiddleService
|
public class MiddleService : IMiddleService
|
||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly IBalanceService _balanceService;
|
private readonly IBalanceRepository _balanceRepository;
|
||||||
|
|
||||||
public MiddleService(IDbContext dbContext, IBalanceService balanceService)
|
public MiddleService(IDbContext dbContext, IBalanceRepository balanceRepository)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_balanceService = balanceService;
|
_balanceRepository = balanceRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -27,6 +28,8 @@ public class MiddleService : IMiddleService
|
|||||||
await _dbContext.InsertAsync(entity);
|
await _dbContext.InsertAsync(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var balance = await _balanceRepository.GetBalanceAsync(entity.UserCode, string.Empty);
|
||||||
|
|
||||||
//获取人员余额
|
//获取人员余额
|
||||||
return await _dbContext.Queryable<GainfoEntity>()
|
return await _dbContext.Queryable<GainfoEntity>()
|
||||||
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
|
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
|
||||||
@@ -37,7 +40,7 @@ public class MiddleService : IMiddleService
|
|||||||
UserName = x.Name,
|
UserName = x.Name,
|
||||||
DepartmentNo = x.DepartmentNo,
|
DepartmentNo = x.DepartmentNo,
|
||||||
DepartmentName = department.Name,
|
DepartmentName = department.Name,
|
||||||
//CurrentBalance = x.Balance todo 余额
|
CurrentBalance = balance
|
||||||
})
|
})
|
||||||
.SingleAsync();
|
.SingleAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user