mysql计算当前日期与创建日期相差秒数:
select
ID,
TOKEN,
CREATETIME,
UNIX_TIMESTAMP(CREATETIME) addTime
from dl_wxgzh_token
where ID = #{id,jdbcType=VARCHAR}
and (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(CREATETIME)) < =7100
mybatis 中,注意修改小于符号:
select
ID,
TOKEN,
CREATETIME,
UNIX_TIMESTAMP(CREATETIME) addTime
from dl_wxgzh_token
where ID = #{id,jdbcType=VARCHAR}
and (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(CREATETIME)) <![CDATA[ <= ]]> 7100