fix: 修复代码生成器遇到无符号类型数据库类型时无法匹配到 javaType

This commit is contained in:
913752709@qq.com 2022-03-27 22:59:03 +08:00
parent e3ddb29c18
commit f2b30625f1

View File

@ -160,8 +160,9 @@ public class CodegenBuilder {
// 处理 javaField 字段
column.setJavaField(toCamelCase(column.getColumnName()));
// 处理 dictType 字段暂无
// 处理 javaType 字段
String dbType = subBefore(column.getColumnType(), '(', false);
// 处理 javaType 字段(兼容无符号类型)
String dbType = replaceIgnoreCase(subBefore(column.getColumnType(), '(', false),
" UNSIGNED", "");
javaTypeMappings.entrySet().stream()
.filter(entry -> entry.getValue().contains(dbType))
.findFirst().ifPresent(entry -> column.setJavaType(entry.getKey()));