mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-25 23:04:33 +08:00
update 优化 代码生成模块
This commit is contained in:
@@ -80,7 +80,7 @@ Topiam IAM/IDaaS身份管理平台 - https://www.topiam.cn/ <br>
|
|||||||
| 邮件 | 采用 mail-api 通用协议支持大部分邮件厂商 | 不支持 |
|
| 邮件 | 采用 mail-api 通用协议支持大部分邮件厂商 | 不支持 |
|
||||||
| 接口文档 | 采用 SpringDoc、javadoc 无注解零入侵基于java注释<br/>只需把注释写好 无需再写一大堆的文档注解了 | 采用 Springfox 已停止维护 需要编写大量的注解来支持文档生成 |
|
| 接口文档 | 采用 SpringDoc、javadoc 无注解零入侵基于java注释<br/>只需把注释写好 无需再写一大堆的文档注解了 | 采用 Springfox 已停止维护 需要编写大量的注解来支持文档生成 |
|
||||||
| 校验框架 | 采用 Validation 支持注解与工具类校验 注解支持国际化 | 仅支持注解 且注解不支持国际化 |
|
| 校验框架 | 采用 Validation 支持注解与工具类校验 注解支持国际化 | 仅支持注解 且注解不支持国际化 |
|
||||||
| Excel框架 | 采用 FastExcel(原Alibaba EasyExcel) 基于插件化<br/>框架对其增加了很多功能 例如 自动合并相同内容 自动排列布局 字典翻译等 | 基于 POI 手写实现 功能有限 复杂 扩展性差 |
|
| Excel框架 | 采用 Apache Fesod(原Alibaba EasyExcel) 基于插件化<br/>框架对其增加了很多功能 例如 自动合并相同内容 自动排列布局 字典翻译等 | 基于 POI 手写实现 功能有限 复杂 扩展性差 |
|
||||||
| 工作流支持 | 采用 WarmFlow 支持各种复杂审批 转办 委派 加减签 会签 或签 票签 等功能 | 无 |
|
| 工作流支持 | 采用 WarmFlow 支持各种复杂审批 转办 委派 加减签 会签 或签 票签 等功能 | 无 |
|
||||||
| 工具类框架 | 采用 Hutool、Lombok 上百种工具覆盖90%的使用需求 基于注解自动生成 get set 等简化框架大量代码 | 手写工具稳定性差易出问题 工具数量有限 代码臃肿需自己手写 get set 等 |
|
| 工具类框架 | 采用 Hutool、Lombok 上百种工具覆盖90%的使用需求 基于注解自动生成 get set 等简化框架大量代码 | 手写工具稳定性差易出问题 工具数量有限 代码臃肿需自己手写 get set 等 |
|
||||||
| 监控框架 | 采用 SpringBoot-Admin 基于SpringBoot官方 actuator 探针机制<br/>实时监控服务状态 框架还为其扩展了在线日志查看监控 | 无 |
|
| 监控框架 | 采用 SpringBoot-Admin 基于SpringBoot官方 actuator 探针机制<br/>实时监控服务状态 框架还为其扩展了在线日志查看监控 | 无 |
|
||||||
@@ -97,8 +97,6 @@ Topiam IAM/IDaaS身份管理平台 - https://www.topiam.cn/ <br>
|
|||||||
|
|
||||||
| 业务 | 功能说明 | 本框架 | RuoYi |
|
| 业务 | 功能说明 | 本框架 | RuoYi |
|
||||||
|--------|----------------------------------------------------------------------|-----|------------------|
|
|--------|----------------------------------------------------------------------|-----|------------------|
|
||||||
| 租户管理 | 系统内租户的管理 如:租户套餐、过期时间、用户数量、企业信息等 | 支持 | 无 |
|
|
||||||
| 租户套餐管理 | 系统内租户所能使用的套餐管理 如:套餐内所包含的菜单等 | 支持 | 无 |
|
|
||||||
| 客户端管理 | 系统内对接的所有客户端管理 如: pc端、小程序端等<br>支持动态授权登录方式 如: 短信登录、密码登录等 支持动态控制token时效 | 支持 | 无 |
|
| 客户端管理 | 系统内对接的所有客户端管理 如: pc端、小程序端等<br>支持动态授权登录方式 如: 短信登录、密码登录等 支持动态控制token时效 | 支持 | 无 |
|
||||||
| 用户管理 | 用户的管理配置 如:新增用户、分配用户所属部门、角色、岗位等 | 支持 | 支持 |
|
| 用户管理 | 用户的管理配置 如:新增用户、分配用户所属部门、角色、岗位等 | 支持 | 支持 |
|
||||||
| 部门管理 | 配置系统组织机构(公司、部门、小组) 树结构展现支持数据权限 | 支持 | 支持 |
|
| 部门管理 | 配置系统组织机构(公司、部门、小组) 树结构展现支持数据权限 | 支持 | 支持 |
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
package org.dromara.generator.config;
|
|
||||||
|
|
||||||
import cn.hutool.extra.template.TemplateConfig;
|
|
||||||
import org.dromara.common.core.factory.YmlPropertySourceFactory;
|
|
||||||
import org.dromara.generator.config.properties.GenProperties;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.PropertySource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 读取代码生成相关配置
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@AutoConfiguration
|
|
||||||
@EnableConfigurationProperties(GenProperties.class)
|
|
||||||
@PropertySource(value = "classpath:generator.yml", factory = YmlPropertySourceFactory.class)
|
|
||||||
public class GenConfig {
|
|
||||||
|
|
||||||
private static GenProperties genProperties;
|
|
||||||
|
|
||||||
public GenConfig(GenProperties genProperties) {
|
|
||||||
GenConfig.genProperties = genProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getAuthor() {
|
|
||||||
return genProperties.getAuthor();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPackageName() {
|
|
||||||
return genProperties.getPackageName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean getAutoRemovePre() {
|
|
||||||
return genProperties.isAutoRemovePre();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTablePrefix() {
|
|
||||||
return genProperties.getTablePrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TemplateConfig getTemplateConfig() {
|
|
||||||
return genProperties.getTemplateConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,10 @@ package org.dromara.generator.config.properties;
|
|||||||
|
|
||||||
import cn.hutool.extra.template.TemplateConfig;
|
import cn.hutool.extra.template.TemplateConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.common.core.factory.YmlPropertySourceFactory;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@@ -12,7 +15,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
* @author 秋辞未寒
|
* @author 秋辞未寒
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@Component
|
||||||
@ConfigurationProperties(prefix = "gen")
|
@ConfigurationProperties(prefix = "gen")
|
||||||
|
@PropertySource(value = "classpath:generator.yml", factory = YmlPropertySourceFactory.class)
|
||||||
public class GenProperties {
|
public class GenProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package org.dromara.generator.util;
|
|||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.RegExUtils;
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.generator.config.GenConfig;
|
import org.dromara.generator.config.properties.GenProperties;
|
||||||
import org.dromara.generator.constant.GenConstants;
|
import org.dromara.generator.constant.GenConstants;
|
||||||
import org.dromara.generator.domain.GenTable;
|
import org.dromara.generator.domain.GenTable;
|
||||||
import org.dromara.generator.domain.GenTableColumn;
|
import org.dromara.generator.domain.GenTableColumn;
|
||||||
@@ -19,6 +20,8 @@ import java.util.Arrays;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class GenUtils {
|
public class GenUtils {
|
||||||
|
|
||||||
|
private final static GenProperties PROPERTIES = SpringUtils.getBean(GenProperties.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化表信息
|
* 初始化表信息
|
||||||
*
|
*
|
||||||
@@ -26,11 +29,11 @@ public class GenUtils {
|
|||||||
*/
|
*/
|
||||||
public static void initTable(GenTable genTable) {
|
public static void initTable(GenTable genTable) {
|
||||||
genTable.setClassName(convertClassName(genTable.getTableName()));
|
genTable.setClassName(convertClassName(genTable.getTableName()));
|
||||||
genTable.setPackageName(GenConfig.getPackageName());
|
genTable.setPackageName(PROPERTIES.getPackageName());
|
||||||
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
|
genTable.setModuleName(getModuleName(PROPERTIES.getPackageName()));
|
||||||
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
|
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
|
||||||
genTable.setFunctionName(replaceText(genTable.getTableComment()));
|
genTable.setFunctionName(replaceText(genTable.getTableComment()));
|
||||||
genTable.setFunctionAuthor(GenConfig.getAuthor());
|
genTable.setFunctionAuthor(PROPERTIES.getAuthor());
|
||||||
genTable.setCreateTime(null);
|
genTable.setCreateTime(null);
|
||||||
genTable.setUpdateTime(null);
|
genTable.setUpdateTime(null);
|
||||||
}
|
}
|
||||||
@@ -157,8 +160,8 @@ public class GenUtils {
|
|||||||
* @return 类名
|
* @return 类名
|
||||||
*/
|
*/
|
||||||
public static String convertClassName(String tableName) {
|
public static String convertClassName(String tableName) {
|
||||||
boolean autoRemovePre = GenConfig.getAutoRemovePre();
|
boolean autoRemovePre = PROPERTIES.isAutoRemovePre();
|
||||||
String tablePrefix = GenConfig.getTablePrefix();
|
String tablePrefix = PROPERTIES.getTablePrefix();
|
||||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
|
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
|
||||||
String[] searchList = StringUtils.split(tablePrefix, StringUtils.SEPARATOR);
|
String[] searchList = StringUtils.split(tablePrefix, StringUtils.SEPARATOR);
|
||||||
tableName = replaceFirst(tableName, searchList);
|
tableName = replaceFirst(tableName, searchList);
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ import lombok.AccessLevel;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.utils.DateUtils;
|
import org.dromara.common.core.utils.DateUtils;
|
||||||
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.common.mybatis.enums.DataBaseType;
|
import org.dromara.common.mybatis.enums.DataBaseType;
|
||||||
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
||||||
import org.dromara.generator.config.GenConfig;
|
import org.dromara.generator.config.properties.GenProperties;
|
||||||
import org.dromara.generator.constant.GenConstants;
|
import org.dromara.generator.constant.GenConstants;
|
||||||
import org.dromara.generator.domain.GenTable;
|
import org.dromara.generator.domain.GenTable;
|
||||||
import org.dromara.generator.domain.GenTableColumn;
|
import org.dromara.generator.domain.GenTableColumn;
|
||||||
@@ -52,7 +53,8 @@ public class TemplateEngineUtils {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
// 模板引擎初始化
|
// 模板引擎初始化
|
||||||
TEMPLATE_ENGINE = TemplateUtil.createEngine(GenConfig.getTemplateConfig());
|
GenProperties properties = SpringUtils.getBean(GenProperties.class);
|
||||||
|
TEMPLATE_ENGINE = TemplateUtil.createEngine(properties.getTemplateConfig());
|
||||||
TEMPLATE_MAPPER = PathNamedTemplate.form(TEMPLATE_ENGINE, GenConstants.TEMPLATE_PATHS);
|
TEMPLATE_MAPPER = PathNamedTemplate.form(TEMPLATE_ENGINE, GenConstants.TEMPLATE_PATHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
org.dromara.generator.config.GenConfig
|
|
||||||
Reference in New Issue
Block a user