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.MainApi.Controllers;
///
/// 公共模块
///
public class CommonController : ApiController
{
private readonly ICommonService _invokeService;
///
/// 构造函数
///
///
public CommonController(ICommonService invokeService)
{
_invokeService = invokeService;
}
///
/// 登出
///
///
[HttpPost]
[Route("Logout")]
public DataResult Logout()
{
return DataResult.Success("");
}
///
/// 用户登录-客户端
///
///
///
[HttpPost]
[AllowAnonymous]
[Route("ClientUserLogin")]
public DataResult ClientUserLogin([FromBody] UserLoginModel model)
{
var res = _invokeService.ClientUserLogin(model);
return res;
}
///
/// 客户端刷新Token
///
///
[HttpGet]
[Route("ClientUserRefreshToken")]
public DataResult ClientUserRefreshToken()
{
var res = _invokeService.ClientUserRefreshToken();
return res;
}
///
/// 获取用户-客户端
///
///
[HttpGet]
[Route("GetClientUserInfo")]
public DataResult GetClientUserInfo()
{
var res = _invokeService.GetClientUserInfo();
return res;
}
///
/// 查询用户拥有的菜单权限-客户端
///
///
[HttpGet]
[Route("GetClientUserPermissionByToken")]
public DataResult> GetClientUserPermissionByToken()
{
var res = _invokeService.GetClientUserPermissionByToken();
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;
}
///
/// 企业用户注册
///
///
///
[AllowAnonymous]
[HttpPost]
[Route("TenantRegister")]
public DataResult TenantRegister([FromBody] TenantRegisterReq model)
{
var res = _invokeService.TenantRegister(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;
}
}