Files
jinko.yikatong/Src/Dlhis.Basic/Appointment/Controllers/AppointmentAreasController.cs
2024-10-11 11:55:00 +08:00

70 lines
2.3 KiB
C#

using Dlhis.Basic.Appointment.Request;
using Dlhis.Basic.Appointment.Response;
using Dlhis.Basic.Appointment.Services;
using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Basic.Appointment.Controllers;
/// <summary>
/// 预约区域
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class AppointmentAreasController : ControllerBase
{
private readonly IAppointmentAreaService _appointmentAreaService;
public AppointmentAreasController(IAppointmentAreaService appointmentAreaService)
{
_appointmentAreaService = appointmentAreaService;
}
/// <summary>
/// 保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("save")]
public async Task SaveAsync(AppointmentAreaSaveRequest request)
{
await _appointmentAreaService.SaveAsync(request);
}
/// <summary>
/// 预约区域分页
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpGet("page")]
public async Task<Pagination<AppointmentAreaPageResponse>> GetPageAsync([FromQuery] AppointmentAreaPageRequest request)
{
return await _appointmentAreaService.GetPageAsync(request);
}
/// <summary>
/// 分配设备
/// </summary>
/// <returns></returns>
[HttpPost("assign")]
[Transactional]
public async Task AssignAsync(AppointmentAreaAssignRequest request)
{
await _appointmentAreaService.AssignAsync(request);
}
/// <summary>
/// 获取当前分配
/// </summary>
/// <param name="customCode"></param>
/// <returns></returns>
[HttpGet("assignments")]
[Transactional]
public async Task<List<Guid>> GetAssignmentsAsync(string customCode)
{
return await _appointmentAreaService.GetAssignmentsAsync(customCode);
}
}