diff --git a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java index 8d0e38f5..d4188158 100644 --- a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java +++ b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java @@ -178,11 +178,11 @@ public class GenTableServiceImpl implements IGenTableService { @DSTransactional @Override public void importGenTable(List tableList, String dataName) { - String operName = LoginHelper.getUsername(); + Long operId = LoginHelper.getUserId(); try { for (GenTable table : tableList) { String tableName = table.getTableName(); - GenUtils.initTable(table, operName); + GenUtils.initTable(table, operId); table.setDataName(dataName); int row = baseMapper.insert(table); if (row > 0) { diff --git a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/GenUtils.java b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/GenUtils.java index 948a9301..93762ae3 100644 --- a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/GenUtils.java +++ b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/GenUtils.java @@ -1,14 +1,13 @@ package org.dromara.generator.util; -import org.dromara.generator.constant.GenConstants; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.RegExUtils; import org.dromara.common.core.utils.StringUtils; -import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.generator.config.GenConfig; +import org.dromara.generator.constant.GenConstants; import org.dromara.generator.domain.GenTable; import org.dromara.generator.domain.GenTableColumn; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.RegExUtils; import java.util.Arrays; @@ -23,14 +22,14 @@ public class GenUtils { /** * 初始化表信息 */ - public static void initTable(GenTable genTable, String operName) { + public static void initTable(GenTable genTable, Long operId) { genTable.setClassName(convertClassName(genTable.getTableName())); genTable.setPackageName(GenConfig.getPackageName()); genTable.setModuleName(getModuleName(GenConfig.getPackageName())); genTable.setBusinessName(getBusinessName(genTable.getTableName())); genTable.setFunctionName(replaceText(genTable.getTableComment())); genTable.setFunctionAuthor(GenConfig.getAuthor()); - genTable.setCreateBy(LoginHelper.getUserId()); + genTable.setCreateBy(operId); } /** @@ -185,7 +184,7 @@ public class GenUtils { String text = replacementm; for (String searchString : searchList) { if (replacementm.startsWith(searchString)) { - text = replacementm.replaceFirst(searchString, ""); + text = replacementm.replaceFirst(searchString, StringUtils.EMPTY); break; } } @@ -209,7 +208,7 @@ public class GenUtils { * @return 截取后的列类型 */ public static String getDbType(String columnType) { - if (StringUtils.indexOf(columnType, '(') > 0) { + if (StringUtils.indexOf(columnType, "(") > 0) { return StringUtils.substringBefore(columnType, "("); } else { return columnType; @@ -223,7 +222,7 @@ public class GenUtils { * @return 截取后的列类型 */ public static Integer getColumnLength(String columnType) { - if (StringUtils.indexOf(columnType, '(') > 0) { + if (StringUtils.indexOf(columnType, "(") > 0) { String length = StringUtils.substringBetween(columnType, "(", ")"); return Integer.valueOf(length); } else {