fix 券发放查询增加厂区

This commit is contained in:
2025-12-17 11:06:18 +08:00
parent 4bca8859ef
commit 54ed9e5933
5 changed files with 17 additions and 8 deletions

View File

@@ -1,6 +1,4 @@
using Dlhis.Basic.Vouchers.Request;
using Dlhis.Canteen.Order.Request;
using Dlhis.Canteen.Order.Response;
using Dlhis.Canteen.Tickets.Request;
using Dlhis.Canteen.Tickets.Services;
using Dlhis.Canteen.Voucher.Requests;
@@ -39,6 +37,7 @@ public class VouchersController : ControllerBase
/// <param name="request"></param>
/// <returns></returns>
[HttpGet("page")]
[IgnoreTenant]
public async Task<Pagination<VoucherPageResponse>> GetPageAsync([FromQuery] VoucherPageRequest request)
{
return await _namedResolver.GetService<IVoucherService>(request.Type.ToString() + "VoucherService").GetPageAsync(request);

View File

@@ -32,4 +32,9 @@ public class VoucherPageRequest : PageDto
/// 二级部门
/// </summary>
public string DepartmentNoSecond { get; set; }
/// <summary>
/// 筛选厂区
/// </summary>
public List<string> Factories { get; set; }
}

View File

@@ -26,12 +26,13 @@ public abstract class BaseVoucherService : IVoucherService
public async Task<Pagination<VoucherPageResponse>> GetPageAsync(VoucherPageRequest request)
{
var tenantId = _currentUser.GetStringTenantId();
//var tenantId = _currentUser.GetStringTenantId();
var pagination = await DbContext.Queryable<VoucherEntity>()
.LeftJoin<VoucherUserInfoEntity>((x, u) => x.No == u.VoucherNo)
.LeftJoin<GainfoEntity>((x, u, ga) => u.UserCode == ga.Code)
.Where((x, u) => x.Type == request.Type && u.Factory == tenantId)
.Where((x, u) => x.Type == request.Type)
.WhereIF(request.Factories.IsPresent(), (x, u) => request.Factories.Contains(u.Factory))
.WhereIF(request.UserCode.IsPresent(), (x, u, ga) => u.UserCode == request.UserCode)
.WhereIF(request.SearchDateTimePeriod.HasValue(),
(x, u, ga) => x.CreateTime >= request.SearchDateTimePeriod.Start &&