@@ -56,12 +56,9 @@ public void generate() throws Exception {
56
56
Configuration configuration = new Configuration ();
57
57
Context context = new Context (ModelType .CONDITIONAL );
58
58
configuration .addContext (context );
59
-
60
- context .addProperty ("autoDelimitKeywords" , "true" );
61
- context .addProperty ("beginningDelimiter" , "`" );
62
- context .addProperty ("endingDelimiter" , "`" );
63
-
59
+
64
60
context .addProperty ("javaFileEncoding" , "UTF-8" );
61
+
65
62
String dbType = selectedDatabaseConfig .getDbType ();
66
63
String connectorLibPath = ConfigHelper .findConnectorLibPath (dbType );
67
64
_LOG .info ("connectorLibPath: {}" , connectorLibPath );
@@ -77,9 +74,13 @@ public void generate() throws Exception {
77
74
tableConfig .setSelectByExampleStatementEnabled (false );
78
75
}
79
76
77
+ context .addProperty ("autoDelimitKeywords" , "true" );
80
78
if (DbType .MySQL .name ().equals (dbType ) || DbType .MySQL_8 .name ().equals (dbType )) {
81
79
tableConfig .setSchema (selectedDatabaseConfig .getSchema ());
82
- } else {
80
+ // 由于beginningDelimiter和endingDelimiter的默认值为双引号("),在Mysql中不能这么写,所以还要将这两个默认值改为`
81
+ context .addProperty ("beginningDelimiter" , "`" );
82
+ context .addProperty ("endingDelimiter" , "`" );
83
+ } else {
83
84
tableConfig .setCatalog (selectedDatabaseConfig .getSchema ());
84
85
}
85
86
if (generatorConfig .isUseSchemaPrefix ()) {
0 commit comments