用户编辑界面

This commit is contained in:
chenchun
2022-09-11 02:39:33 +08:00
parent 0dca7acee6
commit d001a0de15
12 changed files with 445 additions and 607 deletions

View File

@@ -115,7 +115,7 @@
<param name="id"></param> <param name="id"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.GetList(Yi.Framework.Model.Query.QueryCondition)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.BaseSimpleCrudController`1.GetList">
<summary> <summary>
全部列表查询 全部列表查询
</summary> </summary>
@@ -150,40 +150,6 @@
<param name="page"></param> <param name="page"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.Add(Yi.Framework.Model.Models.DictionaryEntity)">
<summary>
添加字典表
</summary>
<param name="dic"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.GetById(System.Int64)">
<summary>
根据字典id获取字典表
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.GetList">
<summary>
获取全部字典表
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
id范围删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.Update(Yi.Framework.Model.Models.DictionaryEntity)">
<summary>
更新
</summary>
<param name="dic"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.Models.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.PageList(Yi.Framework.Model.Models.DictionaryInfoEntity,Yi.Framework.Common.Models.PageParModel)">
<summary> <summary>
动态条件分页查询 动态条件分页查询
@@ -192,13 +158,6 @@
<param name="page"></param> <param name="page"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.Add(Yi.Framework.Model.Models.DictionaryInfoEntity)">
<summary>
添加字典信息表
</summary>
<param name="dicInfo"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.GetListByType(System.String)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.GetListByType(System.String)">
<summary> <summary>
根据字典类别获取字典信息 根据字典类别获取字典信息
@@ -206,27 +165,6 @@
<param name="type"></param> <param name="type"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.DelList(System.Collections.Generic.List{System.Int64})">
<summary>
id范围删除
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.Update(Yi.Framework.Model.Models.DictionaryInfoEntity)">
<summary>
更新
</summary>
<param name="dicInfo"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryInfoController.GetById(System.Int64)">
<summary>
根据字典id获取字典信息表
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.FileController"> <member name="T:Yi.Framework.ApiMicroservice.Controllers.FileController">
<summary> <summary>
文件 文件
@@ -416,9 +354,9 @@
<param name="giveUserSetRoleDto"></param> <param name="giveUserSetRoleDto"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetRoleListByUserId(System.Int64)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetById(System.Int64)">
<summary> <summary>
通过用户id得到角色列表 通过用户id得到用户信息关联部门、岗位、角色
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>

View File

@@ -92,7 +92,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[Authorize] //[Authorize]
public async Task<Result> GetUserAllInfo() public async Task<Result> GetUserAllInfo()
{ {
//通过鉴权jwt获取到用户的id //通过鉴权jwt获取到用户的id
@@ -111,7 +111,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
{ {
var userId = HttpContext.GetCurrentUserEntityInfo(out _).Id; var userId = HttpContext.GetCurrentUserEntityInfo(out _).Id;
var data = await _iUserService.GetUserAllInfo(userId); var data = await _iUserService.GetUserAllInfo(userId);
//将后端菜单转换成前端路由,组件级别需要过滤 //将后端菜单转换成前端路由,组件级别需要过滤
List<VueRouterModel> routers = _iUserService.RouterBuild(data.Menus.ToList()); List<VueRouterModel> routers = _iUserService.RouterBuild(data.Menus.ToList());
return Result.Success().SetData(routers); return Result.Success().SetData(routers);

View File

@@ -34,8 +34,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[Permission($"{nameof(T)}:get")] [Permission($"{nameof(T)}:get")]
[Route("{id}")]
[HttpGet] [HttpGet]
public virtual async Task<Result> GetById(long id) public virtual async Task<Result> GetById([FromRoute]long id)
{ {
return Result.Success().SetData(await _repository.GetByIdAsync(id)); return Result.Success().SetData(await _repository.GetByIdAsync(id));
} }
@@ -45,7 +46,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Permission($"{nameof(T)}:get")] [Permission($"{nameof(T)}:get")]
[HttpPost] [HttpGet]
public virtual async Task<Result> GetList() public virtual async Task<Result> GetList()
{ {
return Result.Success().SetData(await _repository.GetListAsync()); return Result.Success().SetData(await _repository.GetListAsync());

View File

@@ -21,7 +21,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary> /// </summary>
[ApiController] [ApiController]
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
public class RoleController : BaseCrudController<RoleEntity> public class RoleController : BaseSimpleCrudController<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)

View File

@@ -21,7 +21,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary> /// </summary>
[ApiController] [ApiController]
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
public class UserController : BaseCrudController<UserEntity> public class UserController : BaseSimpleCrudController<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)
@@ -85,13 +85,14 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <summary> /// <summary>
/// 通过用户id得到角色列表 /// 通过用户id得到用户信息关联部门、岗位、角色
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public async Task<Result> GetRoleListByUserId(long userId) [Route("{id}")]
public override async Task<Result> GetById(long id)
{ {
return Result.Success().SetData(await _iUserService.GetRoleListByUserId(userId)); return Result.Success().SetData(await _iUserService.GetInfoById(id));
} }
} }
} }

View File

@@ -10,6 +10,12 @@ namespace Yi.Framework.Interface
{ {
public partial interface IUserService public partial interface IUserService
{ {
/// <summary>
/// 关联角色测试
/// </summary>
/// <returns></returns>
Task<List<UserEntity>> GetListInRole();
/// <summary> /// <summary>
/// 测试仓储的上下文对象 /// 测试仓储的上下文对象
/// </summary> /// </summary>
@@ -34,10 +40,10 @@ namespace Yi.Framework.Interface
Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null); Task<bool> Register(UserEntity userEntity, Action<UserEntity> userAction = null);
/// <summary> /// <summary>
/// 导航属性关联角色 /// 导航属性关联角色、部门、岗位
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task<List<UserEntity>> GetListInRole(); Task<UserEntity> GetInfoById(long userId);
/// <summary> /// <summary>
/// 给用户设置角色,多用户,多角色 /// 给用户设置角色,多用户,多角色
@@ -55,13 +61,6 @@ namespace Yi.Framework.Interface
/// <returns></returns> /// <returns></returns>
Task<bool> Exist(string userName, Action<UserEntity> userAction = null); Task<bool> Exist(string userName, Action<UserEntity> userAction = null);
/// <summary>
/// 通过用户id得到角色列表
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
Task<List<RoleEntity>> GetRoleListByUserId(long userId);
/// <summary> /// <summary>
/// 获取当前登录用户的所有信息 /// 获取当前登录用户的所有信息
/// </summary> /// </summary>

View File

@@ -6,7 +6,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="NEST" Version="7.16.0" /> <PackageReference Include="NEST" Version="7.16.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.2.7" /> <PackageReference Include="SqlSugarCore" Version="5.1.2.8-preview04" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -16,6 +16,10 @@ namespace Yi.Framework.Service
{ {
public partial class UserService public partial class UserService
{ {
public async Task<List<UserEntity>> GetListInRole()
{
return await _repository._DbQueryable.Includes(u => u.Roles).ToListAsync();
}
public async Task<List<UserEntity>> DbTest() public async Task<List<UserEntity>> DbTest()
{ {
return await _repository._Db.Queryable<UserEntity>().ToListAsync(); return await _repository._Db.Queryable<UserEntity>().ToListAsync();
@@ -64,23 +68,12 @@ namespace Yi.Framework.Service
{ {
user.UserName = userEntity.UserName; user.UserName = userEntity.UserName;
user.BuildPassword(); user.BuildPassword();
//等待老杰哥更新杰哥漏了雪花id呀嘿嘿 userAction.Invoke(await _repository.InsertReturnEntityAsync(user));
//var entity = await _repository.InsertReturnSnowflakeEntityAsync(user);
//userAction.Invoke(await _repository.GetByIdAsync(entity));
//await _repository.InsertReturnSnowflakeEntityAsync(user);
//userAction.Invoke(await _repository.GetByIdAsync(user));
return true; return true;
} }
return false; return false;
} }
public async Task<List<UserEntity>> GetListInRole()
{
return await _repository._DbQueryable.Includes(u => u.Roles).ToListAsync();
}
public async Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds) public async Task<bool> GiveUserSetRole(List<long> userIds, List<long> roleIds)
{ {
var _repositoryUserRole = _repository.ChangeRepository<Repository<UserRoleEntity>>(); var _repositoryUserRole = _repository.ChangeRepository<Repository<UserRoleEntity>>();
@@ -109,9 +102,9 @@ namespace Yi.Framework.Service
} }
public async Task<List<RoleEntity>> GetRoleListByUserId(long userId) public async Task<UserEntity> GetInfoById(long userId)
{ {
return (await _repository._DbQueryable.Includes(u => u.Roles).InSingleAsync(userId)).Roles; return await _repository._DbQueryable.Includes(u => u.Roles).InSingleAsync(userId);
} }
public async Task<UserRoleMenuDto> GetUserAllInfo(long userId) public async Task<UserRoleMenuDto> GetUserAllInfo(long userId)
@@ -179,7 +172,8 @@ namespace Yi.Framework.Service
.WhereIF(!string.IsNullOrEmpty(user.Name), u => u.Name.Contains(user.Name)) .WhereIF(!string.IsNullOrEmpty(user.Name), u => u.Name.Contains(user.Name))
.WhereIF(!string.IsNullOrEmpty(user.Phone), u => u.Phone.Contains(user.Phone)) .WhereIF(!string.IsNullOrEmpty(user.Phone), u => u.Phone.Contains(user.Phone))
.WhereIF(page.StartTime.IsNotNull() && page.EndTime.IsNotNull(), u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) .WhereIF(page.StartTime.IsNotNull() && page.EndTime.IsNotNull(), u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
.Where(u => u.IsDeleted == false) .Where(u => u.IsDeleted == user.IsDeleted)
.Includes(u => u.Roles)
.OrderBy(u => u.OrderNum, OrderByType.Desc) .OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total); .ToPageListAsync(page.PageNum, page.PageSize, total);

View File

@@ -117,3 +117,10 @@ export function deptTreeSelect(roleId) {
method: 'get' method: 'get'
}) })
} }
// 获取角色选择框列表
export function roleOptionselect() {
return request({
url: '/role/getList',
method: 'get'
})
}

View File

@@ -13,7 +13,7 @@ export function listUser(query) {
// 查询用户详细 // 查询用户详细
export function getUser(userId) { export function getUser(userId) {
return request({ return request({
url: '/system/user/' + parseStrEmpty(userId), url: '/user/getById/' + parseStrEmpty(userId),
method: 'get' method: 'get'
}) })
} }

File diff suppressed because it is too large Load Diff