<?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.mall.coupon.mapper.SkuLadderMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.coupon.domain.entity.SkuLadder">
            <id column="id" property="id"/>
            <id column="sku_id" property="skuId"/>
            <id column="full_count" property="fullCount"/>
            <id column="discount" property="discount"/>
            <id column="price" property="price"/>
            <id column="add_other" property="addOther"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,sku_id,full_count,discount,price,add_other
    </sql>

    <!-- 分页查询商品阶梯价格内容 -->
    <select id="selectListByPage" resultType="com.mall.coupon.domain.vo.SkuLadderVo">
        select
        <include refid="Base_Column_List"/>
        from sms_sku_ladder
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.skuId != null and dto.skuId != ''">
                    and sku_id like CONCAT('%',#{dto.skuId},'%')
                </if>
                <if test="dto.fullCount != null and dto.fullCount != ''">
                    and full_count like CONCAT('%',#{dto.fullCount},'%')
                </if>
                <if test="dto.discount != null and dto.discount != ''">
                    and discount like CONCAT('%',#{dto.discount},'%')
                </if>
                <if test="dto.price != null and dto.price != ''">
                    and price like CONCAT('%',#{dto.price},'%')
                </if>
                <if test="dto.addOther != null and dto.addOther != ''">
                    and add_other like CONCAT('%',#{dto.addOther},'%')
                </if>
        </where>
    </select>

</mapper>
