<?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.product.mapper.SkuSaleAttrValueMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.product.domain.entity.SkuSaleAttrValueEntity">
        <id column="id" property="id"/>
        <id column="sku_id" property="skuId"/>
        <id column="attr_id" property="attrId"/>
        <id column="attr_name" property="attrName"/>
        <id column="attr_value" property="attrValue"/>
        <id column="attr_sort" property="attrSort"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,sku_id,attr_id,attr_name,attr_value,attr_sort
    </sql>

    <!-- 分页查询sku销售属性&值内容 -->
    <select id="selectListByPage" resultType="com.mall.product.domain.vo.SkuSaleAttrValueVo">
        select
        <include refid="Base_Column_List"/>
        from pms_sku_sale_attr_value
        <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.attrId != null and dto.attrId != ''">
                and attr_id like CONCAT('%',#{dto.attrId},'%')
            </if>
            <if test="dto.attrName != null and dto.attrName != ''">
                and attr_name like CONCAT('%',#{dto.attrName},'%')
            </if>
            <if test="dto.attrValue != null and dto.attrValue != ''">
                and attr_value like CONCAT('%',#{dto.attrValue},'%')
            </if>
            <if test="dto.attrSort != null and dto.attrSort != ''">
                and attr_sort like CONCAT('%',#{dto.attrSort},'%')
            </if>
        </where>
    </select>

</mapper>
