using GDZZ.Core; using Furion.DependencyInjection; using Furion.DynamicApiController; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System.Linq; using System.Threading.Tasks; using GDZZ.Application.Entity; using GDZZ.Core.Entity; namespace GDZZ.Application { /// /// 租户系统配置服务 /// [ApiDescriptionSettings("Application",Name = "SysTConfig", Order = 1)] public class SysTConfigService : ISysTConfigService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _rep; private readonly SqlSugarRepository _sysTenantRep; // 租户表仓储 public SysTConfigService(SqlSugarRepository rep, SqlSugarRepository _sysTenantRep) { _rep = rep; this._sysTenantRep = _sysTenantRep; } /// /// 分页查询租户系统配置 /// /// /// [HttpGet("/SysTConfig/page")] public async Task Page([FromQuery] SysTConfigInput input) { var entities = await _rep.AsQueryable() .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } /// /// 增加租户系统配置 /// /// /// [HttpPost("/SysTConfig/add")] public async Task Add(AddSysTConfigInput input) { var entity = input.Adapt(); await _rep.InsertAsync(entity); } /// /// 删除租户系统配置 /// /// /// [HttpPost("/SysTConfig/delete")] public async Task Delete(DeleteSysTConfigInput input) { var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); await _rep.DeleteAsync(entity); } /// /// 更新租户系统配置 /// /// /// [HttpPost("/SysTConfig/edit")] public async Task Update(UpdateSysTConfigInput input) { var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync(); } /// /// 获取租户系统配置 /// /// /// [HttpGet("/SysTConfig/Detail")] public async Task Get([FromQuery] QueryeSysTConfigInput input) { return await _rep.FirstOrDefaultAsync(u => !u.Id.IsEmpty()); } /// /// 获取租户系统配置列表 /// /// /// [HttpGet("/SysTConfig/list")] public async Task List([FromQuery] SysTConfigInput input) { return await _rep.ToListAsync(); } } }