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;
///
/// 角色模块
///
public class RoleController : ApiController
{
private readonly ISysRoleService _invokeService;
///
/// 构造函数
///
///
public RoleController(ISysRoleService invokeService)
{
_invokeService = invokeService;
}
///
/// 列表
///
///
///
[HttpPost]
[Route("GetRoleList")]
public DataResult> GetRoleList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
///
/// 编辑
///
///
///
[HttpPost]
[Route("EditRole")]
public DataResult EditRole([FromBody] RoleInput model)
{
var res = _invokeService.EditRole(model);
return res;
}
///
/// 详情
///
///
///
[HttpGet]
[Route("GetRoleInfo")]
public DataResult GetRoleInfo([FromQuery] string id)
{
var res = _invokeService.GetRoleInfo(id);
return res;
}
///
/// 获取角色权限树-客户端
///
///
[HttpGet]
[Route("GetClientRolePermissionTree")]
public DataResult GetClientRolePermissionTree()
{
var res = _invokeService.GetClientRolePermissionTree();
return res;
}
///
/// 获取角色权限
///
///
///
[HttpGet]
[Route("GetRolePermission")]
public DataResult GetRolePermission([FromQuery] string id)
{
var res = _invokeService.GetRolePermission(id);
return res;
}
///
/// 更新角色权限-客户端
///
///
///
[HttpPost]
[Route("UpdateClientRolePermission")]
public DataResult UpdateClientRolePermission([FromBody] RolePermissionInput model)
{
var res = _invokeService.UpdateClientRolePermission(model);
return res;
}
///
/// 单个角色删除
///
/// 角色Id
///
[HttpPost]
[Route("DelRole")]
public async Task DelRole([FromBody] IdModel req)
{
var res = await _invokeService.DelRoleAsync(req.Id);
return res;
}
}