123 lines
3.6 KiB
C#
123 lines
3.6 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 日 期: 2024-06-29
|
|
/// 描 述: 菜单类型
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class SpecialcolumnController : ControllerBase
|
|
{
|
|
private readonly SysModuleTypeApp _app;
|
|
public SpecialcolumnController(SysModuleTypeApp app)
|
|
{
|
|
_app = app;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页获取列表数据
|
|
/// </summary>
|
|
/// <param name="keyword">筛选条件</param>
|
|
/// <param name="page">当前页</param>
|
|
/// <param name="limit">每页条数</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<Response<PageInfo<List<SysModuleType>>>> LoadDataBaseInfo(string keyword, int page = 1, int limit = 15)
|
|
{
|
|
return await _app.LoadModuleTypeList(keyword, page, limit);
|
|
}
|
|
/// <summary>
|
|
/// 获取全部数据(不显示的除外)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public async Task<Response<List<SysModuleType>>> GetDataColName()
|
|
{
|
|
return await _app.LoadModuleType();
|
|
}
|
|
/// <summary>
|
|
/// 获取单个数据源
|
|
/// </summary>
|
|
/// <param name="id">主键</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<SysModuleType> GetEntityById(string id)
|
|
{
|
|
return await _app.GetEntityById(id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增数据源
|
|
/// </summary>
|
|
/// <param name="id">主键</param>
|
|
/// <param name="entity">实体</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> AddOrUpdateForm(string id, ModuleTypeReq entity)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.SaveEntity(id, entity);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除数据源
|
|
/// </summary>
|
|
/// <param name="id">主键</param>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> DeleteEntity(string id)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.DeleteEntity(id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改是否显示状态
|
|
/// </summary>
|
|
/// <param name="id">主键</param>
|
|
/// <param name="isshow">是否显示</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> UpdateIsShow(string id, bool isshow)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.UpdateIsShow(id, isshow);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|