From 23e4ad1cb0d8b90c18e644d276bdbbe2e54da133 Mon Sep 17 00:00:00 2001 From: xuyuxiang Date: Thu, 26 Feb 2026 16:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E5=A4=A7=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96=EF=BC=88?= =?UTF-8?q?=E5=BE=85=E5=AE=8C=E5=96=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snowy-admin-web/src/api/biz/bizGroupApi.js | 4 +- snowy-admin-web/src/api/biz/bizOrgApi.js | 8 +- snowy-admin-web/src/api/biz/bizPositionApi.js | 6 +- snowy-admin-web/src/api/biz/bizUserApi.js | 6 +- snowy-admin-web/src/api/sys/groupApi.js | 4 +- snowy-admin-web/src/api/sys/orgApi.js | 8 +- snowy-admin-web/src/api/sys/positionApi.js | 6 +- snowy-admin-web/src/api/sys/roleApi.js | 6 +- snowy-admin-web/src/api/sys/userApi.js | 6 +- .../components/Selector/orgSelectorPlus.vue | 51 ++++++++----- .../src/components/XnOrgSelector/index.vue | 4 +- .../components/XnPositionSelector/index.vue | 4 +- .../src/components/XnRoleSelector/index.vue | 4 +- .../src/components/XnUserSelector/index.vue | 4 +- snowy-admin-web/src/views/biz/group/index.vue | 4 +- snowy-admin-web/src/views/biz/org/form.vue | 5 -- .../src/views/biz/position/index.vue | 3 +- snowy-admin-web/src/views/biz/user/form.vue | 4 +- snowy-admin-web/src/views/biz/user/index.vue | 8 +- snowy-admin-web/src/views/sys/group/index.vue | 4 +- snowy-admin-web/src/views/sys/org/form.vue | 5 -- .../src/views/sys/position/index.vue | 4 +- snowy-admin-web/src/views/sys/role/index.vue | 8 +- snowy-admin-web/src/views/sys/user/form.vue | 4 +- snowy-admin-web/src/views/sys/user/index.vue | 8 +- .../group/controller/BizGroupController.java | 6 +- .../group/service/BizGroupService.java | 10 +++ .../service/impl/BizGroupServiceImpl.java | 7 ++ .../org/controller/BizOrgController.java | 22 +----- .../modular/org/service/BizOrgService.java | 16 ---- .../org/service/impl/BizOrgServiceImpl.java | 75 +++++++------------ .../controller/BizPositionController.java | 18 +---- .../user/controller/BizUserController.java | 18 +---- .../group/controller/SysGroupController.java | 7 +- .../group/service/SysGroupService.java | 10 +++ .../service/impl/SysGroupServiceImpl.java | 7 ++ .../org/controller/SysOrgController.java | 17 +---- .../org/service/impl/SysOrgServiceImpl.java | 12 --- .../controller/SysPositionController.java | 15 +--- .../role/controller/SysRoleController.java | 15 +--- .../user/controller/SysUserController.java | 15 +--- 41 files changed, 156 insertions(+), 292 deletions(-) diff --git a/snowy-admin-web/src/api/biz/bizGroupApi.js b/snowy-admin-web/src/api/biz/bizGroupApi.js index dbd40346..255dca24 100644 --- a/snowy-admin-web/src/api/biz/bizGroupApi.js +++ b/snowy-admin-web/src/api/biz/bizGroupApi.js @@ -29,8 +29,8 @@ export default { groupOwnUser(data) { return request('ownUser', data, 'get') }, - // 获取机构树 - groupOrgTreeSelector(data) { + // 获取机构树(懒加载) + groupOrgTreeLazySelector(data) { return request('orgTreeSelector', data, 'get') }, // 获取用户选择器 diff --git a/snowy-admin-web/src/api/biz/bizOrgApi.js b/snowy-admin-web/src/api/biz/bizOrgApi.js index d77444c5..d40db1de 100644 --- a/snowy-admin-web/src/api/biz/bizOrgApi.js +++ b/snowy-admin-web/src/api/biz/bizOrgApi.js @@ -32,7 +32,7 @@ export default { }, // 获取机构树(懒加载) orgTreeLazy(data) { - return request('treeLazy', data, 'get') + return request('tree', data, 'get') }, // 提交表单 edit为true时为编辑,默认为新增 submitForm(data, edit = false) { @@ -46,13 +46,9 @@ export default { orgDetail(data) { return request('detail', data, 'get') }, - // 获取机构树选择器 - orgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取机构树选择器(懒加载) orgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取人员选择器 orgUserSelector(data) { diff --git a/snowy-admin-web/src/api/biz/bizPositionApi.js b/snowy-admin-web/src/api/biz/bizPositionApi.js index 2cbc2761..99912698 100644 --- a/snowy-admin-web/src/api/biz/bizPositionApi.js +++ b/snowy-admin-web/src/api/biz/bizPositionApi.js @@ -38,13 +38,9 @@ export default { positionDetail(data) { return request('detail', data, 'get') }, - // 获取机构树选择器 - positionOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取机构树选择器(懒加载) positionOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取岗位选择器 positionPositionSelector(data) { diff --git a/snowy-admin-web/src/api/biz/bizUserApi.js b/snowy-admin-web/src/api/biz/bizUserApi.js index 02ad02b5..a8509c3b 100644 --- a/snowy-admin-web/src/api/biz/bizUserApi.js +++ b/snowy-admin-web/src/api/biz/bizUserApi.js @@ -46,13 +46,9 @@ export default { userResetPassword(data) { return request('resetPassword', data) }, - // 获取组织选择器 - userOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取组织选择器(懒加载) userOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取职位选择器 userPositionSelector(data) { diff --git a/snowy-admin-web/src/api/sys/groupApi.js b/snowy-admin-web/src/api/sys/groupApi.js index d8007069..fcfa1fb1 100644 --- a/snowy-admin-web/src/api/sys/groupApi.js +++ b/snowy-admin-web/src/api/sys/groupApi.js @@ -29,8 +29,8 @@ export default { groupOwnUser(data) { return request('ownUser', data, 'get') }, - // 获取机构树 - groupOrgTreeSelector(data) { + // 获取机构树(懒加载) + groupOrgTreeLazySelector(data) { return request('orgTreeSelector', data, 'get') }, // 获取用户选择器 diff --git a/snowy-admin-web/src/api/sys/orgApi.js b/snowy-admin-web/src/api/sys/orgApi.js index bf3d2823..c5e5c48b 100644 --- a/snowy-admin-web/src/api/sys/orgApi.js +++ b/snowy-admin-web/src/api/sys/orgApi.js @@ -28,7 +28,7 @@ export default { }, // 获取组织树(懒加载) orgTreeLazy(data) { - return request('treeLazy', data, 'get') + return request('tree', data, 'get') }, // 提交表单 edit为true时为编辑,默认为新增 submitForm(data, edit = false) { @@ -42,13 +42,9 @@ export default { orgDetail(data) { return request('detail', data, 'get') }, - // 获取组织树选择器 - orgOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取组织树选择器(懒加载) orgOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取用户选择器 orgUserSelector(data) { diff --git a/snowy-admin-web/src/api/sys/positionApi.js b/snowy-admin-web/src/api/sys/positionApi.js index 686fff3f..7bdbf23e 100644 --- a/snowy-admin-web/src/api/sys/positionApi.js +++ b/snowy-admin-web/src/api/sys/positionApi.js @@ -38,13 +38,9 @@ export default { positionDetail(data) { return request('detail', data, 'get') }, - // 获取组织树选择器 - positionOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取组织树选择器(懒加载) positionOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取职位选择器 positionPositionSelector(data) { diff --git a/snowy-admin-web/src/api/sys/roleApi.js b/snowy-admin-web/src/api/sys/roleApi.js index 836234a2..3eb2fe3c 100644 --- a/snowy-admin-web/src/api/sys/roleApi.js +++ b/snowy-admin-web/src/api/sys/roleApi.js @@ -66,13 +66,9 @@ export default { roleGrantUser(data) { return request('grantUser', data) }, - // 获取机构树 - roleOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取机构树(懒加载) roleOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取资源授权树 roleResourceTreeSelector(data) { diff --git a/snowy-admin-web/src/api/sys/userApi.js b/snowy-admin-web/src/api/sys/userApi.js index 7fc7dfc9..6797d2ea 100644 --- a/snowy-admin-web/src/api/sys/userApi.js +++ b/snowy-admin-web/src/api/sys/userApi.js @@ -46,13 +46,9 @@ export default { userResetPassword(data) { return request('resetPassword', data) }, - // 获取组织选择器 - userOrgTreeSelector(data) { - return request('orgTreeSelector', data, 'get') - }, // 获取组织选择器(懒加载) userOrgTreeLazySelector(data) { - return request('orgTreeLazySelector', data, 'get') + return request('orgTreeSelector', data, 'get') }, // 获取职位选择器 userPositionSelector(data) { diff --git a/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue b/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue index 9522ffcf..7aa1fd1f 100644 --- a/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue +++ b/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue @@ -16,6 +16,7 @@ v-model:expandedKeys="defaultExpandedKeys" :tree-data="treeData" :field-names="treeFieldNames" + :load-data="onLoadData" @select="treeSelect" > @@ -160,7 +161,7 @@ const tableData = ref([]) const selectedData = ref([]) const recordIds = ref() - const props = defineProps(['orgPageApi', 'orgTreeApi', 'radioModel', 'dataIsConverterFlw', 'checkedOrgListApi']) + const props = defineProps(['orgPageApi', 'orgTreeLazyApi', 'radioModel', 'dataIsConverterFlw', 'checkedOrgListApi']) // 是否是单选 const radioModel = props.radioModel || false // 数据是否转换成工作流格式 @@ -177,25 +178,19 @@ ids = goDataConverter(ids) } recordIds.value = ids - if (props.orgTreeApi) { - // 获取机构树 - props.orgTreeApi().then((data) => { + if (props.orgTreeLazyApi) { + // 加载根节点(不传 parentId) + props.orgTreeLazyApi().then((data) => { cardLoading.value = false if (data !== null) { - treeData.value = data - // 默认展开2级 - treeData.value.forEach((item) => { - // 因为0的顶级 - if (item.parentId === '0') { - defaultExpandedKeys.value.push(item.id) - // 取到下级ID - if (item.children) { - item.children.forEach((items) => { - defaultExpandedKeys.value.push(items.id) - }) - } - } - }) + treeData.value = data.map((item) => ({ + ...item, + isLeaf: item.isLeaf === undefined ? false : item.isLeaf + })) + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { + defaultExpandedKeys.value.push(treeData.value[0].id) + } } }) } @@ -322,6 +317,23 @@ delete searchFormState.value.searchKey loadData() } + // 懒加载子节点 + const onLoadData = (treeNode) => { + return new Promise((resolve) => { + if (!props.orgTreeLazyApi || treeNode.dataRef.children || treeNode.dataRef.isLeaf) { + resolve() + return + } + props.orgTreeLazyApi({ parentId: treeNode.dataRef.id }).then((data) => { + treeNode.dataRef.children = data.map((item) => ({ + ...item, + isLeaf: item.isLeaf === undefined ? false : item.isLeaf + })) + treeData.value = [...treeData.value] + resolve() + }) + }) + } const handleClose = () => { searchFormState.value = {} tableRecordNum.value = 0 @@ -330,6 +342,9 @@ pageSize.value = 20 total.value = 0 selectedData.value = [] + treeData.value = undefined + defaultExpandedKeys.value = [] + cardLoading.value = true visible.value = false } diff --git a/snowy-admin-web/src/components/XnOrgSelector/index.vue b/snowy-admin-web/src/components/XnOrgSelector/index.vue index ee328e14..4e582300 100644 --- a/snowy-admin-web/src/components/XnOrgSelector/index.vue +++ b/snowy-admin-web/src/components/XnOrgSelector/index.vue @@ -339,8 +339,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/components/XnPositionSelector/index.vue b/snowy-admin-web/src/components/XnPositionSelector/index.vue index 694e4e49..3a7f7724 100644 --- a/snowy-admin-web/src/components/XnPositionSelector/index.vue +++ b/snowy-admin-web/src/components/XnPositionSelector/index.vue @@ -335,8 +335,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/components/XnRoleSelector/index.vue b/snowy-admin-web/src/components/XnRoleSelector/index.vue index 85bbe88d..4f5a18c8 100644 --- a/snowy-admin-web/src/components/XnRoleSelector/index.vue +++ b/snowy-admin-web/src/components/XnRoleSelector/index.vue @@ -342,8 +342,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/components/XnUserSelector/index.vue b/snowy-admin-web/src/components/XnUserSelector/index.vue index 29a599c5..d6d7a2f0 100644 --- a/snowy-admin-web/src/components/XnUserSelector/index.vue +++ b/snowy-admin-web/src/components/XnUserSelector/index.vue @@ -334,8 +334,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/views/biz/group/index.vue b/snowy-admin-web/src/views/biz/group/index.vue index 80a01e05..1d1f092d 100644 --- a/snowy-admin-web/src/views/biz/group/index.vue +++ b/snowy-admin-web/src/views/biz/group/index.vue @@ -183,8 +183,8 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return bizGroupApi.groupOrgTreeSelector(param).then((data) => { + orgTreeLazyApi: (param) => { + return bizGroupApi.groupOrgTreeLazySelector(param).then((data) => { return Promise.resolve(data) }) }, diff --git a/snowy-admin-web/src/views/biz/org/form.vue b/snowy-admin-web/src/views/biz/org/form.vue index 86646b85..93b4297b 100644 --- a/snowy-admin-web/src/views/biz/org/form.vue +++ b/snowy-admin-web/src/views/biz/org/form.vue @@ -192,11 +192,6 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return bizOrgApi.orgTreeSelector(param).then((data) => { - return Promise.resolve(data) - }) - }, orgTreeLazyApi: (param) => { return bizOrgApi.orgTreeLazySelector(param).then((data) => { return Promise.resolve(data) diff --git a/snowy-admin-web/src/views/biz/position/index.vue b/snowy-admin-web/src/views/biz/position/index.vue index ac5cc9ac..1bbb8b4d 100644 --- a/snowy-admin-web/src/views/biz/position/index.vue +++ b/snowy-admin-web/src/views/biz/position/index.vue @@ -259,7 +259,8 @@ } }) if (isEmpty(defaultExpandedKeys.value)) { - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/views/biz/user/form.vue b/snowy-admin-web/src/views/biz/user/form.vue index 4bd96a4e..ca9c6a08 100644 --- a/snowy-admin-web/src/views/biz/user/form.vue +++ b/snowy-admin-web/src/views/biz/user/form.vue @@ -373,8 +373,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { treeDefaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/views/biz/user/index.vue b/snowy-admin-web/src/views/biz/user/index.vue index a60baaab..a81a12e5 100644 --- a/snowy-admin-web/src/views/biz/user/index.vue +++ b/snowy-admin-web/src/views/biz/user/index.vue @@ -334,7 +334,8 @@ } }) if (isEmpty(defaultExpandedKeys.value)) { - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } @@ -502,11 +503,6 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return bizUserApi.userOrgTreeSelector(param).then((orgTree) => { - return Promise.resolve(orgTree) - }) - }, orgTreeLazyApi: (param) => { return bizUserApi.userOrgTreeLazySelector(param).then((orgTree) => { return Promise.resolve(orgTree) diff --git a/snowy-admin-web/src/views/sys/group/index.vue b/snowy-admin-web/src/views/sys/group/index.vue index d43449f4..2400f32b 100644 --- a/snowy-admin-web/src/views/sys/group/index.vue +++ b/snowy-admin-web/src/views/sys/group/index.vue @@ -182,8 +182,8 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return sysGroupApi.groupOrgTreeSelector(param).then((data) => { + orgTreeLazyApi: (param) => { + return sysGroupApi.groupOrgTreeLazySelector(param).then((data) => { return Promise.resolve(data) }) }, diff --git a/snowy-admin-web/src/views/sys/org/form.vue b/snowy-admin-web/src/views/sys/org/form.vue index a8325674..df9cc142 100644 --- a/snowy-admin-web/src/views/sys/org/form.vue +++ b/snowy-admin-web/src/views/sys/org/form.vue @@ -191,11 +191,6 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return orgApi.orgOrgTreeSelector(param).then((data) => { - return Promise.resolve(data) - }) - }, orgTreeLazyApi: (param) => { return orgApi.orgOrgTreeLazySelector(param).then((data) => { return Promise.resolve(data) diff --git a/snowy-admin-web/src/views/sys/position/index.vue b/snowy-admin-web/src/views/sys/position/index.vue index 48953454..ebe1173b 100644 --- a/snowy-admin-web/src/views/sys/position/index.vue +++ b/snowy-admin-web/src/views/sys/position/index.vue @@ -256,8 +256,8 @@ } }) if (isEmpty(defaultExpandedKeys.value)) { - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/views/sys/role/index.vue b/snowy-admin-web/src/views/sys/role/index.vue index 4eb66541..45ee717d 100644 --- a/snowy-admin-web/src/views/sys/role/index.vue +++ b/snowy-admin-web/src/views/sys/role/index.vue @@ -318,7 +318,8 @@ }) ) if (isEmpty(defaultExpandedKeys.value)) { - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } @@ -419,11 +420,6 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return roleApi.roleOrgTreeSelector(param).then((data) => { - return Promise.resolve(data) - }) - }, orgTreeLazyApi: (param) => { return orgApi.orgOrgTreeLazySelector(param).then((data) => { return Promise.resolve(data) diff --git a/snowy-admin-web/src/views/sys/user/form.vue b/snowy-admin-web/src/views/sys/user/form.vue index 42f000af..f24a04f8 100644 --- a/snowy-admin-web/src/views/sys/user/form.vue +++ b/snowy-admin-web/src/views/sys/user/form.vue @@ -373,8 +373,8 @@ isLeaf: item.isLeaf === undefined ? false : item.isLeaf } }) - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { treeDefaultExpandedKeys.value.push(treeData.value[0].id) } } diff --git a/snowy-admin-web/src/views/sys/user/index.vue b/snowy-admin-web/src/views/sys/user/index.vue index 46aad428..bea18174 100644 --- a/snowy-admin-web/src/views/sys/user/index.vue +++ b/snowy-admin-web/src/views/sys/user/index.vue @@ -350,8 +350,8 @@ } }) if (isEmpty(defaultExpandedKeys.value)) { - // 默认展开第一级 - if (treeData.value.length > 0) { + // 只有一个根节点时才自动展开 + if (treeData.value.length === 1) { defaultExpandedKeys.value.push(treeData.value[0].id) } } @@ -523,8 +523,8 @@ } // 传递设计器需要的API const selectorApiFunction = { - orgTreeApi: (param) => { - return userApi.userOrgTreeSelector(param).then((data) => { + orgTreeLazyApi: (param) => { + return userApi.userOrgTreeLazySelector(param).then((data) => { return Promise.resolve(data) }) }, diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/controller/BizGroupController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/controller/BizGroupController.java index a02e7584..8b45c94a 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/controller/BizGroupController.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/controller/BizGroupController.java @@ -14,6 +14,7 @@ package vip.xiaonuo.biz.modular.group.controller; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.lang.tree.Tree; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController; import vip.xiaonuo.biz.modular.group.entity.BizGroup; import vip.xiaonuo.biz.modular.group.param.*; import vip.xiaonuo.biz.modular.group.service.BizGroupService; +import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam; import vip.xiaonuo.biz.modular.user.entity.BizUser; import vip.xiaonuo.common.annotation.CommonLog; import vip.xiaonuo.common.pojo.CommonResult; @@ -142,8 +144,8 @@ public class BizGroupController { @Operation(summary = "获取组织树选择器") @SaCheckPermission("/biz/group/orgTreeSelector") @GetMapping("/biz/group/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(bizGroupService.orgTreeSelector()); + public CommonResult> orgTreeSelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) { + return CommonResult.data(bizGroupService.orgTreeLazySelector(bizOrgTreeLazyParam)); } /** diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/BizGroupService.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/BizGroupService.java index cc70db51..d86ea199 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/BizGroupService.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/BizGroupService.java @@ -13,10 +13,12 @@ package vip.xiaonuo.biz.modular.group.service; import cn.hutool.core.lang.tree.Tree; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import vip.xiaonuo.biz.modular.group.entity.BizGroup; import vip.xiaonuo.biz.modular.group.param.*; +import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam; import vip.xiaonuo.biz.modular.user.entity.BizUser; import java.util.List; @@ -93,6 +95,14 @@ public interface BizGroupService extends IService { */ List> orgTreeSelector(); + /** + * 获取机构树选择器(懒加载) + * + * @author xuyuxiang + * @date 2022/4/24 20:00 + */ + List orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam); + /** * 获取用户选择器 * diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/impl/BizGroupServiceImpl.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/impl/BizGroupServiceImpl.java index ea551056..1813c97f 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/impl/BizGroupServiceImpl.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/group/service/impl/BizGroupServiceImpl.java @@ -20,6 +20,7 @@ import cn.hutool.core.lang.tree.TreeNode; import cn.hutool.core.lang.tree.TreeUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -34,6 +35,7 @@ import vip.xiaonuo.biz.modular.group.mapper.BizGroupMapper; import vip.xiaonuo.biz.modular.group.param.*; import vip.xiaonuo.biz.modular.group.service.BizGroupService; import vip.xiaonuo.biz.modular.org.entity.BizOrg; +import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam; import vip.xiaonuo.biz.modular.org.service.BizOrgService; import vip.xiaonuo.biz.modular.user.entity.BizUser; import vip.xiaonuo.biz.modular.user.enums.BizUserStatusEnum; @@ -157,6 +159,11 @@ public class BizGroupServiceImpl extends ServiceImpl i return TreeUtil.build(treeNodeList, "0"); } + @Override + public List orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) { + return bizOrgService.treeLazy(bizOrgTreeLazyParam); + } + @Override public Page userSelector(BizGroupSelectorUserParam bizGroupSelectorUserParam) { QueryWrapper queryWrapper = new QueryWrapper().checkSqlInjection(); diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java index aced3f9d..e5bf85f0 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java @@ -75,8 +75,8 @@ public class BizOrgController { */ @ApiOperationSupport(order = 2) @Operation(summary = "获取机构树(懒加载)") - @SaCheckPermission("/biz/org/treeLazy") - @GetMapping("/biz/org/treeLazy") + @SaCheckPermission("/biz/org/tree") + @GetMapping("/biz/org/tree") public CommonResult> treeLazy(BizOrgTreeLazyParam bizOrgTreeLazyParam) { return CommonResult.data(bizOrgService.treeLazy(bizOrgTreeLazyParam)); } @@ -162,20 +162,6 @@ public class BizOrgController { /* ====机构部分所需要用到的选择器==== */ - /** - * 获取机构树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 8) - @Operation(summary = "获取机构树选择器") - @SaCheckPermission("/biz/org/orgTreeSelector") - @GetMapping("/biz/org/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(bizOrgService.orgTreeSelector()); - } - /** * 获取机构树选择器(懒加载) * @@ -184,8 +170,8 @@ public class BizOrgController { */ @ApiOperationSupport(order = 8) @Operation(summary = "获取机构树选择器(懒加载)") - @SaCheckPermission("/biz/org/orgTreeLazySelector") - @GetMapping("/biz/org/orgTreeLazySelector") + @SaCheckPermission("/biz/org/orgTreeSelector") + @GetMapping("/biz/org/orgTreeSelector") public CommonResult> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) { return CommonResult.data(bizOrgService.treeLazy(bizOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java index 22e44a49..80c934d1 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java @@ -38,22 +38,6 @@ public interface BizOrgService extends IService { */ Page page(BizOrgPageParam bizOrgPageParam); - /** - * 获取机构树 - * - * @author xuyuxiang - * @date 2022/4/24 20:08 - */ - List> tree(); - - /** - * 获取机构树(带搜索关键字) - * - * @author xuyuxiang - * @date 2022/4/24 20:08 - */ - List> tree(String searchKey); - /** * 获取机构树(懒加载) * diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java index eda2a351..d25a4b85 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java @@ -137,54 +137,45 @@ public class BizOrgServiceImpl extends ServiceImpl impleme if (loginUserDataScope != null && ObjectUtil.isEmpty(loginUserDataScope)) { return CollectionUtil.newArrayList(); } - - // loginUserDataScope == null 时为 SCOPE_ALL,不做数据范围过滤 - if (loginUserDataScope == null) { - // SCOPE_ALL:直接查询当前父级下的所有子机构 - List childList = this.list(new LambdaQueryWrapper() - .eq(BizOrg::getParentId, parentId) - .orderByAsc(BizOrg::getSortCode)); - if (ObjectUtil.isEmpty(childList)) { + // loginUserDataScope == null 时为 SCOPE_ALL,不做数据范围过滤;否则取可见机构ID集合 + Set visibleOrgIds = null; + if (loginUserDataScope != null) { + visibleOrgIds = this.getVisibleOrgIds(loginUserDataScope); + if (ObjectUtil.isEmpty(visibleOrgIds)) { return CollectionUtil.newArrayList(); } - List childIds = childList.stream().map(BizOrg::getId).collect(Collectors.toList()); - Set hasChildrenParentIds = this.list(new LambdaQueryWrapper() - .select(BizOrg::getParentId) - .in(BizOrg::getParentId, childIds)) - .stream().map(BizOrg::getParentId).collect(Collectors.toSet()); - return childList.stream().map(bizOrg -> { - JSONObject jsonObject = JSONUtil.parseObj(bizOrg); - jsonObject.set("isLeaf", !hasChildrenParentIds.contains(bizOrg.getId())); - return jsonObject; - }).collect(Collectors.toList()); } + return this.fetchChildrenWithLeafFlag(parentId, visibleOrgIds); + } - // 从版本化缓存获取可见机构ID集合(命中时无需加载全量数据) - Set visibleOrgIds = this.getVisibleOrgIds(loginUserDataScope); - if (ObjectUtil.isEmpty(visibleOrgIds)) { - return CollectionUtil.newArrayList(); + /** + * 查询指定父节点下的直接子机构列表,并为每个子机构设置 isLeaf 标志。 + * visibleOrgIds 为 null 时表示 SCOPE_ALL,不做数据范围过滤(与 SysOrg 行为一致); + * 非 null 时仅返回集合内可见的子机构,且 isLeaf 判断也限制在可见范围内。 + */ + private List fetchChildrenWithLeafFlag(String parentId, Set visibleOrgIds) { + // 查询当前父级下的(可见)子机构 + LambdaQueryWrapper childQuery = new LambdaQueryWrapper() + .eq(BizOrg::getParentId, parentId) + .orderByAsc(BizOrg::getSortCode) + .orderByAsc(BizOrg::getId); + if (visibleOrgIds != null) { + CommonSqlUtil.safeIn(childQuery, BizOrg::getId, visibleOrgIds); } - - // SQL直查:获取当前父级下的可见子机构(替代内存过滤2万条记录) - LambdaQueryWrapper childQueryWrapper = new LambdaQueryWrapper() - .eq(BizOrg::getParentId, parentId); - CommonSqlUtil.safeIn(childQueryWrapper, BizOrg::getId, visibleOrgIds); - childQueryWrapper.orderByAsc(BizOrg::getSortCode); - List childList = this.list(childQueryWrapper); - + List childList = this.list(childQuery); if (ObjectUtil.isEmpty(childList)) { return CollectionUtil.newArrayList(); } - - // SQL批量查询:判断哪些子机构还有可见的下级(单次SQL替代N次遍历) + // 批量判断哪些子机构还有(可见的)下级 List childIds = childList.stream().map(BizOrg::getId).collect(Collectors.toList()); - LambdaQueryWrapper hasChildrenWrapper = new LambdaQueryWrapper() + LambdaQueryWrapper hasChildrenQuery = new LambdaQueryWrapper() .select(BizOrg::getParentId) .in(BizOrg::getParentId, childIds); - CommonSqlUtil.safeIn(hasChildrenWrapper, BizOrg::getId, visibleOrgIds); - Set hasChildrenParentIds = this.list(hasChildrenWrapper) + if (visibleOrgIds != null) { + CommonSqlUtil.safeIn(hasChildrenQuery, BizOrg::getId, visibleOrgIds); + } + Set hasChildrenParentIds = this.list(hasChildrenQuery) .stream().map(BizOrg::getParentId).collect(Collectors.toSet()); - return childList.stream().map(bizOrg -> { JSONObject jsonObject = JSONUtil.parseObj(bizOrg); jsonObject.set("isLeaf", !hasChildrenParentIds.contains(bizOrg.getId())); @@ -192,18 +183,6 @@ public class BizOrgServiceImpl extends ServiceImpl impleme }).collect(Collectors.toList()); } - /** - * 获取机构树(懒加载) - * - * @author xuyuxiang - * @date 2022/4/24 20:08 - */ - public List treeLazy(String parentId) { - BizOrgTreeLazyParam bizOrgTreeLazyParam = new BizOrgTreeLazyParam(); - bizOrgTreeLazyParam.setParentId(parentId); - return this.treeLazy(bizOrgTreeLazyParam); - } - /** * 全量搜索模式,返回嵌套树结构的JSONObject列表 * searchKey为空字符串时返回全量树,非空时按关键字过滤 diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/position/controller/BizPositionController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/position/controller/BizPositionController.java index 002f2eaa..935f73a4 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/position/controller/BizPositionController.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/position/controller/BizPositionController.java @@ -131,20 +131,6 @@ public class BizPositionController { /* ====岗位部分所需要用到的选择器==== */ - /** - * 获取组织树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 6) - @Operation(summary = "获取组织树选择器") - @SaCheckPermission("/biz/position/orgTreeSelector") - @GetMapping("/biz/position/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(bizPositionService.orgTreeSelector()); - } - /** * 获取组织树选择器(懒加载) * @@ -153,8 +139,8 @@ public class BizPositionController { */ @ApiOperationSupport(order = 6) @Operation(summary = "获取组织树选择器(懒加载)") - @SaCheckPermission("/biz/position/orgTreeLazySelector") - @GetMapping("/biz/position/orgTreeLazySelector") + @SaCheckPermission("/biz/position/orgTreeSelector") + @GetMapping("/biz/position/orgTreeSelector") public CommonResult> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) { return CommonResult.data(bizPositionService.orgTreeLazySelector(bizOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java index d735900b..477c9dc3 100644 --- a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java @@ -246,20 +246,6 @@ public class BizUserController { /* ====人员部分所需要用到的选择器==== */ - /** - * 获取机构树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 13) - @Operation(summary = "获取机构树选择器") - @SaCheckPermission("/biz/user/orgTreeSelector") - @GetMapping("/biz/user/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(bizUserService.orgTreeSelector()); - } - /** * 获取机构树选择器(懒加载) * @@ -268,8 +254,8 @@ public class BizUserController { */ @ApiOperationSupport(order = 13) @Operation(summary = "获取机构树选择器(懒加载)") - @SaCheckPermission("/biz/user/orgTreeLazySelector") - @GetMapping("/biz/user/orgTreeLazySelector") + @SaCheckPermission("/biz/user/orgTreeSelector") + @GetMapping("/biz/user/orgTreeSelector") public CommonResult> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) { return CommonResult.data(bizUserService.orgTreeLazySelector(bizOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/controller/SysGroupController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/controller/SysGroupController.java index 0291948d..e571d006 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/controller/SysGroupController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/controller/SysGroupController.java @@ -12,7 +12,7 @@ */ package vip.xiaonuo.sys.modular.group.controller; -import cn.hutool.core.lang.tree.Tree; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -29,6 +29,7 @@ import vip.xiaonuo.common.pojo.CommonResult; import vip.xiaonuo.sys.modular.group.entity.SysGroup; import vip.xiaonuo.sys.modular.group.param.*; import vip.xiaonuo.sys.modular.group.service.SysGroupService; +import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam; import vip.xiaonuo.sys.modular.user.entity.SysUser; import java.util.List; @@ -134,8 +135,8 @@ public class SysGroupController { */ @Operation(summary = "获取组织树选择器") @GetMapping("/sys/group/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(sysGroupService.orgTreeSelector()); + public CommonResult> orgTreeSelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { + return CommonResult.data(sysGroupService.orgTreeLazySelector(sysOrgTreeLazyParam)); } /** diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/SysGroupService.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/SysGroupService.java index bc3a2a1b..30fead87 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/SysGroupService.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/SysGroupService.java @@ -13,10 +13,12 @@ package vip.xiaonuo.sys.modular.group.service; import cn.hutool.core.lang.tree.Tree; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import vip.xiaonuo.sys.modular.group.entity.SysGroup; import vip.xiaonuo.sys.modular.group.param.*; +import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam; import vip.xiaonuo.sys.modular.user.entity.SysUser; import java.util.List; @@ -93,6 +95,14 @@ public interface SysGroupService extends IService { */ List> orgTreeSelector(); + /** + * 获取组织树选择器(懒加载) + * + * @author xuyuxiang + * @date 2022/4/24 20:00 + */ + List orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam); + /** * 获取用户选择器 * diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/impl/SysGroupServiceImpl.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/impl/SysGroupServiceImpl.java index 8f3dbe3b..fe5cb766 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/impl/SysGroupServiceImpl.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/group/service/impl/SysGroupServiceImpl.java @@ -19,6 +19,7 @@ import cn.hutool.core.lang.tree.TreeNode; import cn.hutool.core.lang.tree.TreeUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -37,6 +38,7 @@ import vip.xiaonuo.sys.modular.group.mapper.SysGroupMapper; import vip.xiaonuo.sys.modular.group.param.*; import vip.xiaonuo.sys.modular.group.service.SysGroupService; import vip.xiaonuo.sys.modular.org.entity.SysOrg; +import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam; import vip.xiaonuo.sys.modular.org.service.SysOrgService; import vip.xiaonuo.sys.modular.position.param.SysPositionIdParam; import vip.xiaonuo.sys.modular.relation.entity.SysRelation; @@ -144,6 +146,11 @@ public class SysGroupServiceImpl extends ServiceImpl i return TreeUtil.build(treeNodeList, "0"); } + @Override + public List orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { + return List.of(); + } + @Override public Page userSelector(SysGroupSelectorUserParam sysGroupSelectorUserParam) { QueryWrapper queryWrapper = new QueryWrapper().checkSqlInjection(); diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/controller/SysOrgController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/controller/SysOrgController.java index ae2d74ef..2c47e5e6 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/controller/SysOrgController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/controller/SysOrgController.java @@ -73,7 +73,7 @@ public class SysOrgController { */ @ApiOperationSupport(order = 2) @Operation(summary = "获取组织树(懒加载)") - @GetMapping("/sys/org/treeLazy") + @GetMapping("/sys/org/tree") public CommonResult> treeLazy(SysOrgTreeLazyParam sysOrgTreeLazyParam) { return CommonResult.data(sysOrgService.treeLazy(sysOrgTreeLazyParam)); } @@ -154,19 +154,6 @@ public class SysOrgController { /* ====组织部分所需要用到的选择器==== */ - /** - * 获取组织树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 8) - @Operation(summary = "获取组织树选择器") - @GetMapping("/sys/org/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(sysOrgService.orgTreeSelector()); - } - /** * 获取组织树选择器(懒加载) * @@ -175,7 +162,7 @@ public class SysOrgController { */ @ApiOperationSupport(order = 8) @Operation(summary = "获取组织树选择器(懒加载)") - @GetMapping("/sys/org/orgTreeLazySelector") + @GetMapping("/sys/org/orgTreeSelector") public CommonResult> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { return CommonResult.data(sysOrgService.treeLazy(sysOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/service/impl/SysOrgServiceImpl.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/service/impl/SysOrgServiceImpl.java index 9a88f0d6..d9ef5c36 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/service/impl/SysOrgServiceImpl.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/org/service/impl/SysOrgServiceImpl.java @@ -140,18 +140,6 @@ public class SysOrgServiceImpl extends ServiceImpl impleme }).collect(Collectors.toList()); } - /** - * 获取机构树(懒加载) - * - * @author xuyuxiang - * @date 2022/4/21 16:13 - **/ - public List treeLazy(String parentId) { - SysOrgTreeLazyParam sysOrgTreeLazyParam = new SysOrgTreeLazyParam(); - sysOrgTreeLazyParam.setParentId(parentId); - return this.treeLazy(sysOrgTreeLazyParam); - } - /** * 全量搜索模式,返回嵌套树结构的JSONObject列表 * searchKey为空字符串时返回全量树,非空时按关键字过滤 diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/position/controller/SysPositionController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/position/controller/SysPositionController.java index 692b7c3d..96c63bc7 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/position/controller/SysPositionController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/position/controller/SysPositionController.java @@ -125,19 +125,6 @@ public class SysPositionController { /* ====职位部分所需要用到的选择器==== */ - /** - * 获取组织树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 6) - @Operation(summary = "获取组织树选择器") - @GetMapping("/sys/position/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(sysPositionService.orgTreeSelector()); - } - /** * 获取组织树选择器(懒加载) * @@ -146,7 +133,7 @@ public class SysPositionController { */ @ApiOperationSupport(order = 6) @Operation(summary = "获取组织树选择器(懒加载)") - @GetMapping("/sys/position/orgTreeLazySelector") + @GetMapping("/sys/position/orgTreeSelector") public CommonResult> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { return CommonResult.data(sysPositionService.orgTreeLazySelector(sysOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/role/controller/SysRoleController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/role/controller/SysRoleController.java index 3f8c48de..ff93293b 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/role/controller/SysRoleController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/role/controller/SysRoleController.java @@ -240,19 +240,6 @@ public class SysRoleController { /* ====角色部分所需要用到的选择器==== */ - /** - * 获取组织树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 14) - @Operation(summary = "获取组织树选择器") - @GetMapping("/sys/role/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(sysRoleService.orgTreeSelector()); - } - /** * 获取组织树选择器(懒加载) * @@ -261,7 +248,7 @@ public class SysRoleController { */ @ApiOperationSupport(order = 15) @Operation(summary = "获取组织树选择器(懒加载)") - @GetMapping("/sys/role/orgTreeLazySelector") + @GetMapping("/sys/role/orgTreeSelector") public CommonResult> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { return CommonResult.data(sysRoleService.orgTreeLazySelector(sysOrgTreeLazyParam)); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java index 9b8050cc..f43a0fd8 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java @@ -317,19 +317,6 @@ public class SysUserController { /* ====用户部分所需要用到的选择器==== */ - /** - * 获取组织树选择器 - * - * @author xuyuxiang - * @date 2022/4/24 20:00 - */ - @ApiOperationSupport(order = 19) - @Operation(summary = "获取组织树选择器") - @GetMapping("/sys/user/orgTreeSelector") - public CommonResult>> orgTreeSelector() { - return CommonResult.data(sysUserService.orgTreeSelector()); - } - /** * 获取组织树选择器(懒加载) * @@ -338,7 +325,7 @@ public class SysUserController { */ @ApiOperationSupport(order = 19) @Operation(summary = "获取组织树选择器(懒加载)") - @GetMapping("/sys/user/orgTreeLazySelector") + @GetMapping("/sys/user/orgTreeSelector") public CommonResult> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) { return CommonResult.data(sysUserService.orgTreeLazySelector(sysOrgTreeLazyParam)); }