using Dlhis.Entity.Sys.Entities; using Dlhis.User.Identity.Request; using Dlhis.User.Identity.Response; using Kurisu.AspNetCore.Utils.Extensions; using Kurisu.Core.DataAccess.Dto; using Kurisu.SqlSugar.Extensions; using Kurisu.SqlSugar.Services; namespace Dlhis.User.Identity.Services.Implements; public class TenantService : ITenantService { private readonly IDbContext _dbContext; public TenantService(IDbContext dbContext) { _dbContext = dbContext; } public async Task> GetPageAsync(TenantPageRequest request) { return await _dbContext.Queryable() .WhereIF(request.Search.IsPresent(), (tenant) => tenant.Name.Contains(request.Search)) .Select() .ToPageListAsync(request); } public async Task> GetListAsync() { return await _dbContext.Queryable() .Select() .ToListAsync(); } public async Task GetTenantByCode(string code) { return await _dbContext.Queryable() .Where(x => x.Code == code) .Select() .FirstAsync(); } }