diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index 661d2ca7..6f908b4c 100644 Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index 5c7257c5..b1d379e1 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -181,6 +181,27 @@ + + + 添加 + + + + + + + 更新 + + + + + + + 根据角色id获取该角色下全部部门 + + + + 动态条件分页查询 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs index b9fb1de5..e6e74b00 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs @@ -37,15 +37,36 @@ namespace Yi.Framework.ApiMicroservice.Controllers } - + /// + /// 添加 + /// + /// + /// public override async Task Add(DeptEntity entity) { return await base.Add(entity); } + /// + /// 更新 + /// + /// + /// public override async Task Update(DeptEntity entity) { return await base.Update(entity); } + + /// + /// 根据角色id获取该角色下全部部门 + /// + /// + /// + [HttpGet] + [Route("{id}")] + public async Task GetListByRoleId(long id) + { + return Result.Success().SetData(await _iDeptService.GetListByRoleId(id)); + } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs index 84703810..738acd95 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs @@ -87,5 +87,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers return Result.Success().SetData(await _iRoleService._repository.UpdateIgnoreNullAsync(new RoleEntity() { Id = roleId, IsDeleted = isDel })); } + + } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 6b62182e..6010d8eb 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IDeptService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IDeptService.cs index 26e345a1..bbb1a275 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IDeptService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IDeptService.cs @@ -14,5 +14,13 @@ namespace Yi.Framework.Interface /// /// Task> SelctGetList(DeptEntity dept); + + + /// + /// 根据角色id获取该角色的部门权限 + /// + /// + /// + Task> GetListByRoleId(long roleId); } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs index 37fe431d..3aec15c2 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs @@ -8,9 +8,11 @@ namespace Yi.Framework.Model.Models public partial class RoleEntity { - //[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.RoleId), nameof(UserRoleEntity.UserId))] - //public List Users { get; set; } + [Navigate(typeof(RoleMenuEntity),nameof(RoleMenuEntity.RoleId),nameof(RoleMenuEntity.MenuId))] public List Menus { get; set; } + + [Navigate(typeof(RoleDeptEntity), nameof(RoleDeptEntity.RoleId), nameof(RoleDeptEntity.DeptId))] + public List Depts { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/DeptService.cs b/Yi.Framework.Net6/Yi.Framework.Service/DeptService.cs index a031e847..fc04ad51 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/DeptService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/DeptService.cs @@ -21,5 +21,10 @@ namespace Yi.Framework.Service return data; } + + public async Task> GetListByRoleId(long roleId) + { + return (await _repository._Db.Queryable().Includes(r => r.Depts).SingleAsync(r => r.Id == roleId)).Depts; + } } } diff --git a/Yi.Vue3.X.RuoYi/src/api/system/dept.js b/Yi.Vue3.X.RuoYi/src/api/system/dept.js index 0d85cd7f..cf28c932 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/dept.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/dept.js @@ -54,4 +54,13 @@ export function delDept(deptId) { method: 'delete', data:deptId }) +} + + +// 根据角色ID查询菜单下拉树结构 +export function roleDeptTreeselect(roleId) { + return request({ + url: '/dept/getListByRoleId/' + roleId, + method: 'get' + }) } \ No newline at end of file diff --git a/Yi.Vue3.X.RuoYi/src/api/system/role.js b/Yi.Vue3.X.RuoYi/src/api/system/role.js index 60ec5f10..7f401116 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/role.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/role.js @@ -113,12 +113,12 @@ export function authUserSelectAll(data) { } // 根据角色ID查询部门树结构 -export function deptTreeSelect(roleId) { - return request({ - url: '/system/role/deptTree/' + roleId, - method: 'get' - }) -} +// export function deptTreeSelect(roleId) { +// return request({ +// url: '/system/role/deptTree/' + roleId, +// method: 'get' +// }) +// } // 获取角色选择框列表 export function roleOptionselect() { return request({ diff --git a/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue index 99d9cc4d..ea2bfefb 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue @@ -137,18 +137,18 @@ - + - + - + - + 展开/折叠 全选/全不选 父子联动 @@ -165,13 +165,14 @@ +