其它的数据库,你就自己换成你的函数就行了。。。最后的format的不变。。。create_time是你数据库表的字段,creattime是参数名称。。。
如果是mysql这样:
where 1=1
${if(len(creattime) = 0,"","and substring(create_time,1,7)='"+format(creattime,"yyyy-MM")+"'")}
---------如果是sql server 分隔线-------------
where 1=1
${if(len(creattime) = 0,"","and CONVERT(varchar(7),create_time, 120)='"+format(creattime,"yyyy-MM")+"'")}
------------如果是oracel分隔线--------------------
where 1=1
${if(len(creattime) = 0,"","and to_char(create_time, 'yyyy-mm')='"+format(creattime,"yyyy-MM")+"'")}