您可以键入"${abc}"做为一个参数,这里abc是参数的名称。
例如:
select * from table where id=${abc}
select * from table where id='${abc}' (如果id字段为字符串类型)
除非整个表达式用${}包起来的,变量名不用再次使用${}
例如:
${IF(LEN(orgname)==0,""," and m.org_name ='"+ orgname +"'")}
1.相等号参数,判断是否为空
${IF(LEN(orgname)==0,""," and m.org_name ='"+ orgname +"'")}
2.模糊查询,判断是否为空
${IF(len(keyword)=0, "", " and (m.device_code like '%"+keyword+"%' or m.device_name like '%"+keyword+"%' or m.device_tag_no like '%"+keyword+"%')")}
3.数字不相等号
where d.quality=0 and d.data_source<>0 and p.status<>-1
4.日期
where a.confirm_date>=to_date('${sdate} 00:00:00','yyyy-mm-dd hh24:mi:ss') and a.confirm_date<to_date('${edate} 00:00:00','yyyy-mm-dd hh24:mi:ss')+1
5.日期,判断是否为空
${IF(OR(isnull(sdate),isnull(edate)), "", " and t.sampled_date>=to_date('"+sdate+" 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.sampled_date<to_date('"+edate+" 00:00:00','yyyy-mm-dd hh24:mi:ss')+1 ")}
6.查询列如果为空显示0
select nvl(size,0) as size from t
持续更新..