using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.BaseApp;
using OpenAuth.App.BaseApp.Request;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers.BaseControllers
{
///
/// 日 期: 2024-06-29
/// 描 述: 菜单类型
///
[Route("api/[controller]/[action]")]
[ApiController]
public class SpecialcolumnController : ControllerBase
{
private readonly SysModuleTypeApp _app;
public SpecialcolumnController(SysModuleTypeApp app)
{
_app = app;
}
///
/// 分页获取列表数据
///
/// 筛选条件
/// 当前页
/// 每页条数
///
[HttpGet]
public async Task>>> LoadDataBaseInfo(string keyword, int page = 1, int limit = 15)
{
return await _app.LoadModuleTypeList(keyword, page, limit);
}
///
/// 获取全部数据(不显示的除外)
///
///
[HttpGet]
[AllowAnonymous]
public async Task>> GetDataColName()
{
return await _app.LoadModuleType();
}
///
/// 获取单个数据源
///
/// 主键
///
[HttpGet]
public async Task GetEntityById(string id)
{
return await _app.GetEntityById(id);
}
///
/// 新增数据源
///
/// 主键
/// 实体
///
[HttpPost]
public async Task> AddOrUpdateForm(string id, ModuleTypeReq entity)
{
var result = new Response();
try
{
result = await _app.SaveEntity(id, entity);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 删除数据源
///
/// 主键
[HttpPost]
public async Task> DeleteEntity(string id)
{
var result = new Response();
try
{
result = await _app.DeleteEntity(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 修改是否显示状态
///
/// 主键
/// 是否显示
///
[HttpPost]
public async Task> UpdateIsShow(string id, bool isshow)
{
var result = new Response();
try
{
result = await _app.UpdateIsShow(id, isshow);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
}
}