fix 查询设备号匹配问题
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Attributes;
|
||||
@@ -74,7 +75,7 @@ public class BalanceService : IBalanceService
|
||||
{
|
||||
now = request.SearchDate.Value;
|
||||
start = new DateTime(now.Year, now.Month, now.Day);
|
||||
end = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
|
||||
end = new DateTime(now.Year, now.Month, now.Day + 1);
|
||||
}
|
||||
|
||||
var device = await _dbContext.Queryable<DeviceEntity>()
|
||||
@@ -89,14 +90,15 @@ public class BalanceService : IBalanceService
|
||||
};
|
||||
}
|
||||
|
||||
var page = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
var query = _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.LeftJoin<GainfoEntity>((record, ga) => record.UserNo == ga.No)
|
||||
.LeftJoin<DepartmentEntity>((record, ga, department) => ga.DepartmentNo == department.No)
|
||||
.LeftJoin<CanteenBusinessPlaceEntity>((record, ga, department, bplace) => record.BusinessPlaceCode == bplace.Code)
|
||||
.LeftJoin<CanteenBusinessShiftEntity>((record, ga, department, bplace, bshift) => record.BusinessShiftCode == bshift.Code)
|
||||
.WhereIF(request.SearchDate.HasValue, record => record.CostDate >= start)
|
||||
.WhereIF(request.SearchDate.HasValue, record => record.CostDate <= end)
|
||||
.Where(record => record.DeviceInfo == device.Code.ToString() && record.TenantId == device.TenantId)
|
||||
.Where(record => record.TenantId == device.TenantId || (record.DeviceInfo == device.Code.ToString() || record.DeviceInfo == device.UniqueNo))
|
||||
.Where(record => record.Type == BalanceRecordTypeEnumType.Out && record.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.OrderBy(record => record.CreateTime, OrderByType.Desc)
|
||||
.Select((record, ga, department, bplace, bshift) => new BalanceRecordResponse
|
||||
{
|
||||
@@ -123,10 +125,11 @@ public class BalanceService : IBalanceService
|
||||
BusinessPlaceName = bplace.Name,
|
||||
BusinessShiftName = bshift.Name,
|
||||
CostDateTime = record.CreateTime // todo
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
});
|
||||
|
||||
return page;
|
||||
//.ToPageListAsync(request);
|
||||
await Console.Out.WriteLineAsync(query.ToSqlValue());
|
||||
return await query.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<Pagination<BalanceRecordUserResponse>> GetPageByUserAsync(BalanceRecordUserPageRequest request)
|
||||
|
||||
Reference in New Issue
Block a user