修复代码生成关联表前缀问题

This commit is contained in:
TinyAnts 2022-12-29 14:16:54 +08:00
parent 97202201a2
commit 62a3606169
2 changed files with 5 additions and 1 deletions

View File

@ -264,7 +264,7 @@ public class GenerateServiceImpl implements IGenerateService {
model.setGenType(genParam.getGenType()); model.setGenType(genParam.getGenType());
model.setGenPath(genParam.getGenPath()); model.setGenPath(genParam.getGenPath());
model.setSubTableFk(genParam.getSubTableFk()); model.setSubTableFk(genParam.getSubTableFk());
model.setSubTableName(genParam.getSubTableName().replace(GlobalConfig.tablePrefix, "")); model.setSubTableName(genParam.getSubTableName());
genTableMapper.updateById(model); genTableMapper.updateById(model);
for (Map<String, String> item : genParam.getColumn()) { for (Map<String, String> item : genParam.getColumn()) {

View File

@ -1,5 +1,6 @@
package com.mdd.generator.util; package com.mdd.generator.util;
import com.mdd.common.config.GlobalConfig;
import com.mdd.common.util.StringUtils; import com.mdd.common.util.StringUtils;
import com.mdd.generator.config.GenConfig; import com.mdd.generator.config.GenConfig;
import com.mdd.generator.constant.GenConstants; import com.mdd.generator.constant.GenConstants;
@ -67,6 +68,9 @@ public class VelocityUtil {
} }
} }
// 替换前缀
table.setSubTableName(table.getSubTableName().replace(GlobalConfig.tablePrefix, ""));
// 设置模板变量 // 设置模板变量
VelocityContext velocityContext = new VelocityContext(); VelocityContext velocityContext = new VelocityContext();
velocityContext.put("genTpl", table.getGenTpl()); velocityContext.put("genTpl", table.getGenTpl());