租户号查询

This commit is contained in:
qianhao.xu 2024-08-21 09:20:59 +08:00
parent 242297fc0b
commit f0f11d1950
4 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,35 @@
using DOAN.Service;
using Microsoft.AspNetCore.Mvc;
using DOAN.Service.IService;
using SqlSugar;
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 公共模块
/// </summary>
[Route("tenant")]
public class TenantController : BaseController
{
private ITenantService tenantService;
public TenantController(ITenantService tenantService)
{
this.tenantService = tenantService;
}
/// <summary>
/// 获取租户
/// </summary>
/// <returns></returns>
[HttpGet("getlist")]
public IActionResult GetALLList([FromBody] TenantList tenant)
{
var response = tenantService.GetALLList(tenant);
return SUCCESS(response);
}
}
}

View File

@ -23,6 +23,11 @@ namespace DOAN.Model
/// </summary>
public string Name { get; set; }
/// <summary>
/// code
/// </summary>
public string Code { get; set; }
/// <summary>
/// Status
/// </summary>

View File

@ -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<TenantList> GetALLList(TenantList tenant);
}
}

View File

@ -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<TenantList>, ITenantService
{
/// <summary>
/// 获取list
/// </summary>
/// <param name="tenant"></param>
/// <returns></returns>
public List<TenantList> GetALLList(TenantList tenant)
{
return Context.Queryable<TenantList>()
.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();
}
}
}