sql语法限制in的最大长度只能为1000,怎么办呢
public static void main(String[] args) {
def list = ['1', '2', '3', '123', '123', '234', '212', '334', '34412', '25324', '132423', '23425332', '235234', '235346', '999', '888', '777', '666', '324534']
def len = list.size()
def slen = Math.ceil(len / 3).toInteger()
def a,sql = ""
if (len > 3) {
for (int i = 0; i < slen; i++) {
if(len>3) {
a = list[0..2]
if (i == 0) {
sql += " and id in (" + a.join(",")+")"
} else {
sql += " or id in (" + a.join(",")+")"
}
}else{
a = list[0,-1]
sql += " or id in (" + a.join(",")+")"
}
len = len-3
list = list-a
}
} else {
sql += " and id in " + a.join(",")
}
println sql
}