@@ -403,12 +403,22 @@ public String getValues() {
403403 public String getValuesString () {
404404 return values ;
405405 }
406- public AbstractSQLConfig setValues (String [][] valuess ) {
406+ public AbstractSQLConfig setValues (Object [][] valuess ) {
407407 String s = "" ;
408408 if (valuess != null && valuess .length > 0 ) {
409- String [] items = new String [valuess .length ];
409+ Object [] items = new Object [valuess .length ];
410+ Object [] vs ;
410411 for (int i = 0 ; i < valuess .length ; i ++) {
411- items [i ] = "(" + StringUtil .getString (valuess [i ]) + ")" ;
412+ vs = valuess [i ];
413+ if (vs == null ) {
414+ continue ;
415+ }
416+
417+ items [i ] = "(" ;
418+ for (int j = 0 ; j < vs .length ; j ++) {
419+ items [i ] += ((j <= 0 ? "" : "," ) + getValue (vs [j ]));
420+ }
421+ items [i ] += ")" ;
412422 }
413423 s = StringUtil .getString (items );
414424 }
@@ -1279,13 +1289,13 @@ public static AbstractSQLConfig newSQLConfig(RequestMethod method, String table,
12791289 column = KEY_ID + "," + StringUtil .getString (columns ); //set已经判断过不为空
12801290 final int size = columns .length + 1 ; //以key数量为准
12811291
1282- String [][] valuess = new String [idList .size ()][]; // [idList.size()][]
1283- String [] items ; //(item0, item1, ...)
1292+ Object [][] valuess = new Object [idList .size ()][]; // [idList.size()][]
1293+ Object [] items ; //(item0, item1, ...)
12841294 for (int i = 0 ; i < idList .size (); i ++) {
1285- items = new String [size ];
1286- items [0 ] = "'" + idList .get (i ) + "'" ; //第0个就是id。所有的值都加 '' 避免SQL注入风险
1295+ items = new Object [size ];
1296+ items [0 ] = idList .get (i ); //第0个就是id
12871297 for (int j = 1 ; j < size ; j ++) {
1288- items [j ] = "'" + values [j -1 ] + "'" ; //从第1个开始,允许"null"
1298+ items [j ] = values [j -1 ]; //从第1个开始,允许"null"
12891299 }
12901300 valuess [i ] = items ;
12911301 }
0 commit comments