转自:https://blog.csdn.net/qq_34371461/article/details/80571281 评论部分
def generate(table, dir) {
// def className = javaClassName(table.getName(), true) + "DO"
def className = javaName(table.getName(), true)
def fields = calcFields(table)
packageName = getPackageName(dir)
// 设置编码级别为utf-8
new File(dir, className + ".java").withPrintWriter("utf-8") { out -> generate(out, className, fields,table) }
}
找到以上片段,设置编码级别,默认是如下,
new File(dir, className + ".java").withPrintWriter { out -> generate(out, className, fields,table) }