using Dlhis.Basic.BusinessPlace.Request;
using Dlhis.Basic.BusinessPlace.Response;
using Dlhis.Basic.BusinessPlace.Services;
using Dlhis.Basic.BusinessShift.Services;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Basic.BusinessPlace.Controllers;
///
/// 营业点
///
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class BusinessPlacesController : ControllerBase
{
private readonly IBusinessPlaceService _businessPlaceService;
private readonly IBusinessPlaceShiftService _businessPlaceShiftService;
public BusinessPlacesController(IBusinessPlaceService businessPlaceService,
IBusinessPlaceShiftService businessPlaceShiftService)
{
_businessPlaceService = businessPlaceService;
_businessPlaceShiftService = businessPlaceShiftService;
}
///
/// 营业点分页
///
///
///
[HttpGet("page")]
public async Task> GetPageAsync([FromQuery] BusinessPlacePageRequest request)
{
return await _businessPlaceService.GetPageAsync(request);
}
///
/// 获取启用的营业点
///
///
[HttpGet("list")]
public async Task> GetOpenedListAsync()
{
return await _businessPlaceService.GetOpenedListAsync();
}
///
/// 营业点保存
///
///
///
[HttpPost("save")]
public async Task SaveAsync(BusinessPlaceSaveRequest request)
{
await _businessPlaceService.SaveAsync(request);
}
///
/// 根据手工号获取餐别
///
///
///
[AllowAnonymous]
[HttpPost("shifts")]
public async Task GetShiftsByPlaceCustomCodeHttpPostAsync(BusinessPlaceGetShiftsRequest request)
{
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(request.CustomCode);
}
///
/// 根据手工号获取餐别
///
///
///
[AllowAnonymous]
[HttpGet("shifts")]
public async Task GetShiftsByPlaceCustomCodeHttpGetAsync([FromQuery] BusinessPlaceGetShiftsRequest request)
{
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(request.CustomCode);
}
}