using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace DS.WMS.AdminApi.Controllers;
///
/// 公共模块
///
public class CommonController : ApiController
{
private readonly ICommonService _invokeService;
///
/// 构造函数
///
///
public CommonController(ICommonService invokeService)
{
_invokeService = invokeService;
}
///
/// 用户登录-管理端
///
///
///
[HttpPost]
[AllowAnonymous]
[Route("Login")]
public DataResult Login([FromBody] UserLoginModel model)
{
var res = _invokeService.UserLogin(model);
return res;
}
///
/// 获取用户-管理端
///
///
[HttpGet]
[Route("GetUserInfo")]
public DataResult GetUserInfo()
{
var res = _invokeService.GetUserInfo();
return res;
}
///
/// 后台端刷新Token
///
///
[HttpGet]
[Route("UserRefreshToken")]
public DataResult UserRefreshToken()
{
var res = _invokeService.UserRefreshToken();
return res;
}
///
/// 登出
///
///
[HttpPost]
[Route("Logout")]
public DataResult Logout()
{
return DataResult.Success("");
}
///
/// 查询用户拥有的菜单权限-管理端
///
///
[HttpGet]
[Route("GetUserPermissionByToken")]
public DataResult> GetUserPermissionByToken()
{
var res = _invokeService.GetUserPermissionByToken();
return res;
}
///
/// 获取服务器信息
///
///
[HttpGet]
[Route("GetServerInfo")]
public DataResult GetServerInfo()
{
var res = _invokeService.GetServerInfo();
return res;
}
///
/// 获取角色下拉选项
///
///
[HttpGet]
[Route("GetRoleList")]
public DataResult> GetRoleList()
{
var res = _invokeService.GetRoleList();
return res;
}
///
/// 修改密码
///
///
///
[HttpPost]
[Route("ChangePassword")]
public DataResult ChangePassword([FromBody] ChangePasswordReq model)
{
var res = _invokeService.ChangePassword(model);
return res;
}
///
/// 获取权限树列表-客户端
///
///
[HttpGet]
[Route("GetClientPermissionTreeList")]
public DataResult> GetClientPermissionTreeList()
{
var res = _invokeService.GetClientPermissionTreeList();
return res;
}
///
/// 获取数据权限字段
///
///
///
[HttpGet]
[AllowAnonymous]
[Route("GetDataRuleEntityFields")]
public DataResult> GetDataRuleEntityFields([FromQuery] string permissionId)
{
var res = _invokeService.GetDataRuleEntityFields(permissionId);
return res;
}
///
/// 获取数据库表及视图名
///
///
[HttpGet]
[Route("GetTables")]
public DataResult> GetTables()
{
var res = _invokeService.GetTables();
return res;
}
///
/// 获取数据库表及视图名
///
///
[HttpGet]
[Route("GetColumns")]
public DataResult> GetColumns([FromQuery] string tableViewName)
{
var res = _invokeService.GetColumns(tableViewName);
return res;
}
}