From 064d703f2907b931085c5f565269289e9fa81012 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 17 十月 2025 15:53:55 +0800
Subject: [PATCH] 最新版本541200007
---
admin/src/components/common/EmptyTip.vue | 19 +
admin/src/views/system/permission.vue | 229 ++++++++++----
server/system_service/src/main/java/com/doumee/core/utils/Constants.java | 19 +
server/system_service/src/main/java/com/doumee/api/cloud/SystemPermissionCloudController.java | 47 +-
server/system_service/src/main/java/com/doumee/dao/system/vo/SystemPermissionListVO.java | 18 +
server/system_service/src/main/java/com/doumee/api/system/SystemPermissionController.java | 60 +--
server/system_service/src/main/java/com/doumee/service/system/impl/SystemPermissionServiceImpl.java | 98 ++++++
server/system_service/src/main/java/com/doumee/dao/system/dto/DeleteSystemPermissionDTO.java | 20 +
admin/src/components/system/permission/OperaPermissionWindow.vue | 48 +++
server/system_service/src/main/resources/mappers/SystemPermissionMapper.xml | 10
server/system_service/src/main/java/com/doumee/service/system/SystemPermissionService.java | 76 +++-
admin/src/api/system/permission.js | 30 -
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java | 7
server/system_service/src/main/java/com/doumee/dao/system/model/SystemPermission.java | 5
admin/src/components/system/permission/OperaModuleWindow.vue | 135 +++++++++
admin/src/components/common/FormItemTip.vue | 25 +
server/system_service/src/main/java/com/doumee/dao/system/SystemPermissionMapper.java | 19
17 files changed, 658 insertions(+), 207 deletions(-)
diff --git a/admin/src/api/system/permission.js b/admin/src/api/system/permission.js
index cc31a6c..55d2a11 100644
--- a/admin/src/api/system/permission.js
+++ b/admin/src/api/system/permission.js
@@ -1,13 +1,8 @@
import request from '@/utils/request'
-// 鏌ヨ
-export function fetchList (data) {
- return request.post('/visitsAdmin/cloudService/system/permission/page', data)
-}
-
-// 鏌ヨ鎵�鏈�
-export function fetchAll () {
- return request.get('/visitsAdmin/cloudService/system/permission/all')
+// 鏌ヨ鏍戝垪琛�
+export function fetchTree () {
+ return request.get('/visitsAdmin/cloudService/system/permission/tree')
}
// 鏂板缓
@@ -24,16 +19,19 @@
})
}
+// 鎵归噺淇敼
+export function updateByIdInBatch (data) {
+ return request.post('/visitsAdmin/cloudService/system/permission/updateByIdInBatch', data, {
+ trim: true
+ })
+}
+
// 鍒犻櫎
-export function deleteById (id) {
- return request.get(`/visitsAdmin/cloudService/system/permission/delete/${id}`)
+export function deletePermission (data) {
+ return request.post('/visitsAdmin/cloudService/system/permission/delete', data)
}
// 鎵归噺鍒犻櫎
-export function deleteByIdInBatch (ids) {
- return request.get('/visitsAdmin/cloudService/system/permission/delete/batch', {
- params: {
- ids
- }
- })
+export function deletePermissionInBatch (data) {
+ return request.post('/visitsAdmin/cloudService/system/permission/delete/batch', data)
}
diff --git a/admin/src/components/common/EmptyTip.vue b/admin/src/components/common/EmptyTip.vue
new file mode 100644
index 0000000..19fa0ce
--- /dev/null
+++ b/admin/src/components/common/EmptyTip.vue
@@ -0,0 +1,19 @@
+<template>
+ <div class="empty-tip">
+ <slot>鏆傛棤鏁版嵁</slot>
+ </div>
+</template>
+
+<script>
+export default {
+ name: 'EmptyTip'
+}
+</script>
+
+<style scoped lang="scss">
+.empty-tip {
+ text-align: center;
+ padding: 40px 0;
+ color: #999;
+}
+</style>
diff --git a/admin/src/components/common/FormItemTip.vue b/admin/src/components/common/FormItemTip.vue
new file mode 100644
index 0000000..5669d17
--- /dev/null
+++ b/admin/src/components/common/FormItemTip.vue
@@ -0,0 +1,25 @@
+<template>
+ <p class="form-item-tip"><i class="el-icon-warning-outline"></i><slot></slot></p>
+</template>
+
+<script>
+export default {
+ name: 'FormItemTip'
+}
+</script>
+
+<style scoped lang="scss">
+.form-item-tip {
+ line-height: 20px;
+ font-size: 13px;
+ color: #999;
+ margin: 6px 0 0 0;
+ .el-icon-warning-outline {
+ font-size: 16px;
+ margin-right: 5px;
+ position: relative;
+ top: 2px;
+ color: orange;
+ }
+}
+</style>
diff --git a/admin/src/components/system/permission/OperaModuleWindow.vue b/admin/src/components/system/permission/OperaModuleWindow.vue
new file mode 100644
index 0000000..c94977d
--- /dev/null
+++ b/admin/src/components/system/permission/OperaModuleWindow.vue
@@ -0,0 +1,135 @@
+<template>
+ <GlobalWindow
+ :title="title"
+ :visible.sync="visible"
+ :confirm-working="isWorking"
+ @confirm="confirm"
+ >
+ <el-form :model="form" ref="form" :rules="rules">
+ <el-form-item label="鏉冮檺妯″潡" prop="module">
+ <el-input v-model="form.module" placeholder="璇疯緭鍏ユ潈闄愭ā鍧�" v-trim maxlength="500"/>
+ <FormItemTip>澶氫釜妯″潡鍙互閫氳繃"/"鍒嗗壊锛屼緥濡�"鏃ュ織绠$悊/鎿嶄綔鏃ュ織"</FormItemTip>
+ </el-form-item>
+ </el-form>
+ </GlobalWindow>
+</template>
+
+<script>
+import BaseOpera from '@/components/base/BaseOpera'
+import GlobalWindow from '@/components/common/GlobalWindow'
+import FormItemTip from '@/components/common/FormItemTip'
+import { updateByIdInBatch } from '@/api/system/permission'
+
+export default {
+ name: 'OperaModuleWindow',
+ extends: BaseOpera,
+ components: { FormItemTip, GlobalWindow },
+ data () {
+ return {
+ // 琛屾暟鎹�
+ row: null,
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ module: ''
+ },
+ // 楠岃瘉瑙勫垯
+ rules: {
+ module: [
+ { validator: this.__checkModule, trigger: 'blur' }
+ ]
+ }
+ }
+ },
+ methods: {
+ /**
+ * 鎵撳紑绐楀彛
+ *
+ * @param title 鏍囬
+ * @param target 琛屽璞★紙浠呯紪杈戦渶璇ュ弬鏁帮級
+ */
+ open (title, target) {
+ this.title = title
+ this.row = target
+ this.visible = true
+ // 缂栬緫
+ this.$nextTick(() => {
+ this.form.module = target.name
+ })
+ },
+ /**
+ * 纭
+ */
+ confirm () {
+ this.$refs.form.validate(valid => {
+ if (!valid) {
+ return
+ }
+ const pool = []
+ this.__fillPool(pool, this.row.children, this.form.module)
+ this.isWorking = true
+ updateByIdInBatch(pool)
+ .then(() => {
+ this.visible = false
+ this.$emit('success')
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking = false
+ })
+ })
+ },
+ /**
+ * 濉厖鏉冮檺姹狅紝灏嗘墍鏈夋潈闄愮殑妯″潡鍓嶇紑璋冩暣涓烘柊鏉冮檺妯″潡鍚庝涪鍏ool涓�
+ *
+ * @param pool 鏉冮檺姹�
+ * @param list 鏉冮檺鍒楄〃
+ * @param newModule 鏂版潈闄愭ā鍧�
+ */
+ __fillPool (pool, list, newModule) {
+ if (list == null) {
+ return
+ }
+ for (const child of list) {
+ if (child.type !== 'module') {
+ const modulePaths = child.module.split('/')
+ modulePaths[this.row.level] = newModule
+ child.module = modulePaths.join('/')
+ pool.push(child)
+ continue
+ }
+ this.__fillPool(pool, child.children, newModule)
+ }
+ },
+ /**
+ * 楠岃瘉妯″潡
+ *
+ * @param rule 瑙勫垯
+ * @param value 鍊�
+ * @param callback 鍥炶皟
+ * @returns {*}
+ * @private
+ */
+ __checkModule (rule, value, callback) {
+ if (value == null || value === '') {
+ return callback()
+ }
+ // 涓嶅厑璁稿寘鍚┖鏍�
+ if (value.indexOf(' ') !== -1) {
+ return callback(new Error('涓嶅厑璁稿寘鍚┖鏍�'))
+ }
+ // 涓嶅厑璁镐娇鐢�"/"寮�澶存垨缁撳熬
+ if (value.startsWith('/') || value.endsWith('/')) {
+ return callback(new Error('璇峰嬁浣跨敤"/"寮�澶存垨缁撳熬'))
+ }
+ return callback()
+ }
+ },
+ created () {
+ this.config({
+ api: '/system/permission'
+ })
+ }
+}
+</script>
diff --git a/admin/src/components/system/permission/OperaPermissionWindow.vue b/admin/src/components/system/permission/OperaPermissionWindow.vue
index 12054f2..27968cf 100644
--- a/admin/src/components/system/permission/OperaPermissionWindow.vue
+++ b/admin/src/components/system/permission/OperaPermissionWindow.vue
@@ -12,6 +12,10 @@
<el-form-item label="鏉冮檺鍚嶇О" prop="name" required>
<el-input v-model="form.name" placeholder="璇疯緭鍏ユ潈闄愬悕绉�" v-trim maxlength="50"/>
</el-form-item>
+ <el-form-item label="鏉冮檺妯″潡" prop="module">
+ <el-input v-model="form.module" placeholder="璇疯緭鍏ユ潈闄愭ā鍧�" v-trim maxlength="500"/>
+ <FormItemTip>澶氫釜妯″潡鍙互閫氳繃"/"鍒嗗壊锛屼緥濡�"鏃ュ織绠$悊/鎿嶄綔鏃ュ織"</FormItemTip>
+ </el-form-item>
<el-form-item label="鏉冮檺澶囨敞" prop="remark">
<el-input v-model="form.remark" placeholder="璇疯緭鍏ユ潈闄愬娉�" type="textarea" :rows="3" v-trim maxlength="500"/>
</el-form-item>
@@ -22,10 +26,11 @@
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
+import FormItemTip from '@/components/common/FormItemTip'
export default {
name: 'OperaPermissionWindow',
extends: BaseOpera,
- components: { GlobalWindow },
+ components: { FormItemTip, GlobalWindow },
data () {
return {
// 鍘熸潈闄愮爜
@@ -35,6 +40,7 @@
id: null,
code: '',
name: '',
+ module: '',
remark: ''
},
// 楠岃瘉瑙勫垯
@@ -44,19 +50,31 @@
],
name: [
{ required: true, message: '璇疯緭鍏ユ潈闄愬悕绉�' }
+ ],
+ module: [
+ { validator: this.__checkModule, trigger: 'blur' }
]
}
}
},
methods: {
+ /**
+ * 鎵撳紑绐楀彛
+ *
+ * @param title 绐楀彛鏍囬
+ * @param target 琛屽璞★紙浠呯紪杈戦渶璇ュ弬鏁帮級
+ */
open (title, target) {
this.title = title
this.visible = true
// 鏂板缓
- if (target == null) {
+ if (target == null || target.type === 'module') {
this.$nextTick(() => {
this.$refs.form.resetFields()
this.form[this.configData['field.id']] = null
+ if (target.type === 'module') {
+ this.form.module = target.modulePath
+ }
})
return
}
@@ -68,6 +86,9 @@
}
})
},
+ /**
+ * 纭
+ */
confirm () {
if (this.form.id == null || this.form.id === '') {
this.__confirmCreate()
@@ -85,6 +106,29 @@
.then(() => {
this.__confirmEdit()
})
+ },
+ /**
+ * 楠岃瘉妯″潡
+ *
+ * @param rule 瑙勫垯
+ * @param value 鍊�
+ * @param callback 鍥炶皟
+ * @returns {*}
+ * @private
+ */
+ __checkModule (rule, value, callback) {
+ if (value == null || value === '') {
+ return callback()
+ }
+ // 涓嶅厑璁稿寘鍚┖鏍�
+ if (value.indexOf(' ') !== -1) {
+ return callback(new Error('涓嶅厑璁稿寘鍚┖鏍�'))
+ }
+ // 涓嶅厑璁镐娇鐢�"/"寮�澶存垨缁撳熬
+ if (value.startsWith('/') || value.endsWith('/')) {
+ return callback(new Error('璇峰嬁浣跨敤"/"寮�澶存垨缁撳熬'))
+ }
+ return callback()
}
},
created () {
diff --git a/admin/src/views/system/permission.vue b/admin/src/views/system/permission.vue
index d4e56f4..ec2fe7d 100644
--- a/admin/src/views/system/permission.vue
+++ b/admin/src/views/system/permission.vue
@@ -1,97 +1,190 @@
<template>
<TableLayout :permissions="['system:permission:query']">
- <!-- 鎼滅储琛ㄥ崟 -->
- <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
- <el-form-item label="鏉冮檺缂栫爜" prop="code">
- <el-input v-model="searchForm.code" v-trim placeholder="璇疯緭鍏ユ潈闄愮紪鐮�" @keypress.enter.native="search"/>
- </el-form-item>
- <el-form-item label="鏉冮檺鍚嶇О" prop="name">
- <el-input v-model="searchForm.name" v-trim placeholder="璇疯緭鍏ユ潈闄愬悕绉�" @keypress.enter.native="search"/>
- </el-form-item>
- <section>
- <el-button type="primary" @click="search">鎼滅储</el-button>
- <el-button @click="reset">閲嶇疆</el-button>
- </section>
- </el-form>
<!-- 琛ㄦ牸鍜屽垎椤� -->
<template v-slot:table-wrap>
- <ul class="toolbar" v-permissions="['system:permission:create', 'system:permission:delete']">
- <li><el-button type="primary" @click="$refs.operaPermissionWindow.open('鏂板缓绯荤粺鏉冮檺')" icon="el-icon-plus" v-permissions="['system:permission:create']">鏂板缓</el-button></li>
- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['system:permission:delete']">鍒犻櫎</el-button></li>
- </ul>
- <el-table
- :height="tableHeightNew"
- v-loading="isWorking.search"
- :data="tableData.list"
- :default-sort = "{prop: 'createTime', order: 'descending'}"
- stripe
- @selection-change="handleSelectionChange"
- @sort-change="handleSortChange"
- >
- <el-table-column type="selection" fixed="left" width="55"></el-table-column>
- <el-table-column prop="code" label="鏉冮檺缂栫爜" fixed="left" min-width="240px"></el-table-column>
- <el-table-column prop="name" label="鏉冮檺鍚嶇О" fixed="left" min-width="200px"></el-table-column>
- <el-table-column prop="remark" label="鏉冮檺澶囨敞" min-width="200px"></el-table-column>
- <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="100px">
- <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template>
- </el-table-column>
- <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="140px" sortable="custom" sort-by="perm.CREATE_TIME"></el-table-column>
- <el-table-column prop="updateUser" label="鏇存柊浜�" min-width="100px">
- <template slot-scope="{row}">{{row.updateUserInfo == null ? '' : row.updateUserInfo.username}}</template>
- </el-table-column>
- <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="140px"></el-table-column>
- <el-table-column
- v-if="containPermissions(['system:permission:update', 'system:permission:delete'])"
- label="鎿嶄綔"
- min-width="130"
- fixed="right"
- >
- <template slot-scope="{row}">
- <el-button v-if="!row.fixed" type="text" @click="$refs.operaPermissionWindow.open('缂栬緫绯荤粺鏉冮檺', row)" icon="el-icon-edit" v-permissions="['system:permission:update']">缂栬緫</el-button>
- <el-button v-if="!row.fixed" type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['system:permission:delete']">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- @size-change="handleSizeChange"
- @current-change="handlePageChange"
- :pagination="tableData.pagination"
- ></pagination>
+ <el-tabs v-model="currentTab" v-loading="isWorking.search">
+ <el-tab-pane :name="'module'+module.id" :label="module.name" v-for="module in tableData.list" :key="module.id">
+ <ul class="toolbar" v-permissions="['system:permission:create', 'system:permission:delete']">
+ <li><el-button type="primary" @click="$refs.operaPermissionWindow.open('鏂板缓绯荤粺鏉冮檺', module)" icon="el-icon-plus" v-permissions="['system:permission:create']">鏂板缓</el-button></li>
+ <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['system:permission:delete']">鍒犻櫎</el-button></li>
+ </ul>
+ <el-table
+ :height="tableHeightNew"
+ :data="module.children"
+ :ref="'module' + module.id"
+ row-key="id"
+ stripe
+ default-expand-all
+ @selection-change="handleSelectionChange"
+ >
+ <el-table-column type="selection" fixed="left" width="55"></el-table-column>
+ <el-table-column prop="name" label="鏉冮檺鍚嶇О" fixed="left" min-width="200px"></el-table-column>
+ <el-table-column prop="code" label="鏉冮檺缂栫爜" min-width="200px"></el-table-column>
+ <el-table-column prop="remark" label="鏉冮檺澶囨敞" min-width="120px"></el-table-column>
+ <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="100px">
+ <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template>
+ </el-table-column>
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="140px"></el-table-column>
+ <el-table-column prop="updateUser" label="鏇存柊浜�" min-width="100px">
+ <template slot-scope="{row}">{{row.updateUserInfo == null ? '' : row.updateUserInfo.username}}</template>
+ </el-table-column>
+ <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="140px"></el-table-column>
+ <el-table-column
+ v-if="containPermissions(['system:permission:update', 'system:permission:delete'])"
+ label="鎿嶄綔"
+ min-width="150"
+ fixed="right"
+ >
+ <template slot-scope="{row}">
+ <!-- 妯″潡缂栬緫&鍒犻櫎 -->
+ <template v-if="row.type === 'module'">
+ <el-button type="text" @click="$refs.operaModuleWindow.open('缂栬緫妯″潡', row)" icon="el-icon-edit" v-permissions="['system:permission:update']">缂栬緫</el-button>
+ <el-button type="text" @click="$refs.operaPermissionWindow.open('鏂板缓绯荤粺鏉冮檺', row)" icon="el-icon-edit" v-permissions="['system:permission:update']">娣诲姞鏉冮檺</el-button>
+ <el-button v-if="!row.fixed" type="text" @click="deletePermission(row)" icon="el-icon-delete" v-permissions="['system:permission:delete']">鍒犻櫎</el-button>
+ </template>
+ <!-- 鏉冮檺缂栬緫&鍒犻櫎 -->
+ <template v-else>
+ <el-button v-if="!row.fixed" type="text" @click="$refs.operaPermissionWindow.open('缂栬緫绯荤粺鏉冮檺', row)" icon="el-icon-edit" v-permissions="['system:permission:update']">缂栬緫</el-button>
+ <el-button v-if="!row.fixed" type="text" @click="deletePermission(row)" icon="el-icon-delete" v-permissions="['system:permission:delete']">鍒犻櫎</el-button>
+ </template>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
</template>
<!-- 鏂板缓/淇敼 -->
- <OperaPermissionWindow ref="operaPermissionWindow" @success="handlePageChange"/>
+ <OperaPermissionWindow ref="operaPermissionWindow" @success="search"/>
+ <!-- 缂栬緫鏉冮檺妯″潡 -->
+ <OperaModuleWindow ref="operaModuleWindow" @success="handlePageChange"/>
</TableLayout>
</template>
<script>
-import Pagination from '@/components/common/Pagination'
import TableLayout from '@/layouts/TableLayout'
import BaseTable from '@/components/base/BaseTable'
import OperaPermissionWindow from '@/components/system/permission/OperaPermissionWindow'
+import OperaModuleWindow from '@/components/system/permission/OperaModuleWindow'
+
export default {
name: 'SystemPermission',
extends: BaseTable,
- components: { OperaPermissionWindow, TableLayout, Pagination },
+ components: { OperaModuleWindow, OperaPermissionWindow, TableLayout },
data () {
return {
- // 鎼滅储
- searchForm: {
- code: '',
- name: '',
- remark: ''
+ // 褰撳墠閫変腑鐨勬ā鍧�
+ currentTab: null
+ }
+ },
+ methods: {
+ /**
+ * 瑕嗙洊椤电爜鍙樻洿澶勭悊
+ */
+ handlePageChange () {
+ this.isWorking.search = true
+ this.api.fetchTree()
+ .then(data => {
+ this.tableData.list = data
+ this.currentTab = 'module' + this.tableData.list[0].id
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking.search = false
+ })
+ },
+ /**
+ * 瑕嗙洊鍒犻櫎澶勭悊
+ */
+ deletePermission (row, childConfirm = true) {
+ this.__checkApi()
+ let message = `纭鍒犻櫎${this.module}銆�${row[this.configData['field.main']]}銆戝悧?`
+ if (childConfirm && row.children != null && row.children.length > 0) {
+ message = `纭鍒犻櫎${this.module}銆�${row[this.configData['field.main']]}銆戝強鍏跺瓙${this.module}鍚�?`
}
+ this.$dialog.deleteConfirm(message)
+ .then(() => {
+ this.isWorking.delete = true
+ this.api.deletePermission({
+ id: row.type === 'module' ? null : row.id, // 妯″潡涓嶄紶ID
+ modulePrefix: row.type === 'module' ? row.modulePath : null // 鏉冮檺涓嶄紶妯″潡
+ })
+ .then(() => {
+ this.$tip.apiSuccess('鍒犻櫎鎴愬姛')
+ this.__afterDelete()
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking.delete = false
+ })
+ })
+ .catch(() => {})
+ },
+ /**
+ * 瑕嗙洊鎵归噺鍒犻櫎澶勭悊
+ */
+ deleteByIdInBatch (childConfirm = true) {
+ this.__checkApi()
+ if (this.tableData.selectedRows.length === 0) {
+ this.$tip.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�')
+ return
+ }
+ let message = `纭鍒犻櫎宸查�変腑鐨� ${this.tableData.selectedRows.length} 鏉�${this.module}璁板綍鍚�?`
+ if (childConfirm) {
+ const containChildrenRows = []
+ for (const row of this.tableData.selectedRows) {
+ if (row.children != null && row.children.length > 0) {
+ containChildrenRows.push(row[this.configData['field.main']])
+ }
+ }
+ if (containChildrenRows.length > 0) {
+ message = `鏈灏嗗垹闄�${this.module}銆�${containChildrenRows.join('銆�')}銆戝強鍏跺瓙${this.module}璁板綍锛岀‘璁ゅ垹闄ゅ悧锛焋
+ }
+ }
+ this.$dialog.deleteConfirm(message)
+ .then(() => {
+ this.isWorking.delete = true
+ this.api.deletePermissionInBatch(this.tableData.selectedRows.map(row => {
+ return {
+ id: row.type === 'module' ? null : row.id, // 妯″潡涓嶄紶ID
+ modulePrefix: row.type === 'module' ? row.modulePath : null // 鏉冮檺涓嶄紶妯″潡
+ }
+ }))
+ .then(() => {
+ this.$tip.apiSuccess('鍒犻櫎鎴愬姛')
+ this.__afterDelete(this.tableData.selectedRows.length)
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.isWorking.delete = false
+ })
+ })
+ .catch(() => {})
}
},
created () {
this.config({
module: '鏉冮檺',
- api: '/system/permission',
- sorts: [{
- property: 'perm.CREATE_TIME',
- direction: 'DESC'
- }]
+ api: '/system/permission'
})
this.search()
}
}
</script>
+
+<style scoped lang="scss">
+/deep/ .table-content {
+ margin-top: 0;
+ .table-wrap {
+ padding-bottom: 16px;
+ }
+}
+/deep/ .el-tabs__nav-prev, /deep/ .el-tabs__nav-next {
+ line-height: 40px;
+}
+</style>
diff --git a/server/system_service/src/main/java/com/doumee/api/cloud/SystemPermissionCloudController.java b/server/system_service/src/main/java/com/doumee/api/cloud/SystemPermissionCloudController.java
index 3cd2f9a..653bf76 100644
--- a/server/system_service/src/main/java/com/doumee/api/cloud/SystemPermissionCloudController.java
+++ b/server/system_service/src/main/java/com/doumee/api/cloud/SystemPermissionCloudController.java
@@ -5,6 +5,7 @@
import com.doumee.config.annotation.CloudRequiredPermission;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.constants.OperaType;
+import com.doumee.dao.system.dto.DeleteSystemPermissionDTO;
import com.doumee.service.business.third.model.ApiResponse;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -30,7 +31,7 @@
@RestController
@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/system/permission")
public class SystemPermissionCloudController extends BaseController {
-
+
@Autowired
private SystemPermissionService systemPermissionService;
@@ -41,54 +42,46 @@
@ApiOperation("鏂板缓")
@PostMapping("/create")
@CloudRequiredPermission("system:permission:create")
- public ApiResponse create(@RequestHeader(Constants.HEADER_USER_TOKEN) String token, @Validated(OperaType.Create.class) @RequestBody SystemPermission systemPermission) {
- systemPermission.setCreateUser(this.getLoginUser(token).getId());
+ public ApiResponse create(@Validated(Constants.OperaType.Create.class) @RequestBody SystemPermission systemPermission) {
return ApiResponse.success(systemPermissionBiz.create(systemPermission));
}
@ApiOperation("鍒犻櫎")
- @GetMapping("/delete/{id}")
+ @PostMapping("/delete")
@CloudRequiredPermission("system:permission:delete")
- public ApiResponse deleteById(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@PathVariable Integer id) {
- systemPermissionBiz.deleteById(id);
+ public ApiResponse deleteById(@RequestBody DeleteSystemPermissionDTO dto) {
+ systemPermissionService.delete(dto);
return ApiResponse.success(null);
}
@ApiOperation("鎵归噺鍒犻櫎")
- @GetMapping("/delete/batch")
+ @PostMapping("/delete/batch")
@CloudRequiredPermission("system:permission:delete")
- public ApiResponse deleteByIdInBatch(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestParam String ids) {
- String [] idArray = ids.split(",");
- List<Integer> idList = new ArrayList<>();
- for (String id : idArray) {
- idList.add(Integer.valueOf(id));
- }
- systemPermissionBiz.deleteByIdInBatch(idList);
+ public ApiResponse deleteByIdInBatch(@RequestBody List<DeleteSystemPermissionDTO> dtos) {
+ systemPermissionService.deleteInBatch(dtos);
return ApiResponse.success(null);
}
@ApiOperation("淇敼")
@PostMapping("/updateById")
@CloudRequiredPermission("system:permission:update")
- public ApiResponse updateById(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@Validated(OperaType.Update.class) @RequestBody SystemPermission systemPermission) {
- systemPermission.setUpdateUser(this.getLoginUser(token).getId());
+ public ApiResponse updateById(@Validated(Constants.OperaType.Update.class) @RequestBody SystemPermission systemPermission) {
systemPermissionBiz.updateById(systemPermission);
return ApiResponse.success(null);
}
- @ApiOperation("鍒嗛〉鏌ヨ")
- @PostMapping("/page")
- @CloudRequiredPermission("system:permission:query")
- public ApiResponse<PageData<SystemPermissionListVO>> findPage (@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody PageWrap<QuerySystemPermissionDTO> pageWrap) {
- return ApiResponse.success(systemPermissionService.findPage(pageWrap));
+ @ApiOperation("鎵归噺淇敼")
+ @PostMapping("/updateByIdInBatch")
+ @CloudRequiredPermission("system:permission:update")
+ public ApiResponse updateById(@RequestBody List<SystemPermission> permissions) {
+ systemPermissionService.updateByIdInBatch(permissions);
+ return ApiResponse.success(null);
}
- @ApiOperation("鏌ヨ鎵�鏈�")
- @GetMapping("/all")
+ @ApiOperation("鏌ヨ鏉冮檺鏍戝垪琛�")
+ @GetMapping("/tree")
@CloudRequiredPermission("system:permission:query")
- public ApiResponse<List<SystemPermission>> findAll (@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
- SystemPermission systemPermission = new SystemPermission();
- systemPermission.setDeleted(Boolean.FALSE);
- return ApiResponse.success(systemPermissionService.findList(systemPermission));
+ public ApiResponse<List<SystemPermissionListVO>> findAll () {
+ return ApiResponse.success(systemPermissionService.findTree());
}
}
diff --git a/server/system_service/src/main/java/com/doumee/api/system/SystemPermissionController.java b/server/system_service/src/main/java/com/doumee/api/system/SystemPermissionController.java
index 1d1fde3..22048ee 100644
--- a/server/system_service/src/main/java/com/doumee/api/system/SystemPermissionController.java
+++ b/server/system_service/src/main/java/com/doumee/api/system/SystemPermissionController.java
@@ -3,12 +3,8 @@
import com.doumee.api.BaseController;
import com.doumee.biz.system.SystemPermissionBiz;
import com.doumee.core.annotation.pr.PreventRepeat;
-import com.doumee.core.constants.OperaType;
-import com.doumee.service.business.third.model.ApiResponse;
-import com.doumee.service.business.third.model.PageData;
-import com.doumee.service.business.third.model.PageWrap;
import com.doumee.core.utils.Constants;
-import com.doumee.dao.system.dto.QuerySystemPermissionDTO;
+import com.doumee.dao.system.dto.DeleteSystemPermissionDTO;
import com.doumee.dao.system.model.SystemPermission;
import com.doumee.dao.system.vo.SystemPermissionListVO;
import com.doumee.service.system.SystemPermissionService;
@@ -17,14 +13,14 @@
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
-
-import java.util.ArrayList;
-import java.util.List;
import org.springframework.web.bind.annotation.*;
+import java.util.List;
+import com.doumee.service.business.third.model.ApiResponse;
+
/**
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ * @author dm
+ * @since 2025/03/31 16:44
*/
@Api(tags = "绯荤粺鏉冮檺")
@RestController
@@ -41,54 +37,46 @@
@ApiOperation("鏂板缓")
@PostMapping("/create")
@RequiresPermissions("system:permission:create")
- public ApiResponse create(@Validated(OperaType.Create.class)@RequestBody SystemPermission systemPermission, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
- systemPermission.setCreateUser(this.getLoginUser(token).getId());
+ public ApiResponse create(@Validated(Constants.OperaType.Create.class) @RequestBody SystemPermission systemPermission) {
return ApiResponse.success(systemPermissionBiz.create(systemPermission));
}
@ApiOperation("鍒犻櫎")
- @GetMapping("/delete/{id}")
+ @PostMapping("/delete")
@RequiresPermissions("system:permission:delete")
- public ApiResponse deleteById(@PathVariable Integer id) {
- systemPermissionBiz.deleteById(id);
+ public ApiResponse deleteById(@RequestBody DeleteSystemPermissionDTO dto) {
+ systemPermissionService.delete(dto);
return ApiResponse.success(null);
}
@ApiOperation("鎵归噺鍒犻櫎")
- @GetMapping("/delete/batch")
+ @PostMapping("/delete/batch")
@RequiresPermissions("system:permission:delete")
- public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
- String [] idArray = ids.split(",");
- List<Integer> idList = new ArrayList<>();
- for (String id : idArray) {
- idList.add(Integer.valueOf(id));
- }
- systemPermissionBiz.deleteByIdInBatch(idList);
+ public ApiResponse deleteByIdInBatch(@RequestBody List<DeleteSystemPermissionDTO> dtos) {
+ systemPermissionService.deleteInBatch(dtos);
return ApiResponse.success(null);
}
@ApiOperation("淇敼")
@PostMapping("/updateById")
@RequiresPermissions("system:permission:update")
- public ApiResponse updateById(@Validated(OperaType.Update.class) @RequestBody SystemPermission systemPermission, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
- systemPermission.setUpdateUser(this.getLoginUser(token).getId());
+ public ApiResponse updateById(@Validated(Constants.OperaType.Update.class) @RequestBody SystemPermission systemPermission) {
systemPermissionBiz.updateById(systemPermission);
return ApiResponse.success(null);
}
- @ApiOperation("鍒嗛〉鏌ヨ")
- @PostMapping("/page")
- @RequiresPermissions("system:permission:query")
- public ApiResponse<PageData<SystemPermissionListVO>> findPage (@RequestBody PageWrap<QuerySystemPermissionDTO> pageWrap) {
- return ApiResponse.success(systemPermissionService.findPage(pageWrap));
+ @ApiOperation("鎵归噺淇敼")
+ @PostMapping("/updateByIdInBatch")
+ @RequiresPermissions("system:permission:update")
+ public ApiResponse updateById(@RequestBody List<SystemPermission> permissions) {
+ systemPermissionService.updateByIdInBatch(permissions);
+ return ApiResponse.success(null);
}
- @ApiOperation("鏌ヨ鎵�鏈�")
- @GetMapping("/all")
+ @ApiOperation("鏌ヨ鏉冮檺鏍戝垪琛�")
+ @GetMapping("/tree")
@RequiresPermissions("system:permission:query")
- public ApiResponse<List<SystemPermission>> findAll () {
- SystemPermission systemPermission = new SystemPermission();
- systemPermission.setDeleted(Boolean.FALSE);
- return ApiResponse.success(systemPermissionService.findList(systemPermission));
+ public ApiResponse<List<SystemPermissionListVO>> findAll () {
+ return ApiResponse.success(systemPermissionService.findTree());
}
}
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index 2d14098..32e6c6a 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -54,7 +54,26 @@
public static final String SIGN_IN_QRCODE ="SIGN_IN_QRCODE" ;
public static final String SIGN_IN_ATTENTION ="SIGN_IN_ATTENTION" ;
public static final String SIGN_IN_QRCODE_PREFIX ="SIGN_IN_QRCODE_PREFIX" ;
+ /**
+ * 鎿嶄綔绫诲瀷锛岀敤浜庡仛鎺ュ彛楠岃瘉鍒嗙粍
+ */
+ public interface OperaType {
+ /**
+ * 鍒涘缓
+ */
+ interface Create {}
+
+ /**
+ * 淇敼
+ */
+ interface Update {}
+
+ /**
+ * 淇敼鐘舵��
+ */
+ interface UpdateStatus {}
+ }
public static final String WEATHER_CONFIG ="WEATHER_CONFIG" ;
public static final String REQUEST_URL ="REQUEST_URL" ;
diff --git a/server/system_service/src/main/java/com/doumee/dao/system/SystemPermissionMapper.java b/server/system_service/src/main/java/com/doumee/dao/system/SystemPermissionMapper.java
index ef2d648..66e9203 100644
--- a/server/system_service/src/main/java/com/doumee/dao/system/SystemPermissionMapper.java
+++ b/server/system_service/src/main/java/com/doumee/dao/system/SystemPermissionMapper.java
@@ -12,23 +12,24 @@
/**
* 鏍规嵁鐢ㄦ埛ID鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param userId 鐢ㄦ埛ID
+ * @return List<SystemPermission>
*/
List<SystemPermission> selectByUserId(Integer userId);
/**
* 鏍规嵁瑙掕壊ID鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param roleId 瑙掕壊ID
+ * @return List<SystemPermission>
*/
List<SystemPermission> selectByRoleId(Integer roleId);
/**
- * 鏌ヨ鍒楄〃
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ * 鏌ヨ鏉冮檺绠$悊鍒楄〃
+ *
+ * @return List<SystemPermissionListVO>
*/
- List<SystemPermissionListVO> selectManageList(@Param("dto") QuerySystemPermissionDTO dto, @Param("orderByClause") String orderByClause);
-
+ List<SystemPermissionListVO> selectManageList();
}
diff --git a/server/system_service/src/main/java/com/doumee/dao/system/dto/DeleteSystemPermissionDTO.java b/server/system_service/src/main/java/com/doumee/dao/system/dto/DeleteSystemPermissionDTO.java
new file mode 100644
index 0000000..512c323
--- /dev/null
+++ b/server/system_service/src/main/java/com/doumee/dao/system/dto/DeleteSystemPermissionDTO.java
@@ -0,0 +1,20 @@
+package com.doumee.dao.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author dm
+ * @since 2025/03/31 16:44
+ */
+@Data
+@ApiModel("鍒犻櫎鏉冮檺鍙傛暟")
+public class DeleteSystemPermissionDTO {
+
+ @ApiModelProperty("鏉冮檺ID")
+ private Integer id;
+
+ @ApiModelProperty("妯″潡鍓嶇紑")
+ private String modulePrefix;
+}
diff --git a/server/system_service/src/main/java/com/doumee/dao/system/model/SystemPermission.java b/server/system_service/src/main/java/com/doumee/dao/system/model/SystemPermission.java
index f51df6b..411337a 100644
--- a/server/system_service/src/main/java/com/doumee/dao/system/model/SystemPermission.java
+++ b/server/system_service/src/main/java/com/doumee/dao/system/model/SystemPermission.java
@@ -56,4 +56,9 @@
@ApiModelProperty(value = "鏄惁宸插垹闄�", hidden = true)
private Boolean deleted;
+ @ApiModelProperty(value = "妯″潡")
+ private String module;
+
+
+
}
diff --git a/server/system_service/src/main/java/com/doumee/dao/system/vo/SystemPermissionListVO.java b/server/system_service/src/main/java/com/doumee/dao/system/vo/SystemPermissionListVO.java
index 4ee5260..bde8ccb 100644
--- a/server/system_service/src/main/java/com/doumee/dao/system/vo/SystemPermissionListVO.java
+++ b/server/system_service/src/main/java/com/doumee/dao/system/vo/SystemPermissionListVO.java
@@ -6,14 +6,28 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.util.List;
+
/**
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ * @author dm
+ * @since 2025/03/31 16:44
*/
@Data
@ApiModel("绯荤粺鏉冮檺鍒楄〃瑙嗗浘瀵硅薄")
public class SystemPermissionListVO extends SystemPermission {
+ @ApiModelProperty(value = "绫诲瀷锛宮odule妯″潡锛宲ermission鏉冮檺")
+ private String type;
+
+ @ApiModelProperty(value = "妯″潡璺緞")
+ private String modulePath;
+
+ @ApiModelProperty(value = "灞傜骇")
+ private Integer level;
+
+ @ApiModelProperty(value = "瀛愭潈闄愬垪琛�")
+ private List<SystemPermissionListVO> children;
+
@ApiModelProperty(value = "鍒涘缓浜轰俊鎭�")
private SystemUser createUserInfo;
diff --git a/server/system_service/src/main/java/com/doumee/service/system/SystemPermissionService.java b/server/system_service/src/main/java/com/doumee/service/system/SystemPermissionService.java
index 1c7fcba..8c5f07a 100644
--- a/server/system_service/src/main/java/com/doumee/service/system/SystemPermissionService.java
+++ b/server/system_service/src/main/java/com/doumee/service/system/SystemPermissionService.java
@@ -1,5 +1,6 @@
package com.doumee.service.system;
+import com.doumee.dao.system.dto.DeleteSystemPermissionDTO;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
import com.doumee.dao.system.dto.QuerySystemPermissionDTO;
@@ -17,85 +18,106 @@
/**
* 鍒涘缓
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermission 瀹炰綋
+ * @return Integer
*/
Integer create(SystemPermission systemPermission);
/**
* 涓婚敭鍒犻櫎
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param id 涓婚敭
*/
void deleteById(Integer id);
/**
* 鎵归噺涓婚敭鍒犻櫎
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param ids 涓婚敭鍒楄〃
*/
void deleteByIdInBatch(List<Integer> ids);
/**
+ * 鍒犻櫎
+ *
+ * @param dto 鍒犻櫎鏉′欢
+ */
+ void delete (DeleteSystemPermissionDTO dto);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ *
+ * @param dtos 鍒犻櫎鏉′欢鍒楄〃
+ */
+ void deleteInBatch(List<DeleteSystemPermissionDTO> dtos);
+
+ /**
* 涓婚敭鏇存柊
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermission 瀹炰綋
*/
void updateById(SystemPermission systemPermission);
/**
* 鎵归噺涓婚敭鏇存柊
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermissions 瀹炰綋鍒楄〃
*/
void updateByIdInBatch(List<SystemPermission> systemPermissions);
/**
* 涓婚敭鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param id 涓婚敭
+ * @return SystemPermission
*/
SystemPermission findById(Integer id);
/**
* 鏍规嵁鐢ㄦ埛ID鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param userId 鐢ㄦ埛ID
+ * @return List<SystemPermission>
*/
List<SystemPermission> findByUserId(Integer userId);
/**
* 鏍规嵁瑙掕壊ID鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param roleId 瑙掕壊ID
+ * @return List<SystemPermission>
*/
List<SystemPermission> findByRoleId(Integer roleId);
/**
* 鏉′欢鏌ヨ鍗曟潯璁板綍
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermission 鏌ヨ鏉′欢
+ * @return SystemPermission
*/
SystemPermission findOne(SystemPermission systemPermission);
/**
* 鏉′欢鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermission 鏌ヨ鏉′欢
+ * @return List<SystemPermission>
*/
List<SystemPermission> findList(SystemPermission systemPermission);
-
+
/**
- * 鍒嗛〉鏌ヨ
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ * 鏌ヨ绠$悊鍒楄〃
+ *
+ * @return List<SystemPermissionListVO>
*/
- PageData<SystemPermissionListVO> findPage(PageWrap<QuerySystemPermissionDTO> pageWrap);
+ List<SystemPermissionListVO> findTree();
/**
* 鏉′欢缁熻
- * @author Eva.Caesar Liu
- * @date 2023/03/21 14:49
+ *
+ * @param systemPermission 缁熻鏉′欢
+ * @return long
*/
long count(SystemPermission systemPermission);
}
diff --git a/server/system_service/src/main/java/com/doumee/service/system/impl/SystemPermissionServiceImpl.java b/server/system_service/src/main/java/com/doumee/service/system/impl/SystemPermissionServiceImpl.java
index 05215d4..64a8286 100644
--- a/server/system_service/src/main/java/com/doumee/service/system/impl/SystemPermissionServiceImpl.java
+++ b/server/system_service/src/main/java/com/doumee/service/system/impl/SystemPermissionServiceImpl.java
@@ -1,5 +1,7 @@
package com.doumee.service.system.impl;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.doumee.dao.system.dto.DeleteSystemPermissionDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.doumee.service.business.third.model.PageData;
@@ -11,11 +13,14 @@
import com.doumee.service.system.SystemPermissionService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -25,6 +30,7 @@
*/
@Service
public class SystemPermissionServiceImpl implements SystemPermissionService {
+
@Autowired
private SystemPermissionMapper systemPermissionMapper;
@@ -53,6 +59,26 @@
}
@Override
+ public void delete(DeleteSystemPermissionDTO dto) {
+ UpdateWrapper<SystemPermission> deleteWrapper = new UpdateWrapper<>();
+ deleteWrapper.lambda()
+ .set(SystemPermission::getDeleted, Boolean.TRUE)
+ .eq(dto.getId() != null, SystemPermission::getId, dto.getId())
+ .likeLeft(dto.getModulePrefix() != null, SystemPermission::getModule, dto.getModulePrefix());
+ systemPermissionMapper.update(null, deleteWrapper);
+ }
+
+ @Override
+ public void deleteInBatch(List<DeleteSystemPermissionDTO> dtos) {
+ if (CollectionUtils.isEmpty(dtos)) {
+ return;
+ }
+ for (DeleteSystemPermissionDTO dto : dtos) {
+ this.delete(dto);
+ }
+ }
+
+ @Override
public void updateById(SystemPermission systemPermission) {
systemPermissionMapper.updateById(systemPermission);
}
@@ -61,7 +87,7 @@
@Transactional
public void updateByIdInBatch(List<SystemPermission> systemPermissions) {
if (CollectionUtils.isEmpty(systemPermissions)) return;
- for (SystemPermission systemPermission: systemPermissions) {
+ for (SystemPermission systemPermission : systemPermissions) {
this.updateById(systemPermission);
}
}
@@ -83,7 +109,8 @@
@Override
public SystemPermission findOne(SystemPermission systemPermission) {
- Wrapper<SystemPermission> wrapper = new QueryWrapper<>(systemPermission);
+ QueryWrapper<SystemPermission> wrapper = new QueryWrapper<>(systemPermission);
+ wrapper.lambda().last("limit 1");
return systemPermissionMapper.selectOne(wrapper);
}
@@ -94,9 +121,46 @@
}
@Override
- public PageData<SystemPermissionListVO> findPage(PageWrap<QuerySystemPermissionDTO> pageWrap) {
- PageHelper.startPage(pageWrap.getPage(), pageWrap.getCapacity());
- return PageData.from(new PageInfo<>(systemPermissionMapper.selectManageList(pageWrap.getModel(), pageWrap.getOrderByClause())));
+ public List<SystemPermissionListVO> findTree() {
+ List<SystemPermissionListVO> permissionList = systemPermissionMapper.selectManageList();
+ List<SystemPermissionListVO> tree = new ArrayList<>();
+ for (SystemPermissionListVO permission : permissionList) {
+ // 娌℃湁妯″潡鐨勬潈闄愰粯璁ゅ綊灞炰负"鍏跺畠"妯″潡
+ if (StringUtils.isBlank(permission.getModule())) {
+ permission.setModule("鍏跺畠");
+ }
+ // 鍒嗚В妯″潡
+ String[] modulePaths = permission.getModule().split("/");
+ SystemPermissionListVO target = null;
+ SystemPermissionListVO parent = null;
+ List<String> paths = new ArrayList<>();
+ for (String path : modulePaths) {
+ paths.add(path);
+ // 鏌ユ壘妯″潡
+ target = this.getTargetNode(tree, paths);
+ // 濡傛灉妯″潡涓嶅瓨鍦紝鍒欐坊鍔犱竴涓瓙妯″潡
+ if (target == null) {
+ target = new SystemPermissionListVO();
+ target.setId(Integer.valueOf(RandomStringUtils.randomNumeric(6)) * -1);
+ target.setLevel(paths.size() - 1);
+ target.setType("module");
+ target.setName(path);
+ target.setModulePath(StringUtils.join(paths, "/"));
+ target.setChildren(new ArrayList<>());
+ if (parent != null) {
+ parent.getChildren().add(target);
+ } else {
+ tree.add(target);
+ }
+ }
+ parent = target;
+ }
+ // 灏嗘潈闄愭坊鍔犺繘妯″潡涓�
+ if (target != null) {
+ target.getChildren().add(permission);
+ }
+ }
+ return tree;
}
@Override
@@ -104,4 +168,28 @@
Wrapper<SystemPermission> wrapper = new QueryWrapper<>(systemPermission);
return systemPermissionMapper.selectCount(wrapper);
}
+
+ /**
+ * 鏌ユ壘鐩爣鑺傜偣
+ * @param tree 鑺傜偣鏍�
+ * @param paths 妯″潡璺緞
+ * @return
+ */
+ private SystemPermissionListVO getTargetNode(List<SystemPermissionListVO> tree, List<String> paths) {
+ List<SystemPermissionListVO> list = tree;
+ List<SystemPermissionListVO> nodeStack = new ArrayList<>();
+ for (String path : paths) {
+ if (list == null) {
+ break;
+ }
+ for (SystemPermissionListVO permission : list) {
+ if (path.equals(permission.getName()) && "module".equals(permission.getType())) {
+ nodeStack.add(permission);
+ list = permission.getChildren();
+ break;
+ }
+ }
+ }
+ return nodeStack.size() == paths.size() ? nodeStack.get(nodeStack.size() - 1) : null;
+ }
}
diff --git a/server/system_service/src/main/resources/mappers/SystemPermissionMapper.xml b/server/system_service/src/main/resources/mappers/SystemPermissionMapper.xml
index 9568ef5..91c5feb 100644
--- a/server/system_service/src/main/resources/mappers/SystemPermissionMapper.xml
+++ b/server/system_service/src/main/resources/mappers/SystemPermissionMapper.xml
@@ -16,7 +16,7 @@
</resultMap>
<select id="selectManageList" resultMap="SystemPermissionListVO">
SELECT
- perm.`ID`, perm.`CODE`, perm.`NAME`, perm.`REMARK`, perm.`FIXED`, perm.`CREATE_TIME`, perm.`UPDATE_TIME`, perm.`CREATE_USER`, perm.`UPDATE_USER`, perm.`DELETED`,
+ perm.`ID`, perm.`CODE`, perm.`NAME`, perm.`MODULE`, perm.`REMARK`, perm.`FIXED`, perm.`CREATE_TIME`, perm.`UPDATE_TIME`, perm.`CREATE_USER`, perm.`UPDATE_USER`, perm.`DELETED`,
create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME,
update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME
FROM SYSTEM_PERMISSION perm
@@ -24,14 +24,8 @@
LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = perm.UPDATE_USER
<where>
perm.DELETED = 0
- <if test="dto.code != null">
- AND perm.CODE LIKE CONCAT('%', #{dto.code}, '%')
- </if>
- <if test="dto.name != null">
- AND perm.`NAME` LIKE CONCAT('%', #{dto.name}, '%')
- </if>
</where>
- ${orderByClause}
+ ORDER BY perm.CREATE_TIME ASC, perm.ID ASC
</select>
<!-- 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 -->
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
index 437120d..4a7fca1 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
@@ -76,7 +76,6 @@
jkSketchMapper.insert(jkSketch);
return jkSketch.getId();
}
-
@Override
public void deleteById(Integer id) {
jkSketchMapper.deleteById(id);
@@ -87,7 +86,6 @@
UpdateWrapper<JkSketch> deleteWrapper = new UpdateWrapper<>(jkSketch);
jkSketchMapper.delete(deleteWrapper);
}
-
@Override
@PostConstruct
@@ -492,7 +490,6 @@
.set(JkSketch::getStatus,Constants.THREE)
.set(JkSketch::getPlanLineEndDate,new Date()));
}
-
}
@Override
@Async
@@ -550,7 +547,6 @@
for (int j = 0; j < customerListParam.size(); j++) {
distanceMatrix1[i+1][j+1] =disList.get(j+1).getDistance() ;
}
-
}
//鏋勯�犱紭鍖栨暟鎹ā鍨�
dataModel.initDataInfo(vehicleNumber1,demands1,vehicleCapacities1,distanceMatrix1);
@@ -574,7 +570,6 @@
}
line.setDistance(so.getDistance());
}
-
}catch (Exception e){
e.printStackTrace();
success =false;
@@ -595,9 +590,7 @@
.set(JkSketch::getStatus,success?Constants.TWO:Constants.THREE)
.set(JkSketch::getPlanLineEndDate,new Date()));
}
-
}
-
private List<JkSketchCustomer> initSketchCustomerListParam(List<JkSketchCustomer> customerList, List<JkSketchCustomer> customerList1) {
for(JkSketchCustomer param : customerList){
for(JkSketchCustomer model : customerList1){
--
Gitblit v1.9.3