@@ -19,6 +19,8 @@ public static Article mysqlToDictionary(String sql, String brief, String moduleI
1919 if (!sql .toLowerCase ().replaceAll (" " , "" ).startsWith ("createtable" )){
2020 throw new MyException ("000046" );
2121 }
22+ // 联合主键等被切分
23+ sql = sql .replace ("`,`" , "" );
2224 Article article = new Article ();
2325 article .setType (ArticleType .DICTIONARY .name ());
2426 article .setBrief (brief );
@@ -115,7 +117,13 @@ public static Article mysqlToDictionary(String sql, String brief, String moduleI
115117 }
116118 List <DictionaryDto > fieldList = new ArrayList <DictionaryDto >();
117119 for (String key : propertys .keySet ()){
118- fieldList .add (propertys .get (key ));
120+ if ( propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .primary .getName () )
121+ || propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .foreign .getName () )
122+ || propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .associate .getName () ) ){
123+ fieldList .add (0 ,propertys .get (key ));
124+ }else {
125+ fieldList .add (propertys .get (key ));
126+ }
119127 }
120128 article .setContent (JSONArray .fromObject (fieldList ).toString ());
121129 return article ;
@@ -219,7 +227,13 @@ public static Article sqlserviceToDictionary(String sql, String brief, String mo
219227 }
220228 List <DictionaryDto > fieldList = new ArrayList <DictionaryDto >();
221229 for (String key : propertys .keySet ()){
222- fieldList .add (propertys .get (key ));
230+ if ( propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .primary .getName () )
231+ || propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .foreign .getName () )
232+ || propertys .get (key ).getFlag ().equals ( DictionaryPropertyType .associate .getName () ) ){
233+ fieldList .add (0 ,propertys .get (key ));
234+ }else {
235+ fieldList .add (propertys .get (key ));
236+ }
223237 }
224238 article .setContent (JSONArray .fromObject (fieldList ).toString ());
225239 return article ;
0 commit comments