日期字段按年、月查询sql

<if test='year != null and year != ""'>
    and t.time BETWEEN concat(#{year},'/01/%') and concat(#{year},'/12/%')
</if>
<if test='month != null and month != ""'>
    and instr(t.time , concat(concat('/',replace(lpad(#{month},2),' ','0')),'/')) > 0
</if>

版权声明:本文为qq_36441163原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。