diff --git a/project/gradle.properties b/project/gradle.properties index 5aa9ebec8..36b10f97c 100644 --- a/project/gradle.properties +++ b/project/gradle.properties @@ -1,2 +1,2 @@ group=org.babyfish.jimmer -version=0.9.42 +version=0.9.43 diff --git a/project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/dto/DtoGenerator.java b/project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/dto/DtoGenerator.java index 23f85cc78..593b60848 100644 --- a/project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/dto/DtoGenerator.java +++ b/project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/dto/DtoGenerator.java @@ -1729,7 +1729,7 @@ private static CodeBlock codeBlockOf(Anno.Value value) { ((Anno.EnumValue)value).constant ); } else if (value instanceof Anno.LiteralValue) { - builder.add(((Anno.LiteralValue)value).value); + builder.add(((Anno.LiteralValue)value).value.replace("$", "$$")); } return builder.build(); } diff --git a/project/jimmer-ksp/src/main/kotlin/org/babyfish/jimmer/ksp/dto/DtoGenerator.kt b/project/jimmer-ksp/src/main/kotlin/org/babyfish/jimmer/ksp/dto/DtoGenerator.kt index b4e4e425a..e8c352b60 100644 --- a/project/jimmer-ksp/src/main/kotlin/org/babyfish/jimmer/ksp/dto/DtoGenerator.kt +++ b/project/jimmer-ksp/src/main/kotlin/org/babyfish/jimmer/ksp/dto/DtoGenerator.kt @@ -1822,7 +1822,7 @@ class DtoGenerator private constructor( ClassName.bestGuess(value.qualifiedName), value.constant ) - else -> add((value as LiteralValue).value) + else -> add((value as LiteralValue).value.replace("%", "%%")) } } diff --git a/project/jimmer-sql-kotlin/src/test/dto/Employee.dto b/project/jimmer-sql-kotlin/src/test/dto/Employee.dto index efbe2994b..04fb4112e 100644 --- a/project/jimmer-sql-kotlin/src/test/dto/Employee.dto +++ b/project/jimmer-sql-kotlin/src/test/dto/Employee.dto @@ -1,6 +1,7 @@ export org.babyfish.jimmer.sql.kt.model.hr.Employee -> package org.babyfish.jimmer.sql.kt.model.hr.dto +import com.fasterxml.jackson.annotation.JsonFormat import com.fasterxml.jackson.databind.annotation.{JsonSerialize, JsonDeserialize} import org.babyfish.jimmer.sql.kt.model.hr.{MagicStringSerializer, MagicStringDeserializer} @@ -17,5 +18,6 @@ input EmployeeInput { @JsonSerialize(using = MagicStringSerializer::class) @JsonDeserialize(using = MagicStringDeserializer::class) + @JsonFormat(pattern = "[^%]+") name } \ No newline at end of file diff --git a/project/jimmer-sql/src/test/dto/Personal.dto b/project/jimmer-sql/src/test/dto/Personal.dto index 382cc7d80..4f9fd5bcd 100644 --- a/project/jimmer-sql/src/test/dto/Personal.dto +++ b/project/jimmer-sql/src/test/dto/Personal.dto @@ -6,5 +6,7 @@ PersonalPhoneView { } input PersonalPhoneInput { + + @com.fasterxml.jackson.annotation.JsonFormat(pattern = "^\\d+$") phone } \ No newline at end of file