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.

112 lines
2.8 KiB
C#

10 months ago
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.AdminApi.Controllers;
/// <summary>
/// 权限模块
/// </summary>
public class PermissionController : ApiController
{
private readonly IPermissionService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public PermissionController(IPermissionService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 权限列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetSysPermissionList")]
public DataResult<List<SysPermission>> GetSysPermissionList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetPermissionList")]
public DataResult<List<SysPermission>> GetPermissionList()
{
var res = _invokeService.GetPermissionList();
return res;
}
/// <summary>
/// 获取权限树列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetPermissionTreeList")]
public DataResult<List<PermissionTreeList>> GetPermissionTreeList()
{
var res = _invokeService.GetPermissionTreeList();
return res;
}
/// <summary>
/// 编辑权限
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditPermission")]
public DataResult EditPermission([FromBody] PermissionReq model)
{
var res = _invokeService.EditPermission(model);
return res;
}
/// <summary>
/// 获取权限详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetPermissionInfo")]
public DataResult<SysPermission> GetPermissionInfo([FromQuery] string id)
{
var res = _invokeService.GetPermissionInfo(id);
return res;
}
/// <summary>
/// 获取权限树
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetPermissionTree")]
public DataResult<List<PermissionTreeViewModel>> GetPermissionTree()
{
var res = _invokeService.GetPermissionTree();
return res;
}
/// <summary>
/// 更新角色权限
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateRolePermission")]
public DataResult UpdateRolePermission([FromBody] RolePermissionInput model)
{
var res = _invokeService.UpdateRolePermission(model);
return res;
}
}