<?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.xmomen.module.member.mapper.MemberAddressMapperExt">

    <!--    查询消息    -->
    <select id="getMemberAddressModel"
            resultType="com.xmomen.module.member.model.MemberAddressModel"
            parameterType="com.xmomen.module.member.model.MemberAddressQuery">
        SELECT * FROM cd_member_address t
        <where>
            <if test="id">
                AND t.ID = #{id}
            </if>
            <if test="cdMemberId">
                AND t.cd_member_id = #{cdMemberId}
            </if>
            <if test="ids">
                AND t.ID IN
                <foreach collection="ids" item="item" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            <if test="excludeIds">
                AND t.ID NOT IN
                <foreach collection="excludeIds" item="item" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
        </where>
        ORDER BY t.id
    </select>

    <update id="updateAddressByMemberId" parameterType="java.lang.Integer">
        update
        cd_member_address
        set
        is_default = 0
        where
        cd_member_id=#{memberId}
    </update>
</mapper>