@@ -5490,7 +5490,7 @@ public static <T, M extends Map<String, Object>, L extends List<Object>> SQLConf
54905490 String catalog = getString (request , KEY_CATALOG );
54915491 String schema = getString (request , KEY_SCHEMA );
54925492
5493- SQLConfig <T , M , L > config = (SQLConfig <T , M , L >) callback .getSQLConfig (method , database , schema , datasource , table );
5493+ SQLConfig <T , M , L > config = (SQLConfig <T , M , L >) callback .getSQLConfig (method , database , datasource , namespace , catalog , schema , table );
54945494 config .setAlias (alias );
54955495
54965496 config .setDatabase (database ); // 不删,后面表对象还要用的,必须放在 parseJoin 前
@@ -5511,9 +5511,9 @@ public static <T, M extends Map<String, Object>, L extends List<Object>> SQLConf
55115511
55125512 // 对 id, id{}, userId, userId{} 处理,这些只要不为 null 就一定会作为 AND 条件 <<<<<<<<<<<<<<<<<<<<<<<<<
55135513
5514- String idKey = callback .getIdKey (datasource , database , schema , table );
5514+ String idKey = callback .getIdKey (database , datasource , namespace , catalog , schema , table );
55155515 String idInKey = idKey + "{}" ;
5516- String userIdKey = callback .getUserIdKey (datasource , database , schema , table );
5516+ String userIdKey = callback .getUserIdKey (database , datasource , namespace , catalog , schema , table );
55175517 String userIdInKey = userIdKey + "{}" ;
55185518
55195519 Object idIn = request .get (idInKey ); // 可能是 id{}:">0"
@@ -5539,7 +5539,7 @@ public static <T, M extends Map<String, Object>, L extends List<Object>> SQLConf
55395539
55405540 Object id = request .get (idKey );
55415541 if (id == null && method == POST ) {
5542- id = callback .newId (method , database , schema , datasource , table ); // null 表示数据库自增 id
5542+ id = callback .newId (method , database , datasource , namespace , catalog , schema , table ); // null 表示数据库自增 id
55435543 }
55445544
55455545 if (id != null ) { // null 无效
@@ -6532,44 +6532,59 @@ public static interface IdCallback<T> {
65326532 /**为 post 请求新建 id, 只能是 Long 或 String
65336533 * @param method
65346534 * @param database
6535+ * @param datasource
6536+ * @param namespace
6537+ * @param catalog
65356538 * @param schema
65366539 * @param table
65376540 * @return
65386541 */
6539- T newId (RequestMethod method , String database , String schema , String datasource , String table );
6542+ T newId (RequestMethod method , String database , String datasource , String namespace , String catalog , String schema , String table );
65406543
65416544
65426545 /**获取主键名
65436546 * @param database
6547+ * @param datasource
6548+ * @param namespace
6549+ * @param catalog
65446550 * @param schema
65456551 * @param table
65466552 * @return
65476553 */
6548- String getIdKey (String database , String schema , String datasource , String table );
6554+ String getIdKey (String database , String datasource , String namespace , String catalog , String schema , String table );
65496555
65506556 /**获取 User 的主键名
65516557 * @param database
6558+ * @param datasource
6559+ * @param namespace
6560+ * @param catalog
65526561 * @param schema
65536562 * @param table
65546563 * @return
65556564 */
6556- String getUserIdKey (String database , String schema , String datasource , String table );
6565+ String getUserIdKey (String database , String datasource , String namespace , String catalog , String schema , String table );
65576566 }
65586567
65596568 public static interface Callback <T , M extends Map <String , Object >, L extends List <Object >> extends IdCallback <T > {
65606569 /**获取 SQLConfig<T, M, L> 的实例
65616570 * @param method
65626571 * @param database
6572+ * @param datasource
6573+ * @param namespace
6574+ * @param catalog
65636575 * @param schema
65646576 * @param table
65656577 * @return
65666578 */
6567- SQLConfig <T , M , L > getSQLConfig (RequestMethod method , String database , String schema , String datasource , String table );
6579+ SQLConfig <T , M , L > getSQLConfig (RequestMethod method , String database , String datasource , String namespace , String catalog , String schema , String table );
65686580
65696581 /**combine 里的 key 在 request 中 value 为 null 或不存在,即 request 中缺少用来作为 combine 条件的 key: value
6582+ * @param name
6583+ * @param request
65706584 * @param combine
6585+ * @param item
65716586 * @param key
6572- * @param request
6587+ * @throws Exception
65736588 */
65746589 void onMissingKey4Combine (String name , M request , String combine , String item , String key ) throws Exception ;
65756590 }
@@ -6583,7 +6598,7 @@ public static abstract class SimpleCallback<T, M extends Map<String, Object>, L
65836598
65846599 @ SuppressWarnings ("unchecked" )
65856600 @ Override
6586- public T newId (RequestMethod method , String database , String schema , String datasource , String table ) {
6601+ public T newId (RequestMethod method , String database , String datasource , String namespace , String catalog , String schema , String table ) {
65876602 Long id = System .currentTimeMillis ();
65886603 if (id <= LAST_ID ) {
65896604 id = LAST_ID + 1 ; // 解决高并发下 id 冲突导致新增记录失败
@@ -6594,12 +6609,12 @@ public T newId(RequestMethod method, String database, String schema, String data
65946609 }
65956610
65966611 @ Override
6597- public String getIdKey (String database , String schema , String datasource , String table ) {
6612+ public String getIdKey (String database , String datasource , String namespace , String catalog , String schema , String table ) {
65986613 return KEY_ID ;
65996614 }
66006615
66016616 @ Override
6602- public String getUserIdKey (String database , String schema , String datasource , String table ) {
6617+ public String getUserIdKey (String database , String datasource , String namespace , String catalog , String schema , String table ) {
66036618 return KEY_USER_ID ;
66046619 }
66056620
0 commit comments