其他分享
首页 > 其他分享> > 帆软参数为空查询全部

帆软参数为空查询全部

作者:互联网

参数为空查询全部:
固定值
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)+"’) ")}

标签:trim,storename,begindate,len,查询,参数,为空,WHERE,帆软
来源: https://www.cnblogs.com/tdskee/p/16152598.html