mybatis支援mysql時間比較,獲取部分滿足資料
阿新 • • 發佈:2018-12-15
mybatis動態拼接引數 //獲取當前時間和修改時間的差值大於指定的分鐘資料 <operation name="queryBusinessByCondition" multiplicity="many"> <extraparams> <param name="expireMinuteOfModify" javatype="java.lang.Integer"/> <param name="scene" javatype="java.lang.String"/> </extraparams> <sql> <![CDATA[ SELECT id FROM business_order ]]> </sql> <sqlmap> <![CDATA[ SELECT id FROM business_order WHERE effective = 'Y' <isNotEmpty prepend="AND" property="scene"> scene=#scene# </isNotEmpty> <isNotEmpty prepend="AND" property="expireMinuteOfModify"> TIMESTAMPDIFF(MINUTE, gmt_modified, now()) > #expireMinuteOfModify# </isNotEmpty> LIMIT 10 ]]> </sqlmap> </operation>