Commit 9a9d95f04527bbd51b294bf641dcb4ce6e3bfd06
1 parent
088871d0
模块名称和表名称一样时,代码生成存在问题,如“shop”模块的“shop”表生成代码时shop都被移除了
Showing
1 changed file
with
2 additions
and
1 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
| @@ -342,7 +342,8 @@ public class CodegenEngine { | @@ -342,7 +342,8 @@ public class CodegenEngine { | ||
| 342 | 342 | ||
| 343 | // className 相关 | 343 | // className 相关 |
| 344 | // 去掉指定前缀,将 TestDictType 转换成 DictType. 因为在 create 等方法后,不需要带上 Test 前缀 | 344 | // 去掉指定前缀,将 TestDictType 转换成 DictType. 因为在 create 等方法后,不需要带上 Test 前缀 |
| 345 | - String simpleClassName = removePrefix(table.getClassName(), upperFirst(table.getModuleName())); | 345 | + String simpleClassName = equalsAnyIgnoreCase(table.getClassName(), table.getModuleName()) ? table.getClassName() |
| 346 | + : removePrefix(table.getClassName(), upperFirst(table.getModuleName())); | ||
| 346 | bindingMap.put("simpleClassName", simpleClassName); | 347 | bindingMap.put("simpleClassName", simpleClassName); |
| 347 | bindingMap.put("simpleClassName_underlineCase", toUnderlineCase(simpleClassName)); // 将 DictType 转换成 dict_type | 348 | bindingMap.put("simpleClassName_underlineCase", toUnderlineCase(simpleClassName)); // 将 DictType 转换成 dict_type |
| 348 | bindingMap.put("classNameVar", lowerFirst(simpleClassName)); // 将 DictType 转换成 dictType,用于变量 | 349 | bindingMap.put("classNameVar", lowerFirst(simpleClassName)); // 将 DictType 转换成 dictType,用于变量 |