租户号查询
This commit is contained in:
parent
242297fc0b
commit
f0f11d1950
35
DOAN.Admin.WebApi/Controllers/TenantController.cs
Normal file
35
DOAN.Admin.WebApi/Controllers/TenantController.cs
Normal 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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,11 @@ namespace DOAN.Model
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status
|
||||
/// </summary>
|
||||
|
||||
15
DOAN.Service/IService/ITenantService.cs
Normal file
15
DOAN.Service/IService/ITenantService.cs
Normal 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);
|
||||
|
||||
}
|
||||
}
|
||||
30
DOAN.Service/TenantService.cs
Normal file
30
DOAN.Service/TenantService.cs
Normal 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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user