接口名称简化
This commit is contained in:
@@ -142,6 +142,32 @@
|
|||||||
<param name="ids"></param>
|
<param name="ids"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1">
|
||||||
|
<summary>
|
||||||
|
Json To Sql 类比模式,通用模型
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.GetById(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
主键查询
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.GetList">
|
||||||
|
<summary>
|
||||||
|
全部列表查询
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleRdController`1.DelList(System.Collections.Generic.List{System.Int64})">
|
||||||
|
<summary>
|
||||||
|
列表删除
|
||||||
|
</summary>
|
||||||
|
<param name="ids"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.Models.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.Models.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
|
||||||
<summary>
|
<summary>
|
||||||
动态条件分页查询
|
动态条件分页查询
|
||||||
@@ -255,20 +281,14 @@
|
|||||||
<param name="giveRoleSetMenuDto"></param>
|
<param name="giveRoleSetMenuDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GetInMenuByRoleId(System.Int64)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Add(Yi.Framework.DTOModel.RoleInfoDto)">
|
||||||
<summary>
|
|
||||||
通过角色id来获取菜单列表
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.AddInfo(Yi.Framework.DTOModel.RoleInfoDto)">
|
|
||||||
<summary>
|
<summary>
|
||||||
添加角色包含菜单
|
添加角色包含菜单
|
||||||
</summary>
|
</summary>
|
||||||
<param name="roleDto"></param>
|
<param name="roleDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateInfo(Yi.Framework.DTOModel.RoleInfoDto)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.Update(Yi.Framework.DTOModel.RoleInfoDto)">
|
||||||
<summary>
|
<summary>
|
||||||
更新角色信息
|
更新角色信息
|
||||||
</summary>
|
</summary>
|
||||||
@@ -360,13 +380,6 @@
|
|||||||
<param name="isDel"></param>
|
<param name="isDel"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
|
|
||||||
<summary>
|
|
||||||
添加用户,去重,密码加密
|
|
||||||
</summary>
|
|
||||||
<param name="entity"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GiveUserSetRole(Yi.Framework.DTOModel.GiveUserSetRoleDto)">
|
||||||
<summary>
|
<summary>
|
||||||
给多用户设置多角色
|
给多用户设置多角色
|
||||||
@@ -378,18 +391,28 @@
|
|||||||
<summary>
|
<summary>
|
||||||
通过用户id得到用户信息关联部门、岗位、角色
|
通过用户id得到用户信息关联部门、岗位、角色
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateInfo(Yi.Framework.DTOModel.UserInfoDto)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Update(Yi.Framework.DTOModel.UserInfoDto)">
|
||||||
<summary>
|
<summary>
|
||||||
更新用户信息
|
更新用户信息
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="userDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.AddInfo(Yi.Framework.DTOModel.UserInfoDto)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.DTOModel.UserInfoDto)">
|
||||||
<summary>
|
<summary>
|
||||||
添加用户
|
添加用户
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="userDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.RestPassword(Yi.Framework.Model.Models.UserEntity)">
|
||||||
|
<summary>
|
||||||
|
重置密码
|
||||||
|
</summary>
|
||||||
|
<param name="user"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Yi.Framework.Common.Helper;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Language;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Model.Query;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
using Yi.Framework.WebCore.AttributeExtend;
|
||||||
|
|
||||||
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Json To Sql 类比模式,通用模型
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
[ApiController]
|
||||||
|
public class BaseSimpleRdController<T> : ControllerBase where T : class, new()
|
||||||
|
{
|
||||||
|
private readonly ILogger<T> _logger;
|
||||||
|
private IBaseService<T> _baseService;
|
||||||
|
private IRepository<T> _repository;
|
||||||
|
public BaseSimpleRdController(ILogger<T> logger, IBaseService<T> iBaseService)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_baseService = iBaseService;
|
||||||
|
_repository = iBaseService._repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主键查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Permission($"{nameof(T)}:get")]
|
||||||
|
[Route("{id}")]
|
||||||
|
[HttpGet]
|
||||||
|
public virtual async Task<Result> GetById([FromRoute]long id)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _repository.GetByIdAsync(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全部列表查询
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Permission($"{nameof(T)}:get")]
|
||||||
|
[HttpGet]
|
||||||
|
public virtual async Task<Result> GetList()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _repository.GetListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ids"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Permission($"{nameof(T)}:del")]
|
||||||
|
[HttpDelete]
|
||||||
|
public virtual async Task<Result> DelList(List<long> ids)
|
||||||
|
{
|
||||||
|
return Result.Success().SetStatus(await _repository.DeleteByIdsAsync(ids.ToDynamicArray()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class RoleController : BaseSimpleCrudController<RoleEntity>
|
public class RoleController : BaseSimpleRdController<RoleEntity>
|
||||||
{
|
{
|
||||||
private IRoleService _iRoleService;
|
private IRoleService _iRoleService;
|
||||||
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
|
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
|
||||||
@@ -52,15 +52,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
|
return Result.Success().SetStatus(await _iRoleService.GiveRoleSetMenu(giveRoleSetMenuDto.RoleIds, giveRoleSetMenuDto.MenuIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 通过角色id来获取菜单列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<Result> GetInMenuByRoleId(long RoleId)
|
|
||||||
{
|
|
||||||
return Result.Success().SetData(await _iRoleService.GetInMenuByRoleId(RoleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加角色包含菜单
|
/// 添加角色包含菜单
|
||||||
@@ -69,7 +60,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> AddInfo(RoleInfoDto roleDto)
|
public async Task<Result> Add(RoleInfoDto roleDto)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _iRoleService.AddInfo(roleDto));
|
return Result.Success().SetData(await _iRoleService.AddInfo(roleDto));
|
||||||
}
|
}
|
||||||
@@ -79,7 +70,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public async Task<Result> UpdateInfo(RoleInfoDto roleDto)
|
public async Task<Result> Update(RoleInfoDto roleDto)
|
||||||
{
|
{
|
||||||
return Result.Success().SetStatus(await _iRoleService.UpdateInfo(roleDto));
|
return Result.Success().SetStatus(await _iRoleService.UpdateInfo(roleDto));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class UserController : BaseSimpleCrudController<UserEntity>
|
public class UserController : BaseSimpleRdController<UserEntity>
|
||||||
{
|
{
|
||||||
private IUserService _iUserService;
|
private IUserService _iUserService;
|
||||||
public UserController(ILogger<UserEntity> logger, IUserService iUserService) : base(logger, iUserService)
|
public UserController(ILogger<UserEntity> logger, IUserService iUserService) : base(logger, iUserService)
|
||||||
@@ -55,22 +55,22 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 添加用户,去重,密码加密
|
///// 添加用户,去重,密码加密
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="entity"></param>
|
///// <param name="entity"></param>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
[Permission($"{nameof(UserEntity)}:add")]
|
//[Permission($"{nameof(UserEntity)}:add")]
|
||||||
[HttpPost]
|
//[HttpPost]
|
||||||
public override async Task<Result> Add(UserEntity entity)
|
//public async Task<Result> Add(UserEntity entity)
|
||||||
{
|
//{
|
||||||
if (!await _iUserService.Exist(entity.UserName))
|
// if (!await _iUserService.Exist(entity.UserName))
|
||||||
{
|
// {
|
||||||
entity.BuildPassword();
|
// entity.BuildPassword();
|
||||||
return Result.Success().SetData(await _iUserService._repository.InsertReturnSnowflakeIdAsync(entity));
|
// return Result.Success().SetData(await _iUserService._repository.InsertReturnSnowflakeIdAsync(entity));
|
||||||
}
|
// }
|
||||||
return Result.SuccessError("用户已存在");
|
// return Result.SuccessError("用户已存在");
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 给多用户设置多角色
|
/// 给多用户设置多角色
|
||||||
@@ -87,21 +87,22 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过用户id得到用户信息关联部门、岗位、角色
|
/// 通过用户id得到用户信息关联部门、岗位、角色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{id}")]
|
[Route("{id}")]
|
||||||
public override async Task<Result> GetById(long id)
|
public override async Task<Result> GetById([FromRoute] long id)
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _iUserService.GetInfoById(id));
|
return Result.Success().SetData(await _iUserService.GetInfoById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新用户信息
|
/// 更新用户信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="userDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public async Task<Result> UpdateInfo(UserInfoDto userDto)
|
public async Task<Result> Update(UserInfoDto userDto)
|
||||||
{
|
{
|
||||||
return Result.Success().SetStatus(await _iUserService.UpdateInfo(userDto));
|
return Result.Success().SetStatus(await _iUserService.UpdateInfo(userDto));
|
||||||
}
|
}
|
||||||
@@ -109,13 +110,19 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加用户
|
/// 添加用户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="userDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> AddInfo(UserInfoDto userDto)
|
public async Task<Result> Add(UserInfoDto userDto)
|
||||||
{
|
{
|
||||||
return Result.Success().SetStatus(await _iUserService.AddInfo(userDto));
|
return Result.Success().SetStatus(await _iUserService.AddInfo(userDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重置密码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public async Task<Result> RestPassword(UserEntity user)
|
public async Task<Result> RestPassword(UserEntity user)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -22,7 +22,7 @@ export function getRole(roleId) {
|
|||||||
// 新增角色
|
// 新增角色
|
||||||
export function addRole(data) {
|
export function addRole(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/role/addInfo',
|
url: '/role/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -31,7 +31,7 @@ export function addRole(data) {
|
|||||||
// 修改角色
|
// 修改角色
|
||||||
export function updateRole(data) {
|
export function updateRole(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/role/updateInfo',
|
url: '/role/update',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export function getUser(userId) {
|
|||||||
// 新增用户
|
// 新增用户
|
||||||
export function addUser(data) {
|
export function addUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user/addInfo',
|
url: '/user/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -30,7 +30,7 @@ export function addUser(data) {
|
|||||||
// 修改用户
|
// 修改用户
|
||||||
export function updateUser(data) {
|
export function updateUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user/updateInfo',
|
url: '/user/update',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user