<?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.hzs.system.config.mapper.BdAdvertBannerMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.config.BdAdvertBanner">
        <id column="PK_ID" property="pkId" />
    <result column="DEL_FLAG" property="delFlag" />
    <result column="PK_COUNTRY" property="pkCountry" />
    <result column="CREATION_TIME" property="creationTime" />
    <result column="MODIFIED_TIME" property="modifiedTime" />
    <result column="PK_CREATOR" property="pkCreator" />
    <result column="PK_MODIFIED" property="pkModified" />
        <result column="POSITION" property="position" />
        <result column="EFFECTIVE_DATE" property="effectiveDate" />
        <result column="SORT" property="sort" />
        <result column="PICTURE" property="picture" />
        <result column="LINK" property="link" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        PK_COUNTRY,
        CREATION_TIME,
        MODIFIED_TIME,
        PK_CREATOR,
        PK_MODIFIED,
        PK_ID, POSITION, EFFECTIVE_DATE, SORT, PICTURE, LINK
    </sql>
    <select id="getList" resultType="com.hzs.common.domain.system.config.BdAdvertBanner">
        select bab.*, bv.VERTEX_NAME as vertexName from BD_ADVERT_BANNER bab
        left join BD_VERTEX bv on bv.pk_id = bab.PK_VERTEX
        where 1=1
        <if test="param.position != null">
            and bab.position = #{position}
        </if>
        <if test="param.startDate != null and param.endDate != null">
            and bab.CREATION_TIME between #{param.startDate} and #{param.endDate}
        </if>
        <if test="param.startEffectiveDate != null and param.endEffectiveDate != null">
            and bab.effectiveDate between #{param.startEffectiveDate} and #{param.endEffectiveDate}
        </if>
        <if test="param.pkVertex != null">
            and bab.PK_VERTEX = #{param.pkVertex}
        </if>
        and bab.del_flag = 0
        order by bab.sort asc
    </select>

</mapper>
