<?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="cn.com.xingxi.store.data.mapper.WxaStoreUserAddressMapper">


    <select id="selectUserAddressListByUserId" parameterType="Long" resultType="UserAddressDTO">
        SELECT m_user_address.*, m_user_address.id as userAddressId
        FROM m_user_address
        WHERE m_user_address.delFlag = '0'
          AND m_user_address.userId = #{userId}
    </select>

    <update id="updateOtherAddressByUserId" parameterType="UserAddress">
        update m_user_address
        <trim prefix="SET" suffixOverrides=",">
            <if test="userName != null and userName != ''">userName = #{userName},</if>
            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
            <if test="provId != null">provId = #{provId},</if>
            <if test="provName != null and provName != ''">provName = #{provName},</if>
            <if test="cityId != null">cityId = #{cityId},</if>
            <if test="cityName != null and cityName != ''">cityName = #{cityName},</if>
            <if test="areaId != null">areaId = #{areaId},</if>
            <if test="areaName != null and areaName != ''">areaName = #{areaName},</if>
            <if test="address != null and address != ''">address = #{address},</if>
            <if test="defaultFlag != null and defaultFlag != ''">defaultFlag = #{defaultFlag},</if>
            <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
            <if test="updateUser != null and updateUser != ''">updateUser = #{updateUser},</if>
            <if test="updateTime != null">updateTime = #{updateTime},</if>
        </trim>
        <![CDATA[where userId = #{userId} and id <> #{id}]]>
    </update>



</mapper>
