<?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.thinkgem.jeesite.modules.homepage.dao.AdvDao">

    <select id="getAdvList" resultType="com.thinkgem.jeesite.modules.homepage.entity.AdvEntity">
        SELECT a.id,
                a.code,
                a.type,
                a.title,
                a.href,
                a.target,
                a.picture,
                a.weight,
                a.status,
                a.clicks,
                a.expire_time,
                a.begin_time,
                a.created,
                a.created_user,
                a.modified,
                a.modified_user
        FROM youka_adv a
        WHERE a.status = 1
            <![CDATA[ AND (a.begin_time <= NOW() OR a.begin_time IS NULL)]]>
            <![CDATA[ AND (a.expire_time >= NOW() OR a.expire_time IS NULL)]]>
            AND a.type='A'
        ORDER BY a.weight DESC
    </select>
</mapper>