<?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.cf.imes.module.system.dal.mysql.funds.advertisement.AdvertisementMapper">


    <update id="updateAdStatusIsPublish">

        update advertisement
                set stats = 1
            where deleted = false
              and start_time = #{now}
              and status = #{status}

    </update>


    <update id="updateAdStatusIsEndPublished">


        update advertisement
                set stats = 2
            where deleted = false
              and end_time = #{now}
              and status = #{status}

    </update>



    <select id="selectAdList"
            resultType="com.cf.imes.module.system.controller.admin.funds.advertisement.vo.AdvertisementRespVO">


        select id,
               ad_image_path,
               sort,
               ad_redirect_url

        from advertisement

        where  deleted = false
          and ad_image_path like concat('%', #{adPosition},'%')
          and status = #{status}
          and start_time &lt;= #{now}
          and end_time &gt;= #{now}
        order by sort desc , update_time desc


    </select>


</mapper>