update 优化 去除GenUtils设置createby逻辑 统一走自动注入设置

This commit is contained in:
疯狂的狮子Li 2024-10-29 11:19:08 +08:00
parent a21fa666fd
commit 1757e5519d
2 changed files with 2 additions and 5 deletions

View File

@ -29,7 +29,6 @@ import org.dromara.common.core.utils.file.FileUtils;
import org.dromara.common.json.utils.JsonUtils; import org.dromara.common.json.utils.JsonUtils;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
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;
@ -269,11 +268,10 @@ public class GenTableServiceImpl implements IGenTableService {
@DSTransactional @DSTransactional
@Override @Override
public void importGenTable(List<GenTable> tableList, String dataName) { public void importGenTable(List<GenTable> tableList, String dataName) {
Long operId = LoginHelper.getUserId();
try { try {
for (GenTable table : tableList) { for (GenTable table : tableList) {
String tableName = table.getTableName(); String tableName = table.getTableName();
GenUtils.initTable(table, operId); GenUtils.initTable(table);
table.setDataName(dataName); table.setDataName(dataName);
int row = baseMapper.insert(table); int row = baseMapper.insert(table);
if (row > 0) { if (row > 0) {

View File

@ -22,14 +22,13 @@ public class GenUtils {
/** /**
* 初始化表信息 * 初始化表信息
*/ */
public static void initTable(GenTable genTable, Long operId) { public static void initTable(GenTable genTable) {
genTable.setClassName(convertClassName(genTable.getTableName())); genTable.setClassName(convertClassName(genTable.getTableName()));
genTable.setPackageName(GenConfig.getPackageName()); genTable.setPackageName(GenConfig.getPackageName());
genTable.setModuleName(getModuleName(GenConfig.getPackageName())); genTable.setModuleName(getModuleName(GenConfig.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(GenConfig.getAuthor());
genTable.setCreateBy(operId);
} }
/** /**