<?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="org.springblade.modules.platform.mapper.AdsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="adsResultMap" type="org.springblade.modules.platform.entity.Ads">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="title" property="title"/>
        <result column="sort" property="sort"/>
        <result column="type" property="type"/>
        <result column="start_time" property="startTime"/>
        <result column="end_time" property="endTime"/>
        <result column="is_enabled" property="isEnabled"/>
        <result column="target_url" property="targetUrl"/>
        <result column="image_url" property="imageUrl"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>


    <select id="selectAdsPage" resultMap="adsResultMap">
        select * from t_ads
    </select>

    <select id="selectAdsList" resultMap="adsResultMap">
        select * from t_ads where type = #{type} and is_enabled = 2 order by sort limit #{limit}
    </select>

</mapper>
