select * from a
where 1=1
${if(len(m1)==0,"","and date(a.inspection_time) >= date_sub(curdate(),interval 'm1' month)")}
参数怎么写${}里。。。。上面写法有问题,数据查不出来
${if(len(m1)==0,"","and date(a.inspection_time) >= date_sub(curdate(),interval '"+m1+"'month)")}
试试
${if(len(m1)==0,"","and date(a.inspection_time) >= date_sub(curdate(),interval "+m1+" month)")}
${if(len(m1)==0,"","and date(a.inspection_time) >= date_sub(curdate(),interval '"+m1+"' month)")}