|
@@ -0,0 +1,121 @@
|
|
|
|
+<?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.ygj.yuemum.dao.wxmini.WXUserAddressDao">
|
|
|
|
+
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.wxmini.WXUserAddress">
|
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER"/>
|
|
|
|
+ <result column="xu_openid" property="xu_openid" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_phone" property="xa_phone" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_consignee" property="xa_consignee" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_city" property="xa_city" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_county" property="xa_county" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_address" property="xa_address" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="xa_default" property="xa_default" jdbcType="INTEGER"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <!--获取所有数据-->
|
|
|
|
+ <select id="getWXUserAddress" resultType="com.ygj.yuemum.domain.wxmini.WXUserAddress" parameterType="java.lang.String">
|
|
|
|
+ select
|
|
|
|
+ id,xu_openid,xa_phone,xa_consignee,xa_city,xa_county,xa_address,xa_default
|
|
|
|
+ from wx_user_address
|
|
|
|
+ where xu_openid = #{xu_openid,jdbcType=VARCHAR}
|
|
|
|
+ order by xa_default desc,id asc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getWXUserAddressCount" resultType="java.lang.Integer" parameterType="java.lang.String">
|
|
|
|
+ select
|
|
|
|
+ count(1)
|
|
|
|
+ from wx_user_address
|
|
|
|
+ where xu_openid = #{xu_openid,jdbcType=VARCHAR}
|
|
|
|
+ order by xa_default desc,id asc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="insertWXUserAddress" parameterType="com.ygj.yuemum.domain.wxmini.WXUserAddress" >
|
|
|
|
+ insert into wx_user_address
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
|
+ <if test="xu_openid != null" >
|
|
|
|
+ xu_openid,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_phone != null" >
|
|
|
|
+ xa_phone,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_consignee != null" >
|
|
|
|
+ xa_consignee,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_city != null" >
|
|
|
|
+ xa_city,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_county != null" >
|
|
|
|
+ xa_county,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_address != null" >
|
|
|
|
+ xa_address,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_default != null" >
|
|
|
|
+ xa_default
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
|
+ <if test="xu_openid != null" >
|
|
|
|
+ #{xu_openid,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_phone != null" >
|
|
|
|
+ #{xa_phone,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_consignee != null" >
|
|
|
|
+ #{xa_consignee,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_city != null" >
|
|
|
|
+ #{xa_city,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_county != null" >
|
|
|
|
+ #{xa_county,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_address != null" >
|
|
|
|
+ #{xa_address,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_default != null" >
|
|
|
|
+ #{xa_default,jdbcType=INTEGER},
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="updateWXUserAddress" parameterType="com.ygj.yuemum.domain.wxmini.WXUserAddress" >
|
|
|
|
+ update wx_user_address
|
|
|
|
+ <set >
|
|
|
|
+ <if test="xu_openid != null" >
|
|
|
|
+ xu_openid = #{xu_openid,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_phone != null" >
|
|
|
|
+ xa_phone = #{xa_phone,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_consignee != null" >
|
|
|
|
+ xa_consignee = #{xa_consignee,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_city != null" >
|
|
|
|
+ xa_city = #{xa_city,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_county != null" >
|
|
|
|
+ xa_county = #{xa_county,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_address != null" >
|
|
|
|
+ xa_address = #{xa_address,jdbcType=VARCHAR},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="xa_default != null" >
|
|
|
|
+ xa_default = #{xa_default,jdbcType=INTEGER}
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <update id="updateWXUserDefAddress" parameterType="java.lang.Integer" >
|
|
|
|
+ update wx_user_address
|
|
|
|
+ set xa_default = if( id = #{id,jdbcType=INTEGER},1,0)
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteWXUserDefAddress" parameterType="java.lang.Integer">
|
|
|
|
+ delete from wx_user_address
|
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
|
+ </delete>
|
|
|
|
+</mapper>
|