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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.member.domain.entity.MemberCollectSpu">
            <id column="id" property="id"/>
            <id column="member_id" property="memberId"/>
            <id column="spu_id" property="spuId"/>
            <id column="spu_name" property="spuName"/>
            <id column="spu_img" property="spuImg"/>
            <id column="create_time" property="createTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,member_id,spu_id,spu_name,spu_img,create_time
    </sql>

    <!-- 分页查询会员收藏的商品内容 -->
    <select id="selectListByPage" resultType="com.mall.member.domain.vo.MemberCollectSpuVo">
        select
        <include refid="Base_Column_List"/>
        from ums_member_collect_spu
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.memberId != null and dto.memberId != ''">
                    and member_id like CONCAT('%',#{dto.memberId},'%')
                </if>
                <if test="dto.spuId != null and dto.spuId != ''">
                    and spu_id like CONCAT('%',#{dto.spuId},'%')
                </if>
                <if test="dto.spuName != null and dto.spuName != ''">
                    and spu_name like CONCAT('%',#{dto.spuName},'%')
                </if>
                <if test="dto.spuImg != null and dto.spuImg != ''">
                    and spu_img like CONCAT('%',#{dto.spuImg},'%')
                </if>
                <if test="dto.createTime != null and dto.createTime != ''">
                    and create_time like CONCAT('%',#{dto.createTime},'%')
                </if>
        </where>
    </select>

</mapper>
