select * from table where 1=1 (${if(len(a)==0,"","and num >= '"+a+"'")} ${if(len(b)==0,"","and num <= '"+b+"'")}) (${if(len(c)==0,"","or soc >= '"+c+"'")} ${if(len(d)==0,"","and soc <= '"+d+"'")}) a、b、c、d四个参数,要实现a、b两个参数不为空时,a=<num<=b; c、d两个参数不为空时,c=<soc<=d; 四个参数都不问空时,a=<num<=b or c=<soc<=d, 这种逻辑用空白显示全部怎么写,求教! 我直接在两个参数外面加括号就出错了 |