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.

101 lines
2.4 KiB
C#

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 RoleController : ApiController
{
private readonly ISysRoleService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public RoleController(ISysRoleService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetRoleList")]
public DataResult<List<SysRole>> GetRoleList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditRole")]
public DataResult EditRole([FromBody] RoleInput model)
{
var res = _invokeService.EditRole(model);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetRoleInfo")]
public DataResult<SysRole> GetRoleInfo([FromQuery] string id)
{
var res = _invokeService.GetRoleInfo(id);
return res;
}
/// <summary>
/// 获取角色权限树
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetRolePermissionTree")]
public DataResult<RolePermissionTreeViewModel> GetRolePermissionTree()
{
var res = _invokeService.GetRolePermissionTree();
return res;
}
/// <summary>
/// 获取角色权限
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetRolePermission")]
public DataResult<long?[]> GetRolePermission([FromQuery] string id)
{
var res = _invokeService.GetRolePermission(id);
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;
}
}