就是两张表做关联,当一张表内有两个动态参数时,如何实现只有一个参数输入时也可以查询出数据
参考:https://help.fanruan.com/finereport/doc-view-2394.html#5
条件这样写 ${if(len(动态参数) == 0,"","and 字段 = ('" + 动态参数 + "')")}
sql中做判断
select * from 表 where 1=1
${if(len(参数1)=0,""," and 字段1='"+参数2+"'")}
${if(len(参数2)=0,""," and 字段2='"+参数2+"'")}
sql里面写 WHERE 1=1 ${if(len(参数名) == 0,"","and 对应字段 = '" + 参数名 + "'")} 为空的时候查全部啊
${if(len(参数1)==0,""," and 字段1='"+参数1+"'")}
${if(len(参数2)==0,""," and 字段2='"+参数2+"'")}