247 lines
8.4 KiB
XML
247 lines
8.4 KiB
XML
|
<?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.zhwl.wcsc.mapper.ZdyWcscUserAddressMapper">
|
||
|
|
||
|
<resultMap type="ZdyWcscUserAddress" id="ZdyWcscUserAddressResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="isDefault" column="is_default"/>
|
||
|
<result property="userId" column="user_id"/>
|
||
|
<result property="consignee" column="consignee"/>
|
||
|
<result property="phone" column="phone"/>
|
||
|
<result property="provinceName" column="province_name"/>
|
||
|
<result property="cityName" column="city_name"/>
|
||
|
<result property="areaName" column="area_name"/>
|
||
|
<result property="address" column="address"/>
|
||
|
<result property="provinceId" column="province_id"/>
|
||
|
<result property="cityId" column="city_id"/>
|
||
|
<result property="areaId" column="area_id"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="deletetime" column="deletetime"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<result property="consigneeSex" column="consignee_sex"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyWcscUserAddressVo">
|
||
|
SELECT id,
|
||
|
user_id,
|
||
|
consignee,
|
||
|
phone,
|
||
|
province_name,
|
||
|
city_name,
|
||
|
area_name,
|
||
|
address,
|
||
|
province_id,
|
||
|
city_id,
|
||
|
area_id,
|
||
|
create_time,
|
||
|
update_time,
|
||
|
deletetime,
|
||
|
create_by,
|
||
|
update_by,
|
||
|
consignee_sex,
|
||
|
is_default
|
||
|
FROM zdy_wcsc_user_address
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyWcscUserAddressList" parameterType="ZdyWcscUserAddress" resultMap="ZdyWcscUserAddressResult">
|
||
|
<include refid="selectZdyWcscUserAddressVo"/>
|
||
|
<where>
|
||
|
ISNULL(deletetime)
|
||
|
<if test="userId != null ">
|
||
|
and user_id = #{userId}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyWcscUserAddressById" parameterType="Long"
|
||
|
resultMap="ZdyWcscUserAddressResult">
|
||
|
<include refid="selectZdyWcscUserAddressVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyWcscUserAddress" parameterType="ZdyWcscUserAddress" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_wcsc_user_address
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id,
|
||
|
</if>
|
||
|
<if test="consignee != null">consignee,
|
||
|
</if>
|
||
|
<if test="phone != null">phone,
|
||
|
</if>
|
||
|
<if test="provinceName != null">province_name,
|
||
|
</if>
|
||
|
<if test="cityName != null">city_name,
|
||
|
</if>
|
||
|
<if test="areaName != null">area_name,
|
||
|
</if>
|
||
|
<if test="address != null">address,
|
||
|
</if>
|
||
|
<if test="provinceId != null">province_id,
|
||
|
</if>
|
||
|
<if test="cityId != null">city_id,
|
||
|
</if>
|
||
|
<if test="areaId != null">area_id,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="deletetime != null">deletetime,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
<if test="consigneeSex != null">consignee_sex,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">#{userId},
|
||
|
</if>
|
||
|
<if test="consignee != null">#{consignee},
|
||
|
</if>
|
||
|
<if test="phone != null">#{phone},
|
||
|
</if>
|
||
|
<if test="provinceName != null">#{provinceName},
|
||
|
</if>
|
||
|
<if test="cityName != null">#{cityName},
|
||
|
</if>
|
||
|
<if test="areaName != null">#{areaName},
|
||
|
</if>
|
||
|
<if test="address != null">#{address},
|
||
|
</if>
|
||
|
<if test="provinceId != null">#{provinceId},
|
||
|
</if>
|
||
|
<if test="cityId != null">#{cityId},
|
||
|
</if>
|
||
|
<if test="areaId != null">#{areaId},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="deletetime != null">#{deletetime},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
<if test="consigneeSex != null">#{consigneeSex},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyWcscUserAddress" parameterType="ZdyWcscUserAddress">
|
||
|
update zdy_wcsc_user_address
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id =
|
||
|
#{userId},
|
||
|
</if>
|
||
|
<if test="isDefault != null">is_default =
|
||
|
#{isDefault},
|
||
|
</if>
|
||
|
<if test="consignee != null">consignee =
|
||
|
#{consignee},
|
||
|
</if>
|
||
|
<if test="phone != null">phone =
|
||
|
#{phone},
|
||
|
</if>
|
||
|
<if test="provinceName != null">province_name =
|
||
|
#{provinceName},
|
||
|
</if>
|
||
|
<if test="cityName != null">city_name =
|
||
|
#{cityName},
|
||
|
</if>
|
||
|
<if test="areaName != null">area_name =
|
||
|
#{areaName},
|
||
|
</if>
|
||
|
<if test="address != null">address =
|
||
|
#{address},
|
||
|
</if>
|
||
|
<if test="provinceId != null">province_id =
|
||
|
#{provinceId},
|
||
|
</if>
|
||
|
<if test="cityId != null">city_id =
|
||
|
#{cityId},
|
||
|
</if>
|
||
|
<if test="areaId != null">area_id =
|
||
|
#{areaId},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="deletetime != null">deletetime =
|
||
|
#{deletetime},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
<if test="consigneeSex != null">consignee_sex =
|
||
|
#{consigneeSex},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<update id="updateZdyWcscUserDefaultAddress" parameterType="Long">
|
||
|
update zdy_wcsc_user_address set is_default = 0 where user_id = #{userId}
|
||
|
</update>
|
||
|
|
||
|
|
||
|
<delete id="deleteZdyWcscUserAddressById" parameterType="Long">
|
||
|
update zdy_wcsc_user_address
|
||
|
set deletetime = sysdate()
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyWcscUserAddressByIds" parameterType="String">
|
||
|
update zdy_wcsc_user_address set deletetime = sysdate() where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
<select id="queryCustomerAddressById" resultMap="ZdyWcscUserAddressResult">
|
||
|
select *
|
||
|
from zdy_wcsc_user_address
|
||
|
where id = #{id}
|
||
|
and user_id = #{userId}
|
||
|
limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="queryCustomerDefaultChosenAddress" parameterType="java.lang.Long" resultMap="ZdyWcscUserAddressResult">
|
||
|
SELECT id,
|
||
|
is_default,
|
||
|
user_id,
|
||
|
consignee,
|
||
|
phone,
|
||
|
province_name,
|
||
|
city_name,
|
||
|
area_name,
|
||
|
address,
|
||
|
province_id,
|
||
|
city_id,
|
||
|
area_id
|
||
|
from zdy_wcsc_user_address
|
||
|
WHERE user_id = #{userId} AND is_default = 1 AND ISNULL(deletetime)
|
||
|
Limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="queryCustomerAddressList" parameterType="java.lang.Long" resultMap="ZdyWcscUserAddressResult">
|
||
|
<include refid="selectZdyWcscUserAddressVo"/>
|
||
|
where user_id = #{userId} and ISNULL(deletetime)
|
||
|
</select>
|
||
|
|
||
|
|
||
|
</mapper>
|