namespace CloudGaming.Api.Admin.Controllers.Systems;
///
/// 数据字典控制器
///
[ControllerDescriptor(MenuId = "23", DisplayName = "数据字典")]
public class SysDictionaryController(IServiceProvider serviceProvider)
: AdminControllerBase(serviceProvider)
{
///
/// 获取列表
///
///
///
[ActionDescriptor(DisplayName = "查看列表")]
[HttpPost]
public async Task> FindListAsync([FromBody] SysDictionary search)
{
return await Service.FindListAsync(search);
}
///
/// 获取字典树
///
///
[ActionDescriptor(DisplayName = "获取字典树")]
[HttpGet]
public async Task> GetDictionaryTreeAsync()
{
return await Service.GetDictionaryTreeAsync();
}
///
/// 根据编码获取 字典集合
///
///
///
[HttpGet("{code}")]
public Task> GetDictionaryTreeByCodeAsync([FromRoute] string code)
{
return Service.GetDictionaryTreeByCodeAsync(code);
}
///
/// 根据编码获取 字典集合
///
///
///
[HttpGet("{code}")]
[AllowAnonymous]
public Task> GetDictionaryByCodeAsync([FromRoute] string code)
{
return Service.GetDictionaryByCodeAsync(code);
}
///
/// 编辑
///
///
///
[RequestLimitFilter]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] SysDictionary form)
{
return Service.SaveFormAsync(form);
}
///
/// 查询表单数据
///
///
///
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public async Task> FindFormAsync([FromRoute] int id)
{
return await Service.FindFormAsync(id);
}
///
/// 根据id数组删除
///
///
///
[ActionDescriptor(DisplayName = "删除数据")]
[HttpPost]
public async Task DeleteListAsync([FromBody] List ids)
{
await Service.DeleteListAsync(ids);
return true;
}
///
/// 添加
///
///
///
[RequestLimitFilter]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] SysDictionary form)
{
return Service.SaveFormAsync(form);
}
///
/// 根据编码获取 字典集合
///
///
///
[HttpGet("{tenant}")]
[AllowAnonymous]
public Task> GetDictionaryByProjectCodeAsync([FromRoute] string tenant)
{
return Service.GetDictionaryByProjectCodeAsync(tenant, "");
}
}