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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.product.domain.entity.SkuImages">
            <id column="id" property="id"/>
            <id column="sku_id" property="skuId"/>
            <id column="img_url" property="imgUrl"/>
            <id column="img_sort" property="imgSort"/>
            <id column="default_img" property="defaultImg"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,sku_id,img_url,img_sort,default_img
    </sql>

    <!-- 分页查询sku图片内容 -->
    <select id="selectListByPage" resultType="com.mall.product.domain.vo.SkuImagesVo">
        select
        <include refid="Base_Column_List"/>
        from pms_sku_images
        <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.imgUrl != null and dto.imgUrl != ''">
                    and img_url like CONCAT('%',#{dto.imgUrl},'%')
                </if>
                <if test="dto.imgSort != null and dto.imgSort != ''">
                    and img_sort like CONCAT('%',#{dto.imgSort},'%')
                </if>
                <if test="dto.defaultImg != null and dto.defaultImg != ''">
                    and default_img like CONCAT('%',#{dto.defaultImg},'%')
                </if>
        </where>
    </select>

</mapper>
