using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace DS.WMS.AdminApi.Controllers;
///
/// 公共模块
///
public class CommonController : ApiController
{
private readonly ICommonService _invokeService;
private readonly IServerCommonService _serverService;
///
/// 构造函数
///
///
public CommonController(ICommonService invokeService, IServerCommonService serverService)
{
_invokeService = invokeService;
_serverService = serverService;
}
///
/// 获取船公司下拉列表
///
/// 船公司代码或中文名称
///
[HttpGet]
[Route("GetCarrierSelectList")]
public async Task>> GetCarrierSelectList([FromQuery] string queryKey)
{
var res = await _serverService.GetCodeCarrierSelectList(queryKey);
return res;
}
///
/// 用户登录-管理端
///
///
///
[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("GetRoleList")]
public DataResult> GetRoleList()
{
var res = _invokeService.GetRoleList();
return res;
}
///
/// 获取用户下拉选项
///
///
[HttpGet]
[Route("GetUserList")]
public DataResult> GetUserList()
{
var res = _invokeService.GetUserList();
return res;
}
///
/// 获取商品类型下拉选项
///
///
[HttpGet]
[Route("GetGoodsTypeList")]
public DataResult> GetGoodsTypeList()
{
var res = _invokeService.GetGoodsTypeList();
return res;
}
///
/// 获取国家信息下拉选项
///
///
[HttpGet]
[Route("GetCountrySelectList")]
public DataResult> GetCountrySelectList()
{
var res = _invokeService.GetCountrySelectList();
return res;
}
///
/// 获取航线信息下拉选项
///
///
[HttpGet]
[Route("GetLanesSelectList")]
public DataResult> GetLanesSelectList()
{
var res = _invokeService.GetLanesSelectList();
return res;
}
///
/// 获取港口信息下拉选项
///
///
[HttpGet]
[Route("GetPortSelectList")]
public DataResult> GetPortSelectList()
{
var res = _invokeService.GetPortSelectList();
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;
}
///
/// 获取用户字段设置
///
///
///
[HttpGet]
[Route("GetUserFieldSet")]
public DataResult GetUserFieldSet([FromQuery] string permissionId)
{
var res = _invokeService.GetUserFieldSet(permissionId);
return res;
}
///
/// 更新用户字段设置
///
///
///
[HttpPost]
[Route("UpdateUserFieldSet")]
public DataResult UpdateUserFieldSet([FromBody] UserFieldSetUpdateReq req)
{
var res = _invokeService.UpdateUserFieldSet(req);
return res;
}
///
/// 获取字典下拉明细
///
///
///
[HttpPost]
[Route("GetDictTypeDropDown")]
public DataResult GetDictTypeDropDown([FromBody] DropDownDictTypeInput model)
{
var res = _invokeService.GetDictTypeDropDown(model);
return res;
}
///
/// 批量获取字典值
///
///
///
[HttpPost]
[Route("GetDictOptions")]
public DataResult> GetDictOptions([FromBody] DropDownDictTypeInput model)
{
var res = _invokeService.GetDictOptions(model);
return res;
}
}