mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-02-21 02:12:50 +08:00
修复代码生成权限标识出现“/”问题,代码生成添加 直接生成到某某菜单下
This commit is contained in:
parent
10985aabb2
commit
4400acd4e1
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ae425d18ae6f44c9adc25028eb891d15",
|
||||
"id" : "8254da8907904c418ecc988750601446",
|
||||
"script" : null,
|
||||
"groupId" : "7bdcc43555b9419caba2ee722e1aa2d3",
|
||||
"name" : "保存",
|
||||
"createTime" : 1648780777664,
|
||||
"createTime" : 1649260172005,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "33639781fde24f32902b486bd0edd6ca",
|
||||
"id" : "566a8662385a42d381214b971873e98c",
|
||||
"script" : null,
|
||||
"groupId" : "7bdcc43555b9419caba2ee722e1aa2d3",
|
||||
"name" : "列表",
|
||||
"createTime" : 1648780777658,
|
||||
"createTime" : 1649260172000,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "5019707e422245b89e0b2bf00f9a2ec8",
|
||||
"id" : "dbd7523d57fd4958acd9be7e5c66cc9a",
|
||||
"script" : null,
|
||||
"groupId" : "7bdcc43555b9419caba2ee722e1aa2d3",
|
||||
"name" : "删除",
|
||||
"createTime" : 1648780777671,
|
||||
"createTime" : 1649260172011,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ad14a4bc8cf54fc792125a59bc2d34ad",
|
||||
"id" : "25ba2ad6bbb14aa0992a1ca2c75140f0",
|
||||
"script" : null,
|
||||
"groupId" : "7bdcc43555b9419caba2ee722e1aa2d3",
|
||||
"name" : "详情",
|
||||
"createTime" : 1648780777677,
|
||||
"createTime" : 1649260172025,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "执行生成",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1648780783577,
|
||||
"updateTime" : 1649260158450,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -220,8 +220,31 @@ import org.ssssssss.magicapi.core.model.ApiInfo
|
||||
import org.ssssssss.magicapi.core.model.Group
|
||||
import org.ssssssss.magicapi.core.service.MagicResourceService
|
||||
import log
|
||||
import org.ssssssss.magicapi.modules.db.cache.SqlCache;
|
||||
import '@get:/system/menu/cache/delete' as cacheDelete;
|
||||
|
||||
info = info::json
|
||||
var permissionPrefix = (info.modulePath + info.businessPath).replace(/^\//,'').replace(/\/\//, '/').replace('/', ':')
|
||||
|
||||
if(!db.selectValue("""select id from sys_menu where url = #{info.modulePath + info.businessPath} and is_del = 0""")){
|
||||
var menuId = uuid()
|
||||
var sort = db.selectInt("""select max(sort) + 10 from sys_menu where pid = #{info.pid} and is_del = 0""") || 10
|
||||
db.update("""
|
||||
insert into sys_menu(id, pid,name,url,component_name,sort,is_show)
|
||||
values(#{menuId}, #{info.pid}, #{info.businessName},#{info.modulePath + info.businessPath},#{permissionPrefix.replace(':','-') + '-list'},#{sort},1)
|
||||
""")
|
||||
db.update("""
|
||||
insert into sys_menu(id, pid, name, permission, sort, keep_alive) values(#{uuid()}, #{menuId}, '查看', #{permissionPrefix + ':view'}, 10, 0)
|
||||
""")
|
||||
db.update("""
|
||||
insert into sys_menu(id, pid, name, permission, sort, keep_alive) values(#{uuid()}, #{menuId}, '保存', #{permissionPrefix + ':save'}, 20, 0)
|
||||
""")
|
||||
db.update("""
|
||||
insert into sys_menu(id, pid, name, permission, sort, keep_alive) values(#{uuid()}, #{menuId}, '删除', #{permissionPrefix + ':delete'}, 30, 0)
|
||||
""")
|
||||
SqlCache.delete('permissions:1')
|
||||
cacheDelete();
|
||||
}
|
||||
|
||||
var getGroup = (type) => {
|
||||
var moduleGroup = MagicResourceService.tree(type).children.filter(it => {
|
||||
@ -308,7 +331,7 @@ if(commonField.contains('is_del')){
|
||||
wheres += ` and is_del = 0\n`
|
||||
}
|
||||
wheres = wheres.substring(0,wheres.length() - 1)
|
||||
var permissionPrefix = (info.modulePath + info.businessPath).replace(/^\//,'').replace(/\/\//, '/').replace('/', ':')
|
||||
|
||||
ApiInfo listApi = new ApiInfo()
|
||||
listApi.setName("列表")
|
||||
listApi.setPath("/list")
|
||||
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "1952f25c81084e24b55b11385767dc38",
|
||||
"name" : "登录",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1648818736705,
|
||||
"updateTime" : 1649256868582,
|
||||
"lock" : "0",
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "64c78249fafd4ddcbcac12d734645b67",
|
||||
"id" : "b35e1c055131478d8ebabb7a64eb721d",
|
||||
"script" : null,
|
||||
"groupId" : "eb5dbed949de4f50ba4bf59f483252a5",
|
||||
"name" : "列表",
|
||||
"createTime" : 1648780777685,
|
||||
"createTime" : 1649260172031,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
|
@ -1,5 +1,5 @@
|
||||
function gen(groupPath, data){
|
||||
var permissionPrefix = groupPath.replace(/^\//,'').replace(/\/\//, '/').replace('/', ':')
|
||||
var permissionPrefix = groupPath.replace(/^\//,'').replace(/\/\//, '/').replaceAll('/', ':')
|
||||
var html = `<template>
|
||||
<mb-list ref="magicList" v-bind="listOptions" />
|
||||
<mb-dialog ref="formDialog" :title="magicFormTitle" @confirm-click="magicForm.save($event)" width="50%">
|
||||
|
@ -69,7 +69,12 @@
|
||||
<el-input v-model="genInfo.info.businessPath"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上级菜单" prop="pid">
|
||||
<treeselect v-model="genInfo.info.pid" :options="menuTree" :key="genInfo.info.pid" style="position: fixed;z-index:999999;width: 548px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
代码生成
|
||||
@ -93,6 +98,14 @@
|
||||
const dataForm = ref()
|
||||
const tables = ref([])
|
||||
const emit = defineEmits(['reload'])
|
||||
const menuTree = ref()
|
||||
proxy.$get('/system/menu/tree').then(res => {
|
||||
menuTree.value = [{
|
||||
label: '根节点',
|
||||
id: '0',
|
||||
children: proxy.$treeTable.genTree(res.data.list)
|
||||
}]
|
||||
})
|
||||
var validatePath = (rule, value, callback) => {
|
||||
if(!value.startsWith('/')){
|
||||
callback(new Error('请以“/”开头'));
|
||||
@ -119,7 +132,8 @@
|
||||
modulePath: '',
|
||||
businessName: '',
|
||||
businessPath: '',
|
||||
template: 'singleTable'
|
||||
template: 'singleTable',
|
||||
pid: ''
|
||||
},
|
||||
columns: []
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user