feat 获取所有地址

This commit is contained in:
2024-03-21 16:40:24 +08:00
parent 2ca8f2db49
commit 4c866eaf3f
4 changed files with 28 additions and 4 deletions

View File

@@ -1,9 +1,12 @@
using Dlhis.Basic.Places.Request;
using System.ComponentModel.DataAnnotations;
using Dlhis.Basic.Places.Request;
using Dlhis.Basic.Places.Response;
using Dlhis.Basic.Places.Services;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Ocsp;
namespace Dlhis.Basic.Places.Controllers;
@@ -33,6 +36,18 @@ public class BookingAddressController : ControllerBase
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>

View File

@@ -1,9 +1,8 @@

using Kurisu.Core.DataAccess.Dto;
using Kurisu.Core.DataAccess.Dto;
namespace Dlhis.Basic.Places.Request;
public class BookingAddressPageRequest : PageDto
{
}

View File

@@ -8,5 +8,7 @@ public interface IBookingAddressService : IScopeDependency
{
Task<Pagination<BookingAddressPageResponse>> GetAddressPageAsync(BookingAddressPageRequest request);
Task<List<BookingAddressPageResponse>> GetAllAddressAsync(string tenant);
Task SaveAddressAsync(BookingAddressSaveRequest request);
}

View File

@@ -42,4 +42,12 @@ public class BookingAddressService : IBookingAddressService
await _dbContext.UpdateAsync(entity);
}
}
public async Task<List<BookingAddressPageResponse>> GetAllAddressAsync(string tenant)
{
return await _dbContext.Queryable<BookingAddressEntity>()
.Where(x => x.TenantId == tenant)
.Select<BookingAddressPageResponse>()
.ToListAsync();
}
}