You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// 多租户-Id方案 测试
|
|
/// </summary>
|
|
[Produces("application/json")]
|
|
[ApiExplorerSettings(GroupName = ApiGroupNameConst.System)]
|
|
public class TenantByIdController : BaseApiController
|
|
{
|
|
private readonly IBaseServices<BusinessTable> _services;
|
|
private readonly IUser _user;
|
|
|
|
public TenantByIdController(IUser user, IBaseServices<BusinessTable> services)
|
|
{
|
|
_user = user;
|
|
_services = services;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取租户下全部业务数据 <br/>
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<MessageModel<List<BusinessTable>>> GetAll()
|
|
{
|
|
var data = await _services.Query();
|
|
return Success(data);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增业务数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<MessageModel> Post([FromBody] BusinessTable data)
|
|
{
|
|
await _services.Db.Insertable(data).ExecuteReturnSnowflakeIdAsync();
|
|
return Success();
|
|
}
|
|
} |