帆软参数为空查询全部

参数为空查询全部:
固定值
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 @   TwinStudio  阅读(801)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示