feat 获取菜品
This commit is contained in:
@@ -7,7 +7,6 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|||||||
using Kurisu.Core.DataAccess.Dto;
|
using Kurisu.Core.DataAccess.Dto;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Org.BouncyCastle.Asn1.Ocsp;
|
|
||||||
|
|
||||||
namespace Dlhis.Basic.Dishes.Controller;
|
namespace Dlhis.Basic.Dishes.Controller;
|
||||||
|
|
||||||
@@ -52,6 +51,20 @@ public class DishesMenusController : ControllerBase
|
|||||||
return await _dishesMenuService.GetDishesMenuDetailAsync(businessPlaceCode, customCode, date);
|
return await _dishesMenuService.GetDishesMenuDetailAsync(businessPlaceCode, customCode, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据参数获取菜品
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="businessPlaceCode"></param>
|
||||||
|
/// <param name="date"></param>
|
||||||
|
/// <param name="shiftType"></param>
|
||||||
|
/// <param name="categoryCodes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("dishes-selections")]
|
||||||
|
public async Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, [FromQuery] List<Guid> categoryCodes)
|
||||||
|
{
|
||||||
|
return await _dishesMenuService.GetDishesUnderCurrentMenuAsync(businessPlaceCode, date, shiftType, categoryCodes);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单保存/更改
|
/// 菜单保存/更改
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public interface IDishesMenuService : IScopeDependency
|
|||||||
|
|
||||||
Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime date);
|
Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime date);
|
||||||
|
|
||||||
|
Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, List<Guid> categoryCodes);
|
||||||
|
|
||||||
Task SaveDishesMenuAsync(DishesMenuSaveRequest request);
|
Task SaveDishesMenuAsync(DishesMenuSaveRequest request);
|
||||||
|
|
||||||
Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode);
|
Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Dlhis.Basic.Dishes.Request;
|
|||||||
using Dlhis.Basic.Dishes.Response;
|
using Dlhis.Basic.Dishes.Response;
|
||||||
using Dlhis.Basic.BusinessPlace.Services;
|
using Dlhis.Basic.BusinessPlace.Services;
|
||||||
using Dlhis.Basic.Dishes.Dto;
|
using Dlhis.Basic.Dishes.Dto;
|
||||||
using Org.BouncyCastle.Asn1.Ocsp;
|
using Mapster;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||||
|
|
||||||
@@ -74,6 +74,21 @@ public class DishesMenuService : IDishesMenuService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, List<Guid> categoryCodes)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Queryable<DishesMenuEntity>()
|
||||||
|
.LeftJoin<DishesEntity>((x, dishes) => x.DishesCode == dishes.CustomCode)
|
||||||
|
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||||
|
.Where(x => SqlFunc.DateIsSame(x.Date, date, DateType.Day))
|
||||||
|
.Where((x, dishes) => dishes.Enable)
|
||||||
|
.WhereIF(shiftType.HasValue, x => x.ShiftType == shiftType)
|
||||||
|
.WhereIF(categoryCodes.IsPresent(), (x, dishes) => categoryCodes.Contains(dishes.CategoryCode))
|
||||||
|
.Select((x, dishes) => dishes)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data.Adapt<List<DishesDetailResponse>>();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task SaveDishesMenuAsync(DishesMenuSaveRequest request)
|
public async Task SaveDishesMenuAsync(DishesMenuSaveRequest request)
|
||||||
{
|
{
|
||||||
//检验数据
|
//检验数据
|
||||||
|
|||||||
Reference in New Issue
Block a user