using EntrustSettle.Common.Const;
using EntrustSettle.Common.HttpContextUser;
using EntrustSettle.Controllers;
using EntrustSettle.IServices.Base;
using EntrustSettle.Model;
using EntrustSettle.Model.Models;
using Microsoft.AspNetCore.Mvc;
namespace EntrustSettle.Api.Controllers.Demo;
///
/// 多租户-Id方案 测试
///
[Produces("application/json")]
[ApiExplorerSettings(GroupName = ApiGroupNameConst.System)]
public class TenantByIdController : BaseApiController
{
private readonly IBaseServices _services;
private readonly IUser _user;
public TenantByIdController(IUser user, IBaseServices services)
{
_user = user;
_services = services;
}
///
/// 获取租户下全部业务数据
///
///
[HttpGet]
public async Task>> GetAll()
{
var data = await _services.Query();
return Success(data);
}
///
/// 新增业务数据
///
///
[HttpPost]
public async Task Post([FromBody] BusinessTable data)
{
await _services.Db.Insertable(data).ExecuteReturnSnowflakeIdAsync();
return SuccessMsg();
}
}