From 71cf85f535e43aecc1c30e8eb3964f7d8d5a3aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= Date: Thu, 15 Sep 2022 19:45:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebFirst/database/sqlite.db | Bin 634880 -> 634880 bytes .../Config/SwaggerDoc.xml | 21 ++++++ .../Controllers/DeptController.cs | 23 +++++- .../Controllers/RoleController.cs | 2 + .../yi-sqlsugar-dev.db | Bin 151552 -> 151552 bytes .../Yi.Framework.Interface/IDeptService.cs | 8 +++ .../Yi.Framework.Model/RoleEntity.cs | 6 +- .../Yi.Framework.Service/DeptService.cs | 5 ++ Yi.Vue3.X.RuoYi/src/api/system/dept.js | 9 +++ Yi.Vue3.X.RuoYi/src/api/system/role.js | 12 ++-- .../src/views/system/role/index.vue | 67 +++++++++++------- 11 files changed, 117 insertions(+), 36 deletions(-) diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index 661d2ca7c96e8f4b5914b54d9939a9d0c499ff30..6f908b4c7c286324f7bf7bbb5de2179fa33c0183 100644 GIT binary patch delta 62 zcmZp8pw{p}ZGyDm9|i`7*+2{f-4k_;8UHjUv?egNCNQ-oFt;YKv?j2&Ca|?8u(u{~ KY)#-?upR&_BocA} delta 62 zcmZp8pw{p}ZGyDmPX-2t*+2{fofCD88Gkk=v?egNCNQ-oFt;YKv?j2&Ca|?8u(u{~ KY)#-?upR&@+Y)L3 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 6b62182e49aa08886dc48df008666acc385cce7f..6010d8eb458d1aa4e7ada590e64a95d9987c3deb 100644 GIT binary patch delta 131 zcmZozz}c{XbAmMEr-?Gote+V4f)h5T%=70dV_@NvVBi<$JHWqgGhcuNA0x+P^*DbP z{$vKP$yIS~{Gm*|Z1N1o&KwL3!i?e^lUw3E_`Mi;*(4c^9f4wkoD3Y3)#7bg7#JA5 fC#T1|^9L~VvPnZU2y%#WOfHOfZc12|!1w_GM1~z< delta 253 zcmZozz}c{XbAmMEyNNQ+tnV1~+*fQ&ndi@QhJl4of`MOxuZ%x=GhcuNA0xwL^*Dc) z5GEeB$yIS~ley!0qWHHk_((E1GjK342y@7a9^L&t*-3!m+1BnC>!%tS7#ZmrSn3)Y zDj1qt8CzNznCn@Zo0}LI8ygxKL)0V}^9M2VumO#5=I{hFj2(ey334(_R*Sb~@n;6w zl^*XNRGD6$l94nG>u+lr6F>?2rKC^WFW=C$vFqGto6NQ!q5QGBLL@Fn|b| g>Ka%m7@Am_m;l|NXKZL`ZfazbmD7~4EP?R@0IR}5%>V!Z 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 @@ +