From f0f11d1950316d2886e8a30c96652c60f54687fb Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Wed, 21 Aug 2024 09:20:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=8F=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/TenantController.cs | 35 +++++++++++++++++++ DOAN.Model/TenantList.cs | 5 +++ DOAN.Service/IService/ITenantService.cs | 15 ++++++++ DOAN.Service/TenantService.cs | 30 ++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 DOAN.Admin.WebApi/Controllers/TenantController.cs create mode 100644 DOAN.Service/IService/ITenantService.cs create mode 100644 DOAN.Service/TenantService.cs diff --git a/DOAN.Admin.WebApi/Controllers/TenantController.cs b/DOAN.Admin.WebApi/Controllers/TenantController.cs new file mode 100644 index 0000000..f21cb58 --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/TenantController.cs @@ -0,0 +1,35 @@ +using DOAN.Service; +using Microsoft.AspNetCore.Mvc; +using DOAN.Service.IService; +using SqlSugar; +namespace DOAN.Admin.WebApi.Controllers +{ + /// + /// 公共模块 + /// + [Route("tenant")] + + public class TenantController : BaseController + { + private ITenantService tenantService; + public TenantController(ITenantService tenantService) + { + this.tenantService = tenantService; + + } + + + /// + /// 获取租户 + /// + /// + [HttpGet("getlist")] + public IActionResult GetALLList([FromBody] TenantList tenant) + { + var response = tenantService.GetALLList(tenant); + + return SUCCESS(response); + + } + } +} \ No newline at end of file diff --git a/DOAN.Model/TenantList.cs b/DOAN.Model/TenantList.cs index 497f60f..05d08d8 100644 --- a/DOAN.Model/TenantList.cs +++ b/DOAN.Model/TenantList.cs @@ -23,6 +23,11 @@ namespace DOAN.Model /// public string Name { get; set; } + /// + /// code + /// + public string Code { get; set; } + /// /// Status /// diff --git a/DOAN.Service/IService/ITenantService.cs b/DOAN.Service/IService/ITenantService.cs new file mode 100644 index 0000000..aee9f05 --- /dev/null +++ b/DOAN.Service/IService/ITenantService.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service.IService +{ + public interface ITenantService + { + + List GetALLList(TenantList tenant); + + } +} diff --git a/DOAN.Service/TenantService.cs b/DOAN.Service/TenantService.cs new file mode 100644 index 0000000..3290fb5 --- /dev/null +++ b/DOAN.Service/TenantService.cs @@ -0,0 +1,30 @@ +using DOAN.Service.IService; +using Infrastructure.Attribute; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service +{ + [AppService(ServiceType = typeof(ITenantService), ServiceLifetime = LifeTime.Transient)] + public class TenantService : BaseService, ITenantService + { + /// + /// 获取list + /// + /// + /// + public List GetALLList(TenantList tenant) + { + return Context.Queryable() + .WhereIF(tenant != null && !string.IsNullOrEmpty(tenant.Name), it => it.Name.Contains(tenant.Name)) + .WhereIF(tenant != null && !string.IsNullOrEmpty(tenant.Code), it => it.Name.Contains(tenant.Code)) + .Where(it => it.Status == 1) + .ToList(); + + } + } +}