diff --git a/README.md b/README.md
index 4aeace5b..42051154 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-
+
@@ -110,7 +110,7 @@ public class DeptController extends BaseController [!TIP]
-> 更多功能和优化正在赶来💦,最新项目计划、进展请进群或关注 [任务清单](https://continew.top/admin/intro/require.html#任务清单) 和 [更新日志](https://continew.top/admin/other/changelog.html)。
+> 更多功能和优化正在赶来💦,最新项目计划、进展请进群或关注 [任务清单](https://continew.top/require.html) 和 [更新日志](https://continew.top/admin/other/changelog.html)。
- 个人中心:支持基础信息修改、密码修改、邮箱绑定、手机号绑定(并提供行为验证码、短信限流等安全处理)、第三方账号绑定/解绑、头像裁剪上传
- 消息中心:提供站内信消息统一查看、标记已读、全部已读、删除等功能
@@ -216,7 +216,7 @@ public class DeptController extends BaseControllerArco Design | 2.56.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 |
| TypeScript | 5.0.4 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 |
| Vite | 5.1.5 | 下一代的前端工具链,为开发提供极速响应。 |
-| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.7.1 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
+| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.7.2 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
| Spring Boot | 3.2.10 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) |
| Undertow | 2.3.13.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 |
| Sa-Token + JWT | 1.39.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 |
diff --git a/continew-module-system/src/main/java/top/continew/admin/auth/service/impl/LoginServiceImpl.java b/continew-module-system/src/main/java/top/continew/admin/auth/service/impl/LoginServiceImpl.java
index 2eaa455c..8438acb5 100644
--- a/continew-module-system/src/main/java/top/continew/admin/auth/service/impl/LoginServiceImpl.java
+++ b/continew-module-system/src/main/java/top/continew/admin/auth/service/impl/LoginServiceImpl.java
@@ -22,6 +22,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
+import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
@@ -61,7 +62,7 @@ import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.util.validate.CheckUtils;
import top.continew.starter.extension.crud.annotation.TreeField;
-import top.continew.starter.extension.crud.util.TreeUtils;
+import top.continew.starter.extension.crud.autoconfigure.CrudProperties;
import top.continew.starter.messaging.websocket.util.WebSocketUtils;
import top.continew.starter.web.util.SpringWebUtils;
@@ -83,6 +84,7 @@ import static top.continew.admin.system.enums.PasswordPolicyEnum.PASSWORD_EXPIRA
public class LoginServiceImpl implements LoginService {
private final ProjectProperties projectProperties;
+ private final CrudProperties crudProperties;
private final PasswordEncoder passwordEncoder;
private final ThreadPoolTaskExecutor threadPoolTaskExecutor;
private final UserService userService;
@@ -178,8 +180,8 @@ public class LoginServiceImpl implements LoginService {
List menuList = menuSet.stream().filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType())).toList();
// 构建路由树
TreeField treeField = MenuResp.class.getDeclaredAnnotation(TreeField.class);
- TreeNodeConfig treeNodeConfig = TreeUtils.genTreeNodeConfig(treeField);
- List> treeList = TreeUtils.build(menuList, treeNodeConfig, (m, tree) -> {
+ TreeNodeConfig treeNodeConfig = crudProperties.getTree().genTreeNodeConfig(treeField);
+ List> treeList = TreeUtil.build(menuList, treeField.rootId(), treeNodeConfig, (m, tree) -> {
tree.setId(m.getId());
tree.setParentId(m.getParentId());
tree.setName(m.getTitle());
diff --git a/continew-module-system/src/main/java/top/continew/admin/system/model/entity/UserDO.java b/continew-module-system/src/main/java/top/continew/admin/system/model/entity/UserDO.java
index 9f5406ee..d5164cf6 100644
--- a/continew-module-system/src/main/java/top/continew/admin/system/model/entity/UserDO.java
+++ b/continew-module-system/src/main/java/top/continew/admin/system/model/entity/UserDO.java
@@ -37,7 +37,7 @@ import java.time.LocalDateTime;
* @since 2022/12/21 20:42
*/
@Data
-@DictField(labelKey = "nickname")
+@DictField(labelKey = "nickname", extraKeys = {"username"})
@TableName("sys_user")
public class UserDO extends BaseDO {
diff --git a/continew-module-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml b/continew-module-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml
index 283b6d11..58919d39 100644
--- a/continew-module-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml
+++ b/continew-module-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml
@@ -2,14 +2,14 @@
- DELETE t1 FROM sys_user_password_history t1
+ DELETE t1 FROM sys_user_password_history AS t1
LEFT JOIN (
SELECT id
FROM sys_user_password_history
WHERE user_id = #{userId}
ORDER BY create_time DESC
LIMIT #{count}
- ) t2 ON t2.id = t1.id
+ ) AS t2 ON t2.id = t1.id
WHERE t2.id IS NULL
\ No newline at end of file
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java
index 3b216704..cc83f0e1 100644
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java
+++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/GenConfigDO.java
@@ -27,6 +27,7 @@ import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import top.continew.admin.common.constant.RegexConstants;
import top.continew.starter.core.constant.StringConstants;
+import top.continew.starter.core.util.StrUtils;
import java.io.Serial;
import java.io.Serializable;
@@ -55,6 +56,13 @@ public class GenConfigDO implements Serializable {
@NotBlank(message = "表名称不能为空")
private String tableName;
+ /**
+ * 描述
+ */
+ @Schema(description = "描述", example = "用户表")
+ @TableField(exist = false)
+ private String comment;
+
/**
* 模块名称
*/
@@ -127,4 +135,15 @@ public class GenConfigDO implements Serializable {
this.tablePrefix = StrUtil.subPre(tableName, underLineIndex + 1);
}
}
+
+ /**
+ * 类名前缀
+ */
+ @Schema(description = "类名前缀", example = "User")
+ public String getClassNamePrefix() {
+ String tableName = this.getTableName();
+ String rawClassName = StrUtils.blankToDefault(this.getTablePrefix(), tableName, prefix -> StrUtil
+ .removePrefix(tableName, prefix));
+ return StrUtil.upperFirst(StrUtil.toCamelCase(rawClassName));
+ }
}
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/InnerGenConfigDO.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/InnerGenConfigDO.java
index 5b866cae..d350dd4d 100644
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/InnerGenConfigDO.java
+++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/entity/InnerGenConfigDO.java
@@ -22,7 +22,6 @@ import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import top.continew.starter.core.constant.StringConstants;
-import top.continew.starter.core.util.StrUtils;
import java.io.Serial;
import java.util.List;
@@ -101,26 +100,6 @@ public class InnerGenConfigDO extends GenConfigDO {
*/
private boolean hasTimeField;
- /**
- * Menu icon
- */
- private String icon = "list";
-
- /**
- * Menu sort order
- */
- private Integer sort = 1;
-
- /**
- * Parent menu ID placeholder
- */
- private String parentMenuId = "#{parentMenuId}";
-
- /**
- * Menu type (2 for menu)
- */
- private Integer menuType = 2;
-
public InnerGenConfigDO() {
}
@@ -138,10 +117,8 @@ public class InnerGenConfigDO extends GenConfigDO {
.lastIndexOfIgnoreCase(realPackageName, StringConstants.DOT) + 1));
}
+ @Override
public String getClassNamePrefix() {
- String tableName = super.getTableName();
- String rawClassName = StrUtils.blankToDefault(super.getTablePrefix(), tableName, prefix -> StrUtil
- .removePrefix(tableName, prefix));
- return StrUtil.upperFirst(StrUtil.toCamelCase(rawClassName));
+ return super.getClassNamePrefix();
}
}
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/TableQuery.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/GenConfigQuery.java
similarity index 89%
rename from continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/TableQuery.java
rename to continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/GenConfigQuery.java
index 214bf3b5..d3f817b6 100644
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/TableQuery.java
+++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/query/GenConfigQuery.java
@@ -23,14 +23,14 @@ import java.io.Serial;
import java.io.Serializable;
/**
- * 表信息查询条件
+ * 生成配置查询条件
*
* @author Charles7c
* @since 2023/4/12 20:21
*/
@Data
-@Schema(description = "表信息查询条件")
-public class TableQuery implements Serializable {
+@Schema(description = "生成配置查询条件")
+public class GenConfigQuery implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/resp/TableResp.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/resp/TableResp.java
deleted file mode 100644
index 81269b22..00000000
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/model/resp/TableResp.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package top.continew.admin.generator.model.resp;
-
-import java.io.Serial;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import lombok.Data;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-
-/**
- * 表信息
- *
- * @author Charles7c
- * @since 2023/4/12 20:21
- */
-@Data
-@Schema(description = "表信息")
-public class TableResp implements Serializable {
-
- @Serial
- private static final long serialVersionUID = 1L;
-
- /**
- * 表名称
- */
- @Schema(description = "表名称", example = "sys_user")
- private String tableName;
-
- /**
- * 描述
- */
- @Schema(description = "描述", example = "用户表")
- private String comment;
-
- /**
- * 存储引擎
- */
- @Schema(description = "存储引擎", example = "InnoDB")
- private String engine;
-
- /**
- * 字符集
- */
- @Schema(description = "字符集", example = "utf8mb4_general_ci")
- private String charset;
-
- /**
- * 创建时间
- */
- @Schema(description = "创建时间", example = "2023-08-08 08:08:08", type = "string")
- private LocalDateTime createTime;
-
- /**
- * 是否已配置
- */
- @Schema(description = "是否已配置", example = "true")
- private Boolean isConfiged;
-
- /**
- * 是否禁用
- */
- @Schema(description = "是否禁用", example = "true")
- private Boolean disabled;
-
- public Boolean getDisabled() {
- return !isConfiged;
- }
-}
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/GeneratorService.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/GeneratorService.java
index b420f8eb..34ee0f4d 100644
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/GeneratorService.java
+++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/GeneratorService.java
@@ -19,10 +19,9 @@ package top.continew.admin.generator.service;
import jakarta.servlet.http.HttpServletResponse;
import top.continew.admin.generator.model.entity.FieldConfigDO;
import top.continew.admin.generator.model.entity.GenConfigDO;
-import top.continew.admin.generator.model.query.TableQuery;
+import top.continew.admin.generator.model.query.GenConfigQuery;
import top.continew.admin.generator.model.req.GenConfigReq;
import top.continew.admin.generator.model.resp.GeneratePreviewResp;
-import top.continew.admin.generator.model.resp.TableResp;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
@@ -38,14 +37,13 @@ import java.util.List;
public interface GeneratorService {
/**
- * 分页查询表信息列表
+ * 分页查询生成配置列表
*
* @param query 查询条件
* @param pageQuery 分页查询条件
- * @return 表信息分页列表
- * @throws SQLException /
+ * @return 分页列表信息
*/
- PageResp pageTable(TableQuery query, PageQuery pageQuery) throws SQLException;
+ PageResp pageGenConfig(GenConfigQuery query, PageQuery pageQuery);
/**
* 查询生成配置信息
diff --git a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java
index 8c0b8cdc..c3b09e03 100644
--- a/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java
+++ b/continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java
@@ -25,6 +25,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.db.meta.Column;
+import cn.hutool.db.meta.Table;
import cn.hutool.system.SystemUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.servlet.http.HttpServletResponse;
@@ -40,10 +41,9 @@ import top.continew.admin.generator.mapper.GenConfigMapper;
import top.continew.admin.generator.model.entity.FieldConfigDO;
import top.continew.admin.generator.model.entity.GenConfigDO;
import top.continew.admin.generator.model.entity.InnerGenConfigDO;
-import top.continew.admin.generator.model.query.TableQuery;
+import top.continew.admin.generator.model.query.GenConfigQuery;
import top.continew.admin.generator.model.req.GenConfigReq;
import top.continew.admin.generator.model.resp.GeneratePreviewResp;
-import top.continew.admin.generator.model.resp.TableResp;
import top.continew.admin.generator.service.GeneratorService;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.constant.StringConstants;
@@ -52,7 +52,6 @@ import top.continew.starter.core.util.TemplateUtils;
import top.continew.starter.core.util.validate.CheckUtils;
import top.continew.starter.data.core.enums.DatabaseType;
import top.continew.starter.data.core.util.MetaUtils;
-import top.continew.starter.data.core.util.Table;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
import top.continew.starter.web.util.FileUploadUtils;
@@ -83,25 +82,30 @@ public class GeneratorServiceImpl implements GeneratorService {
private static final List TIME_PACKAGE_CLASS = Arrays.asList("LocalDate", "LocalTime", "LocalDateTime");
@Override
- public PageResp pageTable(TableQuery query, PageQuery pageQuery) throws SQLException {
+ public PageResp pageGenConfig(GenConfigQuery query, PageQuery pageQuery) {
+ // 查询所有表
List tableList = MetaUtils.getTables(dataSource);
+ tableList.removeIf(table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties
+ .getExcludeTables()));
String tableName = query.getTableName();
if (StrUtil.isNotBlank(tableName)) {
tableList.removeIf(table -> !StrUtil.containsAnyIgnoreCase(table.getTableName(), tableName));
}
- tableList.removeIf(table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties
- .getExcludeTables()));
- CollUtil.sort(tableList, Comparator.comparing(Table::getCreateTime)
- .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime()))
- .reversed());
- List tableRespList = BeanUtil.copyToList(tableList, TableResp.class);
- PageResp pageResp = PageResp.build(pageQuery.getPage(), pageQuery.getSize(), tableRespList);
- pageResp.getList().parallelStream().forEach(tableResp -> {
- long count = genConfigMapper.selectCount(Wrappers.lambdaQuery(GenConfigDO.class)
- .eq(GenConfigDO::getTableName, tableResp.getTableName()));
- tableResp.setIsConfiged(count > 0);
- });
- return pageResp;
+ // 查询生成配置
+ List list = tableList.parallelStream().map(table -> {
+ GenConfigDO genConfig = genConfigMapper.selectById(table.getTableName());
+ if (genConfig == null) {
+ genConfig = new GenConfigDO(table.getTableName());
+ }
+ genConfig.setComment(table.getComment());
+ return genConfig;
+ })
+ .sorted(Comparator.comparing(GenConfigDO::getTableName)
+ .thenComparing(GenConfigDO::getUpdateTime, Comparator.nullsLast(Comparator.naturalOrder()))
+ .thenComparing(GenConfigDO::getCreateTime, Comparator.nullsLast(Comparator.naturalOrder())))
+ .toList();
+ // 分页
+ return PageResp.build(pageQuery.getPage(), pageQuery.getSize(), list);
}
@Override
diff --git a/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Menu.ftl b/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Menu.ftl
new file mode 100644
index 00000000..02030d07
--- /dev/null
+++ b/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/Menu.ftl
@@ -0,0 +1,37 @@
+-- ${businessName}管理菜单
+INSERT INTO `sys_menu`
+(`title`, `parent_id`, `type`, `path`, `name`, `component`, `redirect`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`)
+VALUES
+('${businessName}管理', 1000, 2, '/${apiModuleName}/${apiName}', '${classNamePrefix}', '${apiModuleName}/${apiName}/index', NULL, NULL, b'0', b'0', b'0', NULL, 1, 1, 1, NOW(), NULL, NULL);
+
+SET @parentId = LAST_INSERT_ID();
+
+-- ${businessName}管理按钮
+INSERT INTO `sys_menu`
+(`title`, `parent_id`, `type`, `path`, `name`, `component`, `redirect`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`)
+VALUES
+('列表', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:list', 1, 1, 1, NOW(), NULL, NULL),
+('详情', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:detail', 2, 1, 1, NOW(), NULL, NULL),
+('新增', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:add', 3, 1, 1, NOW(), NULL, NULL),
+('修改', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:update', 4, 1, 1, NOW(), NULL, NULL),
+('删除', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:delete', 5, 1, 1, NOW(), NULL, NULL),
+('导出', @parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:export', 6, 1, 1, NOW(), NULL, NULL);
+
+<#--
+-- PostgreSQL
+-- ${businessName}管理菜单
+INSERT INTO "sys_menu"
+("id", "title", "parent_id", "type", "path", "name", "component", "redirect", "icon", "is_external", "is_cache", "is_hidden", "permission", "sort", "status", "create_user", "create_time", "update_user", "update_time")
+VALUES
+('${businessName}管理', 1000, 2, '/${apiModuleName}/${apiName}', '${classNamePrefix}', '${apiModuleName}/${apiName}/index', NULL, NULL, false, false, false, NULL, 1, 1, 1, NOW(), NULL, NULL) RETURNING id INTO parentId;
+
+-- ${businessName}管理按钮
+INSERT INTO "sys_menu"
+("id", "title", "parent_id", "type", "path", "name", "component", "redirect", "icon", "is_external", "is_cache", "is_hidden", "permission", "sort", "status", "create_user", "create_time", "update_user", "update_time")
+VALUES
+('列表', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:list', 1, 1, 1, NOW(), NULL, NULL),
+('详情', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:detail', 2, 1, 1, NOW(), NULL, NULL),
+('新增', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:add', 3, 1, 1, NOW(), NULL, NULL),
+('修改', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:update', 4, 1, 1, NOW(), NULL, NULL),
+('删除', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:delete', 5, 1, 1, NOW(), NULL, NULL),
+('导出', parentId, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '${apiModuleName}:${apiName}:export', 6, 1, 1, NOW(), NULL, NULL);-->
diff --git a/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/menu.sql.ftl b/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/menu.sql.ftl
deleted file mode 100644
index 7ce13dd9..00000000
--- a/continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/menu.sql.ftl
+++ /dev/null
@@ -1,50 +0,0 @@
--- MYSQL
--- ${businessName}管理菜单
-INSERT INTO sys_menu (
- title, parent_id, type, path, name, component, icon,
- is_external, is_cache, is_hidden, permission, sort, status, create_time, update_time
-) VALUES (
- '${businessName}管理', 1000, ${menuType}, '/${apiModuleName}/${apiName}',
- '${classNamePrefix}', '${apiModuleName}/${apiName}/index', '${icon!"list"}',
- 0, 1, 0, null, ${sort!1}, 1, now(), now()
-);
-
-SET @parentId = LAST_INSERT_ID();
-
--- ${businessName}管理按钮
-INSERT INTO sys_menu (
- title, parent_id, type, permission, sort, status, create_time, update_time
-) VALUES
-('查询${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:list', 1, 1, now(), now()),
-('详情${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:detail', 2, 1, now(), now()),
-('新增${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:add', 3, 1, now(), now()),
-('修改${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:update', 4, 1, now(), now()),
-('删除${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:delete', 5, 1, now(), now()),
-('导出${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:export', 6, 1, now(), now()),
-('导入${businessName}', @parentId, 3, '${apiModuleName}:${apiName}:import', 7, 1, now(), now());
-
-
-<#--
--- PG_SQL
--- ${businessName}管理菜单
-INSERT INTO sys_menu (
- title, parent_id, type, path, name, component, icon,
- is_external, is_cache, is_hidden, permission, sort, status, create_time, update_time
-) VALUES (
- '${businessName}管理', 1000, ${menuType}, '/${apiModuleName}/${apiName}',
- '${classNamePrefix}', '${apiModuleName}/${apiName}/index', '${icon!"list"}',
- 0, 1, 0, null, ${sort!1}, 1, now(), now()
-) RETURNING id INTO parentId;
-
--- ${businessName}管理按钮
-INSERT INTO sys_menu (
- title, parent_id, type, permission, sort, status, create_time, update_time
-) VALUES
-('查询${businessName}', parentId, 3, '${apiModuleName}:${apiName}:list', 1, 1, now(), now()),
-('详情${businessName}', parentId, 3, '${apiModuleName}:${apiName}:detail', 2, 1, now(), now()),
-('新增${businessName}', parentId, 3, '${apiModuleName}:${apiName}:add', 3, 1, now(), now()),
-('修改${businessName}', parentId, 3, '${apiModuleName}:${apiName}:update', 4, 1, now(), now()),
-('删除${businessName}', parentId, 3, '${apiModuleName}:${apiName}:delete', 5, 1, now(), now()),
-('导出${businessName}', parentId, 3, '${apiModuleName}:${apiName}:export', 6, 1, now(), now()),
-('导入${businessName}', parentId, 3, '${apiModuleName}:${apiName}:import', 7, 1, now(), now());
--->
diff --git a/continew-webapi/src/main/java/top/continew/admin/controller/tool/GeneratorController.java b/continew-webapi/src/main/java/top/continew/admin/controller/tool/GeneratorController.java
index 890e9f19..9ed8650f 100644
--- a/continew-webapi/src/main/java/top/continew/admin/controller/tool/GeneratorController.java
+++ b/continew-webapi/src/main/java/top/continew/admin/controller/tool/GeneratorController.java
@@ -27,10 +27,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.generator.model.entity.FieldConfigDO;
import top.continew.admin.generator.model.entity.GenConfigDO;
-import top.continew.admin.generator.model.query.TableQuery;
+import top.continew.admin.generator.model.query.GenConfigQuery;
import top.continew.admin.generator.model.req.GenConfigReq;
import top.continew.admin.generator.model.resp.GeneratePreviewResp;
-import top.continew.admin.generator.model.resp.TableResp;
import top.continew.admin.generator.service.GeneratorService;
import top.continew.admin.system.service.DictService;
import top.continew.starter.extension.crud.model.query.PageQuery;
@@ -56,11 +55,11 @@ public class GeneratorController {
private final GeneratorService baseService;
private final DictService dictService;
- @Operation(summary = "分页查询数据表", description = "分页查询数据表")
+ @Operation(summary = "分页查询生成配置", description = "分页查询生成配置列表")
@SaCheckPermission("tool:generator:list")
- @GetMapping("/table")
- public PageResp pageTable(TableQuery query, @Validated PageQuery pageQuery) throws SQLException {
- return baseService.pageTable(query, pageQuery);
+ @GetMapping("/config")
+ public PageResp pageGenConfig(GenConfigQuery query, @Validated PageQuery pageQuery) {
+ return baseService.pageGenConfig(query, pageQuery);
}
@Operation(summary = "查询生成配置信息", description = "查询生成配置信息")
diff --git a/continew-webapi/src/main/resources/banner.txt b/continew-webapi/src/main/resources/banner.txt
index 737927e6..b7b73693 100644
--- a/continew-webapi/src/main/resources/banner.txt
+++ b/continew-webapi/src/main/resources/banner.txt
@@ -5,5 +5,5 @@
\____|\___/ |_| |_| \__||_||_| \_| \___| \_/\_/ /_/ \_\\__,_||_| |_| |_||_||_| |_|
:: ${project.name} :: v${project.version}
- :: ContiNew Starter :: v2.7.1
+ :: ContiNew Starter :: v2.7.2
:: Spring Boot :: v${spring-boot.version}
diff --git a/continew-webapi/src/main/resources/config/application-generator.yml b/continew-webapi/src/main/resources/config/application-generator.yml
index 6b6554e6..7a808fad 100644
--- a/continew-webapi/src/main/resources/config/application-generator.yml
+++ b/continew-webapi/src/main/resources/config/application-generator.yml
@@ -63,11 +63,6 @@ generator:
- timestamp
## 模板配置
templateConfigs:
- MenuSql:
- template-path: backend/menu.sql.ftl
- package-name: sql
- extension: .sql
- backend: true
DO:
# 模板路径
templatePath: backend/Entity.ftl
@@ -133,4 +128,9 @@ generator:
templatePath: frontend/DetailDrawer.ftl
packageName: src/views
extension: .vue
- backend: false
\ No newline at end of file
+ backend: false
+ Menu:
+ template-path: backend/Menu.ftl
+ packageName: sql
+ extension: .sql
+ backend: true
\ No newline at end of file
diff --git a/continew-webapi/src/main/resources/config/application.yml b/continew-webapi/src/main/resources/config/application.yml
index 6dc5b994..598188ea 100644
--- a/continew-webapi/src/main/resources/config/application.yml
+++ b/continew-webapi/src/main/resources/config/application.yml
@@ -66,6 +66,13 @@ continew-starter.web:
# 是否将原生异常错误信息填充到状态信息中
origin-exception-using-detail-message: false
+--- ### 全局树结构配置(简单树,对应前端 UI)
+continew-starter.crud:
+ tree:
+ id-key: key
+ name-key: title
+ weight-key: sort
+
--- ### 接口文档配置
springdoc:
# 设置对象型参数的展示形式(设为 true 表示将对象型参数平展开,即对象内的属性直接作为参数展示而不是嵌套在对象内,默认 false)
diff --git a/pom.xml b/pom.xml
index fad3bc2e..1574b995 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
top.continew
continew-starter
- 2.7.1
+ 2.7.2
top.continew