默认查询7天的数据
<if test="startDate != null and startDate !='' ">
<![CDATA[AND a.use_date >= #{startDate}]]>
</if>
<if test="endDate != null and endDate !='' ">
<![CDATA[AND a.use_date < #{endDate}]]>
</if>
<if test='startDate == null and endDate == null' >
AND DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= a.use_date
</if>
默认查询昨天的数据
<if test='startDate == null and endDate == null' >
AND TO_DAYS( NOW( ) ) - TO_DAYS( a.dept_kpi_date) = 1
</if>
参考:
if判断参数等于某个值
<if test=' type == "1"'>....</if>