<?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.member.storeconfig.mapper.BdStoreMonthCheckConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.member.storeconfig.BdStoreMonthCheckConfig">
        <id column="PK_ID" property="pkId" />
    <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="DEL_FLAG" property="delFlag" />
    <result column="PK_COUNTRY" property="pkCountry" />
        <result column="PK_STORE" property="pkStore" />
        <result column="START_DATE" property="startDate" />
        <result column="END_DATE" property="endDate" />
        <result column="MONEY" property="money" />
        <result column="ACHIEVE" property="achieve" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        CREATION_TIME,
        MODIFIED_TIME,
        PK_CREATOR,
        PK_MODIFIED,
        DEL_FLAG,
        PK_COUNTRY,
        PK_ID, PK_STORE, START_DATE, END_DATE, MONEY, ACHIEVE
    </sql>

    <select id="selectByList"  resultType="com.hzs.member.storeconfig.vo.StoreMonthCheckConfigVo">
        select cc.*,cs.STORE_NAME storeName  from BD_STORE_MONTH_CHECK_CONFIG cc
        left join CU_STORE cs on cs.PK_ID = cc.PK_STORE
        where  1 = 1
        <if test="pkCountry != null">
            and cc.PK_COUNTRY = #{pkCountry}
        </if>
        <if test="beginStartDate != null">
            and cc.START_DATE &gt;= #{beginStartDate}
        </if>
        <if test="endStartDate != null">
            and cc.START_DATE &lt;= #{endStartDate}
        </if>

        <if test="beginEndDate != null">
            and cc.END_DATE &gt;= #{beginEndDate}
        </if>
        <if test="endEndDate != null">
            and cc.END_DATE &lt;= #{endEndDate}
        </if>
        <if test="storeName != null and storeName != ''">
            and cs.STORE_NAME like '%' || #{storeName} || '%'
        </if>
and cc.del_flag= 0  order by cc.CREATION_TIME desc
    </select>

</mapper>
