You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.2 KiB

2 years ago
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
{
/// <summary>
/// 租户系统配置服务
/// </summary>
[ApiDescriptionSettings("Application",Name = "SysTConfig", Order = 1)]
public class SysTConfigService : ISysTConfigService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysTConfig> _rep;
private readonly SqlSugarRepository<SysTenant> _sysTenantRep; // 租户表仓储
public SysTConfigService(SqlSugarRepository<SysTConfig> rep, SqlSugarRepository<SysTenant> _sysTenantRep)
{
_rep = rep;
this._sysTenantRep = _sysTenantRep;
}
/// <summary>
/// 分页查询租户系统配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/SysTConfig/page")]
public async Task<dynamic> Page([FromQuery] SysTConfigInput input)
{
var entities = await _rep.AsQueryable()
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加租户系统配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/SysTConfig/add")]
public async Task Add(AddSysTConfigInput input)
{
var entity = input.Adapt<SysTConfig>();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 删除租户系统配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/SysTConfig/delete")]
public async Task Delete(DeleteSysTConfigInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
await _rep.DeleteAsync(entity);
}
/// <summary>
/// 更新租户系统配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/SysTConfig/edit")]
public async Task Update(UpdateSysTConfigInput input)
{
var entity = input.Adapt<SysTConfig>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
}
/// <summary>
/// 获取租户系统配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/SysTConfig/Detail")]
2 years ago
public async Task<SysTConfig> Get([FromQuery] QueryeSysTConfigInput input)
{
return await _rep.FirstOrDefaultAsync(u => !u.Id.IsEmpty());
}
/// <summary>
/// 获取租户系统配置列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/SysTConfig/list")]
public async Task<dynamic> List([FromQuery] SysTConfigInput input)
{
return await _rep.ToListAsync();
}
}
}