2525
2626import apijson .Log ;
2727import apijson .RequestMethod ;
28- import apijson .framework .APIJSONSQLConfig ;
29- import apijson .framework .APIJSONSQLExecutor ;
28+ import apijson .framework .javax . APIJSONSQLConfig ;
29+ import apijson .framework .javax . APIJSONSQLExecutor ;
3030import apijson .orm .SQLConfig ;
3131
3232
@@ -37,13 +37,20 @@ public class DemoSQLExecutor extends APIJSONSQLExecutor<Long> {
3737 public static final String TAG = "DemoSQLExecutor" ;
3838
3939 @ Override
40- protected String getKey (SQLConfig config , ResultSet rs , ResultSetMetaData rsmd , int tablePosition , JSONObject table , int columnIndex , Map <String , JSONObject > childMap ) throws Exception {
40+ protected String getKey (SQLConfig < Long > config , ResultSet rs , ResultSetMetaData rsmd , int tablePosition , JSONObject table , int columnIndex , Map <String , JSONObject > childMap ) throws Exception {
4141 String key = super .getKey (config , rs , rsmd , tablePosition , table , columnIndex , childMap );
42- String table_name = config .getTable ();
43- if (APIJSONSQLConfig .TABLE_KEY_MAP .containsKey (table_name )) table_name = APIJSONSQLConfig .TABLE_KEY_MAP .get (table_name );
44- String pattern = "^" + table_name + "\\ ." + "[a-zA-Z]+$" ;
42+ String tbl = config .getTable ();
43+
44+ if (APIJSONSQLConfig .TABLE_KEY_MAP .containsKey (tbl )) {
45+ tbl = APIJSONSQLConfig .TABLE_KEY_MAP .get (tbl );
46+ }
47+
48+ String pattern = "^" + tbl + "\\ ." + "[a-zA-Z]+$" ;
4549 boolean isMatch = Pattern .matches (pattern , key );
46- if (isMatch ) key = key .split ("\\ ." )[1 ];
50+ if (isMatch ) {
51+ key = key .split ("\\ ." )[1 ];
52+ }
53+
4754 return key ;
4855 }
4956
0 commit comments