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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.member.domain.entity.MemberReceiveAddress">
            <id column="id" property="id"/>
            <id column="member_id" property="memberId"/>
            <id column="name" property="name"/>
            <id column="phone" property="phone"/>
            <id column="post_code" property="postCode"/>
            <id column="province" property="province"/>
            <id column="city" property="city"/>
            <id column="region" property="region"/>
            <id column="detail_address" property="detailAddress"/>
            <id column="areacode" property="areacode"/>
            <id column="default_status" property="defaultStatus"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,member_id,name,phone,post_code,province,city,region,detail_address,areacode,default_status
    </sql>

    <!-- 分页查询会员收货地址内容 -->
    <select id="selectListByPage" resultType="com.mall.member.domain.vo.MemberReceiveAddressVo">
        select
        <include refid="Base_Column_List"/>
        from ums_member_receive_address
        <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.name != null and dto.name != ''">
                    and name like CONCAT('%',#{dto.name},'%')
                </if>
                <if test="dto.phone != null and dto.phone != ''">
                    and phone like CONCAT('%',#{dto.phone},'%')
                </if>
                <if test="dto.postCode != null and dto.postCode != ''">
                    and post_code like CONCAT('%',#{dto.postCode},'%')
                </if>
                <if test="dto.province != null and dto.province != ''">
                    and province like CONCAT('%',#{dto.province},'%')
                </if>
                <if test="dto.city != null and dto.city != ''">
                    and city like CONCAT('%',#{dto.city},'%')
                </if>
                <if test="dto.region != null and dto.region != ''">
                    and region like CONCAT('%',#{dto.region},'%')
                </if>
                <if test="dto.detailAddress != null and dto.detailAddress != ''">
                    and detail_address like CONCAT('%',#{dto.detailAddress},'%')
                </if>
                <if test="dto.areacode != null and dto.areacode != ''">
                    and areacode like CONCAT('%',#{dto.areacode},'%')
                </if>
                <if test="dto.defaultStatus != null and dto.defaultStatus != ''">
                    and default_status like CONCAT('%',#{dto.defaultStatus},'%')
                </if>
        </where>
    </select>

</mapper>
