upgrade:升级8.0适配

This commit is contained in:
ruying408
2025-03-29 14:37:20 +08:00
parent 00512d53d8
commit 77749e6c2e
4 changed files with 178 additions and 54 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.core.init;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ObjUtil;
@@ -14,6 +15,7 @@ import com.cool.modules.base.entity.sys.BaseSysMenuEntity;
import com.cool.modules.base.service.sys.BaseSysConfService;
import com.cool.modules.base.service.sys.BaseSysMenuService;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryWrapper;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -204,7 +206,19 @@ public class DBFromJsonInit {
menuEntity.setParentName(parentMenuEntity.getName());
menuEntity.setParentId(parentMenuEntity.getId());
}
baseSysMenuService.add(menuEntity);
QueryWrapper queryWrapper = QueryWrapper.create()
.eq(BaseSysMenuEntity::getName, menuEntity.getName());
if (ObjUtil.isNull(menuEntity.getParentId())) {
queryWrapper.isNull(BaseSysMenuEntity::getParentId);
} else {
queryWrapper.eq(BaseSysMenuEntity::getParentId, menuEntity.getParentId());
}
BaseSysMenuEntity dbBaseSysMenuEntity = baseSysMenuService.getOne(queryWrapper);
if (ObjUtil.isNull(dbBaseSysMenuEntity)) {
baseSysMenuService.add(menuEntity);
} else {
menuEntity = dbBaseSysMenuEntity;
}
// 递归处理子菜单
JSONArray childMenus = jsonObj.getJSONArray("childMenus");
if (childMenus != null) {

View File

@@ -3,6 +3,7 @@ package com.cool.modules.base.service.sys.impl;
import com.cool.core.exception.CoolPreconditions;
import com.cool.modules.base.dto.sys.CodeContentDto;
import com.cool.modules.base.service.sys.BaseCodingService;
import com.google.common.collect.Lists;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -11,11 +12,10 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class BaseCodingServiceImpl implements BaseCodingService {
@@ -69,6 +69,8 @@ public class BaseCodingServiceImpl implements BaseCodingService {
}
// 写入文件
try (FileWriter writer = new FileWriter(filePath.toFile())) {
formattedContent = formattedContent.replace("com.tangzc.mybatisflex.autotable.annotation.Index;",
"org.dromara.autotable.annotation.Index;");
writer.write(formattedContent);
}
list.add(filePath.toString());

View File

@@ -4,7 +4,7 @@
"router": "/sys",
"perms": null,
"type": 0,
"icon": "icon-system",
"icon": "icon-set",
"orderNum": 2,
"viewPath": null,
"keepAlive": true,
@@ -809,55 +809,5 @@
]
}
]
},
{
"name": "扩展管理",
"router": null,
"perms": null,
"type": 0,
"icon": "icon-favor",
"orderNum": 8,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"name": "后端插件",
"router": "/helper/plugins/serve",
"perms": null,
"type": 1,
"icon": "icon-component",
"orderNum": 2,
"viewPath": "modules/helper/views/plugins/serve.vue",
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"name": "权限",
"router": null,
"perms": "plugin:info:install,plugin:info:delete,plugin:info:update,plugin:info:page,plugin:info:info",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
}
]
},
{
"name": "前端插件",
"router": "/helper/plugins/vue",
"perms": null,
"type": 1,
"icon": "icon-vue",
"orderNum": 1,
"viewPath": "modules/helper/views/plugins/vue.vue",
"keepAlive": true,
"isShow": true,
"childMenus": []
}
]
}
]

View File

@@ -0,0 +1,158 @@
[
{
"name": "数据管理",
"router": null,
"perms": null,
"type": 0,
"icon": "icon-data",
"orderNum": 7,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"name": "字典管理",
"router": "/dict/list",
"perms": null,
"type": 1,
"icon": "icon-dict",
"orderNum": 3,
"viewPath": "modules/dict/views/list.vue",
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"name": "字典类型",
"router": null,
"perms": "dict:type:delete,dict:type:update,dict:type:info,dict:type:list,dict:type:page,dict:type:add",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": [
]
}
]
}]
},
{
"name": "扩展管理",
"router": null,
"perms": null,
"type": 0,
"icon": "icon-favor",
"orderNum": 8,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"tenantId": null,
"name": "插件列表",
"router": "/helper/plugins",
"perms": null,
"type": 1,
"icon": "icon-list",
"orderNum": 1,
"viewPath": "modules/helper/views/plugins.vue",
"keepAlive": true,
"isShow": true,
"childMenus": [
{
"tenantId": null,
"name": "删除",
"router": null,
"perms": "plugin:info:delete",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "分页查询",
"router": null,
"perms": "plugin:info:page",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "单个信息",
"router": null,
"perms": "plugin:info:info",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "安装插件",
"router": null,
"perms": "plugin:info:install",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "修改",
"router": null,
"perms": "plugin:info:update",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "列表查询",
"router": null,
"perms": "plugin:info:list",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
},
{
"tenantId": null,
"name": "新增",
"router": null,
"perms": "plugin:info:add",
"type": 2,
"icon": null,
"orderNum": 0,
"viewPath": null,
"keepAlive": true,
"isShow": true,
"childMenus": []
}
]
}
]
}
]