我想根据搜索号参数选择一个结果,比如我通过 7
了,我想要这样的sql语句select * from student where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(CREATETIME)
,现在在Mybatis中,我尝试这样写,也改成${pd.intervalDay}
,#{pd.intervalDay}
但是错误。如何更改?
<!-- pd is hasmap type -->
<select id="selectstudentresult" parameterType="page" resultType="pd">
select * from student
<where>
<if test="pd.intervalDay!=null">
and DATE_SUB(CURDATE(), INTERVAL ${pd.intervalDay} DAY) <= date(a.UPDATETIME)
</if>
</where>