mysql mybatis 查询7天内 30天内的信息

<select id="queryWithPageByParam" resultMap="ResultMapWithBLOBs"  parameterType="ActionValues" >
  select
  <include refid="Base_Column_List" />
  ,
  <include refid="Blob_Column_List" />
  from TABLE_NAME
  <if test="sort == null or sort == ''">
    order by CREATE_TIME DESC
  if>
  <if test='sort == "new" '>
    order by CREATE_TIME DESC
  if>
  <if test='sort == "hot" '>
    and DATE_SUB(CURDATE(), INTERVAL 30 DAY) 
    order by LIKES DESC , NUM DESC , CREATE_TIME DESC
  if>

select>

你可能感兴趣的:(【数据库】)