diff --git a/internal/core/gen.go b/internal/core/gen.go index 5a7ac0a..2223568 100644 --- a/internal/core/gen.go +++ b/internal/core/gen.go @@ -368,7 +368,7 @@ func (t ktType) IsUUID() bool { } func (t ktType) IsBigDecimal() bool { - return t.Name == "java.math.BigDecimal" + return t.Name == "BigDecimal" } func makeType(req *plugin.GenerateRequest, col *plugin.Column) ktType { diff --git a/internal/core/imports.go b/internal/core/imports.go index 7fdcb88..79fa99e 100644 --- a/internal/core/imports.go +++ b/internal/core/imports.go @@ -86,6 +86,9 @@ func (i *Importer) modelImports() [][]string { if i.usesType("UUID") { std["java.util.UUID"] = struct{}{} } + if i.usesType("BigDecimal") { + std["java.math.BigDecimal"] = struct{}{} + } stds := make([]string, 0, len(std)) for s := range std { @@ -120,6 +123,9 @@ func stdImports(uses func(name string) bool) map[string]struct{} { if uses("UUID") { std["java.util.UUID"] = struct{}{} } + if uses("BigDecimal") { + std["java.math.BigDecimal"] = struct{}{} + } return std } diff --git a/internal/core/postgresql_type.go b/internal/core/postgresql_type.go index ce53e19..a033890 100644 --- a/internal/core/postgresql_type.go +++ b/internal/core/postgresql_type.go @@ -36,7 +36,7 @@ func postgresType(req *plugin.GenerateRequest, col *plugin.Column) (string, bool return "Float", false case "pg_catalog.numeric": - return "java.math.BigDecimal", false + return "BigDecimal", false case "bool", "pg_catalog.bool": return "Boolean", false