From f7157d283cb0289ba914c773099e8296304fd8ae Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Apr 2020 19:48:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=20system=20=E6=8F=90=E4=BE=9B=E6=96=B0?= =?UTF-8?q?=E7=9A=84=20Resource=20=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=202?= =?UTF-8?q?.=20admin-web=20=E6=8E=A5=E5=85=A5=E6=96=B0=E7=9A=84=20Resource?= =?UTF-8?q?=20=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/src/models/admin/resourceList.js | 14 +- admin-web/src/pages/Admin/ResourceList.js | 45 ++---- admin-web/src/services/admin.js | 22 --- admin-web/src/services/system.js | 26 +++ .../iocoder/mall/security/package-info.java | 1 - .../system/biz/enums/SystemErrorCodeEnum.java | 12 +- .../enums/authorization/ResourceTypeEnum.java | 12 +- .../bo/authorization/ResourceTreeNodeBO.java | 24 +++ .../authorization/ResourceConvert.java | 11 ++ .../biz/dataobject/authorization/RoleDO.java | 2 - ...rizationGetResourceTreeByAccountIdDTO.java | 22 +++ ...thorizationGetResourcesByAccountIdDTO.java | 2 +- .../biz/dto/authorization/ResourceAddDTO.java | 47 ++++++ .../dto/authorization/ResourceDeleteDTO.java | 23 +++ .../dto/authorization/ResourceGetTreeDTO.java | 25 +++ .../dto/authorization}/ResourceUpdateDTO.java | 15 +- .../authorization/ResourceDeleteEvent.java | 29 ++++ .../mall/system/biz/event/package-info.java | 6 + .../authorization/AuthorizationService.java | 13 +- .../AuthorizationServiceImpl.java | 33 +++- .../authorization/ResourceService.java | 25 ++- .../authorization/ResourceServiceImpl.java | 137 +++++++++++++++- .../AdminsAuthorizationController.java | 36 +---- .../AdminsResourceController.java | 71 +++++++++ .../datadict/AdminsDataDictController.java | 11 -- .../AdminsAuthorizationConvert.java | 12 ++ .../authorization/AdminsResourceConvert.java | 36 +++++ .../AdminsResourceAddRequest.java} | 24 ++- .../AdminsResourceUpdateRequest.java | 48 ++++++ .../AdminsAuthorizationMenuTreeResponse.java | 9 +- .../AdminsResourceTreeResponse.java | 36 +++++ .../mall/system/api/ResourceService.java | 36 ----- .../admin/service/ResourceServiceImpl.java | 148 ------------------ .../mall/admin/service/RoleServiceImpl.java | 39 ----- 34 files changed, 684 insertions(+), 368 deletions(-) delete mode 100644 common/mall-spring-boot-starter-security/src/main/java/cn/iocoder/mall/security/package-info.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/bo/authorization/ResourceTreeNodeBO.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/authorization/AuthorizationGetResourceTreeByAccountIdDTO.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/authorization/ResourceAddDTO.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/authorization/ResourceDeleteDTO.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/authorization/ResourceGetTreeDTO.java rename system/{system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/resource => system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/authorization}/ResourceUpdateDTO.java (84%) create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/event/authorization/ResourceDeleteEvent.java create mode 100644 system/system-biz/src/main/java/cn/iocoder/mall/system/biz/event/package-info.java create mode 100644 system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/authorization/AdminsResourceController.java create mode 100644 system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsResourceConvert.java rename system/{system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/resource/ResourceAddDTO.java => system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceAddRequest.java} (60%) create mode 100644 system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceUpdateRequest.java create mode 100644 system/system-rest/src/main/java/cn/iocoder/mall/system/rest/response/authorization/AdminsResourceTreeResponse.java delete mode 100644 system/system-service-api/src/main/java/cn/iocoder/mall/system/api/ResourceService.java delete mode 100644 system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java diff --git a/admin-web/src/models/admin/resourceList.js b/admin-web/src/models/admin/resourceList.js index f3d723e81..1859d53af 100644 --- a/admin-web/src/models/admin/resourceList.js +++ b/admin-web/src/models/admin/resourceList.js @@ -1,5 +1,5 @@ import { message } from 'antd'; -import { addResource, updateResource, deleteResource, resourceTree } from '../../services/admin'; +import { resourceTree, resourceAdd, resourceUpdate, resourceDelete } from '../../services/system'; const buildSelectTree = list => { return list.map(item => { @@ -8,8 +8,8 @@ const buildSelectTree = list => { children = buildSelectTree(item.children); } return { - title: item.displayName, - value: `${item.displayName}-${item.id}`, + title: item.name, + value: `${item.name}-${item.id}`, key: item.id, children, }; @@ -27,7 +27,7 @@ export default { effects: { *add({ payload }, { call, put }) { const { callback, body } = payload; - const response = yield call(addResource, body); + const response = yield call(resourceAdd, body); if (callback) { callback(response); } @@ -38,7 +38,7 @@ export default { }, *update({ payload }, { call, put }) { const { callback, body } = payload; - const response = yield call(updateResource, body); + const response = yield call(resourceUpdate, body); if (callback) { callback(response); } @@ -48,7 +48,7 @@ export default { }); }, *delete({ payload }, { call, put }) { - yield call(deleteResource, payload); + yield call(resourceDelete, payload); message.info('删除成功!'); yield put({ type: 'tree', @@ -71,7 +71,7 @@ export default { const resultData = payload; const treeData = buildSelectTree(resultData); - // value 要保护 displayName 不然,搜索会失效 + // value 要保护 name 不然,搜索会失效 const rootNode = [ { title: '根节点', diff --git a/admin-web/src/pages/Admin/ResourceList.js b/admin-web/src/pages/Admin/ResourceList.js index 31fc8ca1d..fb81ac897 100644 --- a/admin-web/src/pages/Admin/ResourceList.js +++ b/admin-web/src/pages/Admin/ResourceList.js @@ -89,9 +89,9 @@ const CreateForm = Form.create()(props => { )} - {form.getFieldDecorator('displayName', { + {form.getFieldDecorator('name', { rules: [{ required: true, message: '请输入名称!', min: 2 }], - initialValue: initValues.displayName, + initialValue: initValues.name, })()} @@ -99,8 +99,8 @@ const CreateForm = Form.create()(props => { rules: [{ required: true, message: '请选择父级编号!' }], initialValue: initValues.pid === 0 - ? `根节点-${initValues.pid}` - : initValues.pid ? `${initValues.displayName}-${initValues.pid}` : undefined, + ? `根节点` + : initValues.pid ? `${initValues.name}` : undefined, })( { } { initValues.type === 1 ? ( - - {form.getFieldDecorator('handler', { - initialValue: initValues.handler, - })()} + + {form.getFieldDecorator('route', { + initialValue: initValues.route, + })()} ) : '' } - {form.getFieldDecorator('permissions', { - initialValue: initValues.permissions, - })(