当传来的参数的值不同时,执行不同的查询sql,该如何写,如下:
select xxx from xxx where xxx
and _________________________________________________________
条件如下:
当参数 'cx' = '调小'时,cx not in (select cx from xxx) [一个子查询]
当参数 'cx'!= '调小'时,cx = 传来的参数 cx
请问横线处该如何填写
${if(cx='调小',"and cx not in (select cx from xxx)"," and cx ='"+cx+"'")}
===========
${if(cx='调小',"and cx not in (select cx from xxx where 字段='"+cx+"')"," and cx ='"+cx+"'")}
${if(cx="调小","select xxx from xxx where cx not in (select cx from xxx) ","sselect xxx from xxx where cx = 传来的参数 cx")}
where ${if(len(cx) == '调小'," and cx not in (select cx from xxx) "," and cx = '" + cx + "'")}