select * from S_basic where Gap_number = '${GAP}' and year_month = '${month}' order by date
上传你的模板看看
你数据库的日期格式是yyyy-mm-dd,可是你上面控件值是yy_mm
SELECT * FROM S_Basic where 1=1
${if(len(Months)=0,"","and Year_Month like ' "+Months+"%'")}
然后把你的参数默认值删了
建议是年月拆开,sql里面对日期进行年月的提取,然后再分别写条件。
SELECT YEAR(checkdate),MONTH(checkdate) From test where 1=1
${if(len(year) == 0,"","and YEAR(checkdate) in ('" + year + "')")}
${if(len(month) == 0,"","and MONTH(checkdate) in ('" + month + "')")}
查询条件放一个年份一个月份。