You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.9 KiB
105 lines
2.9 KiB
using Entity.DbModel;
|
|
using Entity.DbModel.System;
|
|
using HybirdFrameworkCore.Entity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Service.System;
|
|
using Entity.Dto.Req;
|
|
using Entity.Dto.Resp;
|
|
|
|
namespace WebStarter.Controllers.System
|
|
{
|
|
[Produces("application/json")]
|
|
[ApiController]
|
|
public class SysMenuController
|
|
{
|
|
private SysMenuService _sysMenuServices;
|
|
public SysMenuController(ILogger<SysMenu> logger, SysMenuService sysMenuServices)
|
|
{
|
|
_sysMenuServices = sysMenuServices;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取登录菜单树
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("/api/sysMenu/loginMenuTree")]
|
|
public async Task<List<MenuResp>> GetLoginMenuTree()
|
|
{
|
|
return await _sysMenuServices.GetLoginMenuTree();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取菜单列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("api/sysMenu/list")]
|
|
public async Task<List<SysMenu>> GetList([FromQuery] MenuReq input)
|
|
{
|
|
return await _sysMenuServices.GetList(input);
|
|
}
|
|
|
|
|
|
//[HttpGet]
|
|
//[Route("api/sysMenu/ownBtnPermList")]
|
|
//public async BusinessTask<List<string>> GetOwnBtnPermList()
|
|
//{
|
|
// return await _sysMenuServices.GetOwnBtnPermList();
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 增加菜单
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("/api/sysMenu/add")]
|
|
public async Task<Result<int>> AddMenu([FromBody] AddMenuReq input)
|
|
{
|
|
int result = 0;
|
|
var data = await _sysMenuServices.AddMenu(input);
|
|
if (data == "增加菜单成功")
|
|
{
|
|
result = 200;
|
|
return Result<int>.Success(result);
|
|
}
|
|
else
|
|
{
|
|
return Result<int>.Fail(result);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新菜单
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("/api/sysMenu/update")]
|
|
public async Task<Result<int>> UpdateMenu([FromBody] UpdateMenuReq input)
|
|
{
|
|
var data = await _sysMenuServices.UpdateMenu(input);
|
|
if (data == 200)
|
|
return Result<int>.Success(data);
|
|
else { return Result<int>.Fail(data); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除菜单
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("/api/sysMenu/delete")]
|
|
public async Task DeleteMenu([FromBody] DeleteMenuReq input)
|
|
{
|
|
await _sysMenuServices.DeleteMenu(input);
|
|
}
|
|
|
|
|
|
}
|
|
}
|