fix 餐补数据分页

This commit is contained in:
2024-04-02 14:11:11 +08:00
parent 867c212222
commit fb41e05c42
3 changed files with 10 additions and 5 deletions

View File

@@ -13,11 +13,11 @@ namespace Dlhis.Canteen.MealSupplementRecord.Controller;
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class MealSupplementRecordController
public class MealSupplementsRecordController
{
private readonly IMealSupplementRecordService _mealSupplementRecordService;
public MealSupplementRecordController(IMealSupplementRecordService mealSupplementRecordService)
public MealSupplementsRecordController(IMealSupplementRecordService mealSupplementRecordService)
{
_mealSupplementRecordService = mealSupplementRecordService;
}

View File

@@ -1,8 +1,12 @@
using Kurisu.Core.DataAccess.Dto;
using Kurisu.Core.CustomClass;
using Kurisu.Core.DataAccess.Dto;
namespace Dlhis.Canteen.MealSupplementRecord.Request;
public class MealSupplementRecordRequest : PageDto
{
/// <summary>
/// 餐补日期范围
/// </summary>
public DateTimePeriod DateTimePeriod { get; set; }
}

View File

@@ -1,6 +1,5 @@
using Dlhis.Canteen.MealSupplementRecord.Request;
using Dlhis.Canteen.MealSupplementRecord.Response;
using Dlhis.Canteen.MealSupplementRecord.Services;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Canteen.Entities;
using Kurisu.AspNetCore.Utils.Extensions;
@@ -25,6 +24,8 @@ public class MealSupplementRecordService : IMealSupplementRecordService
var page = await _dbContext.Queryable<MealSupplementRecordEntity>()
.LeftJoin<GainfoEntity>((x, ga) => x.Code == ga.Code)
.WhereIF(request.Search.IsPresent(), (x, ga) => x.Code == request.Search || ga.Name.Contains(request.Search))
.WhereIF(request.DateTimePeriod?.Start.HasValue == true && request.DateTimePeriod?.End.HasValue == true,
x => x.Date >= request.DateTimePeriod.Start && x.Date <= request.DateTimePeriod.End)
.Select((x, ga) => new MealSupplementRecordResponse
{
Amount = x.Amount,