fix 就餐人员列表查询根据消费记录显示

This commit is contained in:
2024-11-13 16:11:23 +08:00
parent e2bb6d5d0e
commit 3a47580441
2 changed files with 9 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
using Dlhis.Canteen.Order.Repository;
using Dlhis.Canteen.Order.Response;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Canteen.Entities;
@@ -8,12 +9,12 @@ namespace Dlhis.Canteen.Order.Services.Implements;
public class MiddleService : IMiddleService
{
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;
_balanceService = balanceService;
_balanceRepository = balanceRepository;
}
/// <inheritdoc />
@@ -27,6 +28,8 @@ public class MiddleService : IMiddleService
await _dbContext.InsertAsync(entity);
}
var balance = await _balanceRepository.GetBalanceAsync(entity.UserCode, string.Empty);
//获取人员余额
return await _dbContext.Queryable<GainfoEntity>()
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
@@ -37,7 +40,7 @@ public class MiddleService : IMiddleService
UserName = x.Name,
DepartmentNo = x.DepartmentNo,
DepartmentName = department.Name,
//CurrentBalance = x.Balance todo 余额
CurrentBalance = balance
})
.SingleAsync();
}