皕杰报表之参数为NULL时,取全部数据

文章封面

在做报表时候,我们经常会遇到这种情况,想参数为空时,可以查询到全部数据,我们可以通过以下方式来实现:

1.通过拼串来实现,当我们设置参数sex和dept两个参数, image 我们可以使用例子中的语句来实现为空时取全部。

2.sql语句写成select * from employee where sex in(?) or ?='1'的方式,然后在数据集参数处写if(@sex==null,'1','3'),其实就是参数为空时给他一个1=1,让他来查全部。 image image 这样我们就可以为空时查全部了,例子是多参数的写法。

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0