61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.Basic.Places.Request;
|
|
using Dlhis.Basic.Places.Response;
|
|
using Dlhis.Basic.Places.Services;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Basic.Places.Controllers;
|
|
|
|
/// <summary>
|
|
/// 订餐地址
|
|
/// </summary>
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class BookingAddressController : ControllerBase
|
|
{
|
|
private readonly IBookingAddressService _bookingAddresService;
|
|
|
|
public BookingAddressController(IBookingAddressService bookingAddresService)
|
|
{
|
|
_bookingAddresService = bookingAddresService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 地址分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<BookingAddressPageResponse>> GetAddresPageAsync([FromQuery] BookingAddressPageRequest request)
|
|
{
|
|
return await _bookingAddresService.GetAddressPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 所有地址
|
|
/// </summary>
|
|
/// <param name="tenant"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("all")]
|
|
[IgnoreTenant]
|
|
public async Task<List<BookingAddressPageResponse>> GetAllAddressAsync([Required(ErrorMessage = "厂区不可为空")] string tenant)
|
|
{
|
|
return await _bookingAddresService.GetAllAddressAsync(tenant);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 地址保存
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("save")]
|
|
public async Task SaveAddresAsync(BookingAddressSaveRequest request)
|
|
{
|
|
await _bookingAddresService.SaveAddressAsync(request);
|
|
}
|
|
}
|