|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
using DS.WMS.Core.Sys.Dtos;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace DS.WMS.MainApi.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("GetClientRolePermissionTree")]
|
|
|
|
public DataResult<RolePermissionTreeViewModel> GetClientRolePermissionTree()
|
|
|
|
{
|
|
|
|
var res = _invokeService.GetClientRolePermissionTree();
|
|
|
|
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("UpdateClientRolePermission")]
|
|
|
|
public DataResult UpdateClientRolePermission([FromBody] RolePermissionInput model)
|
|
|
|
{
|
|
|
|
var res = _invokeService.UpdateClientRolePermission(model);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 单个角色删除
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="req">角色Id</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[Route("DelRole")]
|
|
|
|
public async Task<DataResult> DelRole([FromBody] IdModel req)
|
|
|
|
{
|
|
|
|
var res = await _invokeService.DelRoleAsync(req.Id);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|