From 4c866eaf3ff2813cec9deeb92d81efbdb3064b8e Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 21 Mar 2024 16:40:24 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=8E=B7=E5=8F=96=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BookingAddressController.cs | 17 ++++++++++++++++- .../Places/Request/BookingAddressPageRequest.cs | 5 ++--- .../Places/Services/IBookingAddressService.cs | 2 ++ .../Implements/BookingAddressService.cs | 8 ++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Src/Dlhis.Basic/Places/Controllers/BookingAddressController.cs b/Src/Dlhis.Basic/Places/Controllers/BookingAddressController.cs index 24b717da..3f9eba2f 100644 --- a/Src/Dlhis.Basic/Places/Controllers/BookingAddressController.cs +++ b/Src/Dlhis.Basic/Places/Controllers/BookingAddressController.cs @@ -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); } + /// + /// 所有地址 + /// + /// + /// + [HttpGet("all")] + [IgnoreTenant] + public async Task> GetAllAddressAsync([Required(ErrorMessage = "厂区不可为空")] string tenant) + { + return await _bookingAddresService.GetAllAddressAsync(tenant); + } + /// /// 地址保存 /// diff --git a/Src/Dlhis.Basic/Places/Request/BookingAddressPageRequest.cs b/Src/Dlhis.Basic/Places/Request/BookingAddressPageRequest.cs index 0afa8bc4..b08d1e3e 100644 --- a/Src/Dlhis.Basic/Places/Request/BookingAddressPageRequest.cs +++ b/Src/Dlhis.Basic/Places/Request/BookingAddressPageRequest.cs @@ -1,9 +1,8 @@ - - -using Kurisu.Core.DataAccess.Dto; +using Kurisu.Core.DataAccess.Dto; namespace Dlhis.Basic.Places.Request; public class BookingAddressPageRequest : PageDto { + } diff --git a/Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs b/Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs index 9dc94951..9e558f2d 100644 --- a/Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs +++ b/Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs @@ -8,5 +8,7 @@ public interface IBookingAddressService : IScopeDependency { Task> GetAddressPageAsync(BookingAddressPageRequest request); + Task> GetAllAddressAsync(string tenant); + Task SaveAddressAsync(BookingAddressSaveRequest request); } diff --git a/Src/Dlhis.Basic/Places/Services/Implements/BookingAddressService.cs b/Src/Dlhis.Basic/Places/Services/Implements/BookingAddressService.cs index 22de0f58..c3fab27c 100644 --- a/Src/Dlhis.Basic/Places/Services/Implements/BookingAddressService.cs +++ b/Src/Dlhis.Basic/Places/Services/Implements/BookingAddressService.cs @@ -42,4 +42,12 @@ public class BookingAddressService : IBookingAddressService await _dbContext.UpdateAsync(entity); } } + + public async Task> GetAllAddressAsync(string tenant) + { + return await _dbContext.Queryable() + .Where(x => x.TenantId == tenant) + .Select() + .ToListAsync(); + } }