@@ -754,7 +754,7 @@ public SQLConfig setJoinList(List<Join> joinList) {
754754 public boolean hasJoin () {
755755 return joinList != null && joinList .isEmpty () == false ;
756756 }
757-
757+
758758
759759 @ Override
760760 public boolean isTest () {
@@ -1152,7 +1152,7 @@ public String getEqualString(String key, Object value) throws Exception {
11521152 if (StringUtil .isName (key ) == false ) {
11531153 throw new IllegalArgumentException (key + ":value 中key不合法!不支持 ! 以外的逻辑符 !" );
11541154 }
1155-
1155+
11561156 return getKey (key ) + (not ? "!=" : "=" ) + (value instanceof Subquery ? getSubqueryString ((Subquery ) value ) : getValue (value ));
11571157 }
11581158
@@ -1346,12 +1346,12 @@ public String getBetweenString(String key, Object[] values, int type) throws Ill
13461346 if (values [i ] instanceof String == false ) {
13471347 throw new IllegalArgumentException (key + "%:value 中 value 的类型只能为 String 或 String[] !" );
13481348 }
1349-
1349+
13501350 vs = StringUtil .split ((String ) values [i ]);
13511351 if (vs == null || vs .length != 2 ) {
13521352 throw new IllegalArgumentException (key + "%:value 中 value 不合法!类型为 String 时必须包括1个逗号 , 且左右两侧都有值!类型为 String[] 里面每个元素要符合前面类型为 String 的规则 !" );
13531353 }
1354-
1354+
13551355 condition += (i <= 0 ? "" : (Logic .isAnd (type ) ? AND : OR )) + "(" + getBetweenString (key , vs [0 ], vs [1 ]) + ")" ;
13561356 }
13571357
@@ -1522,6 +1522,27 @@ public String getContainString(String key, Object[] childs, int type) throws Ill
15221522 }
15231523 //<> contain >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
15241524
1525+
1526+
1527+ //key@:{} Subquery <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
1528+
1529+ @ Override
1530+ public String getSubqueryString (Subquery subquery ) throws Exception {
1531+ String range = subquery .getRange ();
1532+ SQLConfig cfg = subquery .getConfig ();
1533+
1534+ cfg .setPreparedValueList (new ArrayList <>());
1535+ String sql = (range == null || range .isEmpty () ? "" : range ) + "(" + cfg .getSQL (isPrepared ()) + ") " ;
1536+
1537+ preparedValueList .addAll (cfg .getPreparedValueList ());
1538+
1539+ return sql ;
1540+ }
1541+
1542+ //key@:{} Subquery >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1543+
1544+
1545+
15251546 /**拼接条件
15261547 * @param not
15271548 * @param condition
@@ -1689,9 +1710,9 @@ private static String getConditionString(String column, String table, AbstractSQ
16891710
16901711 Subquery from = config .getFrom ();
16911712 if (from != null ) {
1692- table = config .getSubqueryString (from ) + " AS " + config .getKey ( from . getFrom () ) + " " ; //TODO Comment:c 转为 AS `Comment:c`
1713+ table = config .getSubqueryString (from ) + " AS " + config .getAlias ( ) + " " ; //TODO Comment:c 转为 AS `Comment:c`
16931714 }
1694-
1715+
16951716 String condition = table + config .getJoinString () + where + (
16961717 RequestMethod .isGetMethod (config .getMethod (), true ) == false ?
16971718 "" : config .getGroupString () + config .getHavingString () + config .getOrderString ()
0 commit comments