<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iotechn.unimall.data.mapper.AdvertisementMapper">


    <select id="getAdvertisementByTypeAndStatus" resultType="com.iotechn.unimall.data.domain.AdvertisementDO">
        select
          id,
          ad_type as adType,
          title,
          url,
          img_url as imgUrl,
          status,
          gmt_create as gmtCreate,
          gmt_update as gmtUpdate
        from
        unimall_advertisement a
        where
        a.status = #{status}
        AND
        a.ad_type = #{adType}
        limit #{offset},#{size}
    </select>

    <select id="getAllAdvertisement" resultType="com.iotechn.unimall.data.domain.AdvertisementDO">
        select
          id,
          ad_type as adType,
          title,
          url,
          img_url as imgUrl,
          status,
          gmt_create as gmtCreate,
          gmt_update as gmtUpdate

        from
        unimall_advertisement a
        limit #{offset},#{size}
    </select>


</mapper>