活动类型默认是1,代表邀请好友
select * from t_invite_activityinfo t
where sysdate >= t.begintime and sysdate<=t.endtime and ACTIVITYTYPE = 1
在mybatis里面的写法;
<!--根据活动类型和当前时间去查询活动id-->
<select id="getActivityId" resultType="string" parameterType="java.lang.String">
SELECT activityId FROM t_invite_activityinfo t
WHERE SYSDATE >= t.beginTime
AND SYSDATE <= t.endTime
AND t.activityType = #{activityType,jdbcType=VARCHAR}
AND t.status = '1'
</select>
其中>=和<=是>=和<=的转义符;
以下转义符:
原符号 | < | <= | > | >= | & | ' | " |
替换符号 | < | <= | > | >= | & | ' | " |