<?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.MemberPriceMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.coupon.domain.entity.MemberPrice">
            <id column="id" property="id"/>
            <id column="sku_id" property="skuId"/>
            <id column="member_level_id" property="memberLevelId"/>
            <id column="member_level_name" property="memberLevelName"/>
            <id column="member_price" property="memberPrice"/>
            <id column="add_other" property="addOther"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,sku_id,member_level_id,member_level_name,member_price,add_other
    </sql>

    <!-- 分页查询商品会员价格内容 -->
    <select id="selectListByPage" resultType="com.mall.coupon.domain.vo.MemberPriceVo">
        select
        <include refid="Base_Column_List"/>
        from sms_member_price
        <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.memberLevelId != null and dto.memberLevelId != ''">
                    and member_level_id like CONCAT('%',#{dto.memberLevelId},'%')
                </if>
                <if test="dto.memberLevelName != null and dto.memberLevelName != ''">
                    and member_level_name like CONCAT('%',#{dto.memberLevelName},'%')
                </if>
                <if test="dto.memberPrice != null and dto.memberPrice != ''">
                    and member_price like CONCAT('%',#{dto.memberPrice},'%')
                </if>
                <if test="dto.addOther != null and dto.addOther != ''">
                    and add_other like CONCAT('%',#{dto.addOther},'%')
                </if>
        </where>
    </select>

</mapper>
