帆软参数为空查询全部

参数为空查询全部:
固定值
WHERE 1=1 ${if(len(参数) == 0,"",“and 字段 = '” + 参数 + “’”)}
模糊查询
WHERE 1=1 ${if(len(参数) == 0,""," and 字段like ‘%" + 参数 + "%’")}
下拉复选框
WHERE 1=1 ${if(len(参数) == 0,"",“and 字段 in (’” + 参数+ “’)”)}
WHERE 1=1 ${if(len(参数) == 0 ,"" , " and 字段 in (’" + SUBSTITUTE(参数,",","’,’") + “’)”)}
单选框
${if(len(参数) == 0 ,"" , " and 字段 in (" + SUBSTITUTE(参数,",",",") + “)”)}
时间:t.ordertime between ‘ begindate′andtochar (todate( ′ {begindate}' and to_char(to_date(' begindate′andtoc​har(tod​ate(′{enddate}’,‘yyyy-mm-dd’),‘yyyy-mm-dd’)
${if(len(trim(storename))==0,"",“and t.storename in (’”+trim(storename)+"’) ")}

between…and…如果想对日期进行处理可拆分开来写
${if(len(trim(begindate1))==0,"",“and substr(o.booktime,0,10) >= (’”+trim(begindate1)+"’) “)} ${if(len(trim(enddate1))==0,”",“and substr(o.booktime,0,10) <= (’”+trim(enddate1)+"’) ")}

posted @ 2022-04-16 13:45  TwinStudio  阅读(716)  评论(0编辑  收藏  举报