很多小程序页面都会需要查询活动,但是活动的状态都是根据时间改变而改变,所以要一个通用sql 话不多说上代码
< test=“status!=null and status!=’’ and status==1”>
and now()<![CDATA[ < ]]>a.start_time
< test=“status!=null and status!=’’ and status==2”>
and now() between a.start_time and a.end_time
<test=“status!=null and status!=’’ and status==3”>
and now()<![CDATA[ > ]]>a.end_time