fix 消费查询匹配

This commit is contained in:
2024-03-23 01:53:57 +08:00
parent 7d18c8ea55
commit 9040bf8c95

View File

@@ -514,7 +514,13 @@ public class BalanceService : IBalanceService
public async Task<Pagination<BalanceRecordUserResponse>> GetPageByUserAsync(BalanceRecordUserPageRequest request)
{
//当前用户
var userId = _currentUser.GetIntSubjectId();
var subjectId = _currentUser.GetIntSubjectId();
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdentityUserId == subjectId).FirstAsync();
var jinkoCode = _currentUser.GetUserClaim("jinko-code") ?? string.Empty;
if (jinkoCode.IsPresent())
{
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == jinkoCode).FirstAsync();
}
var page = await _dbContext.Queryable<BalanceRecordEntity>()
.LeftJoin<GainfoEntity>((record, ga) => record.UserNo == ga.No)
@@ -525,7 +531,7 @@ public class BalanceService : IBalanceService
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, record => record.CostDate >= request.SearchDateTimePeriod.Start)
.WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, record => record.CostDate <= request.SearchDateTimePeriod.End)
.WhereIF(request.ApplicationType.HasValue, record => record.ApplicationType == request.ApplicationType)
.Where((record, ga) => ga.IdentityUserId == userId)
.Where((record, ga) => ga.Code == gainfo.Code)
.OrderBy(record => record.CreateTime, OrderByType.Desc)
.Select((record, ga, department, bplace, bshiftR, shift) => new BalanceRecordUserResponse
{