Helius
2021-06-30 02b38bb7c08d68fffc6af25e4ba00a456d96e94e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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.xzx.gc.order.mapper.AddressMapper">
 
    <resultMap id="AddressMap" type="com.xzx.gc.model.user.AddressVo">
        <result column="address_id" jdbcType="INTEGER" property="addressId"/>
        <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/>
        <result column="user_id" jdbcType="VARCHAR" property="userId"/>
        <result column="province_id" jdbcType="VARCHAR" property="provinceId"/>
        <result column="city_id" jdbcType="VARCHAR" property="cityId"/>
        <result column="township_id" jdbcType="VARCHAR" property="townshipId"/>
        <result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
        <result column="address_area" jdbcType="VARCHAR" property="addressArea"/>
        <result column="stair_type" jdbcType="VARCHAR" property="stairType"/>
        <result column="rela_phone" jdbcType="VARCHAR" property="relaPhone"/>
        <result column="rela_name" jdbcType="VARCHAR" property="relaName"/>
        <result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
    </resultMap>
 
    <!-- 根据区域名称查询ID -->
    <select id="queryAreaIdByName" parameterType="java.util.Map" resultMap="AddressMap">
        select level_1_id province_id,level_2_id city_id,level_3_id township_id,citycode,adcode
        from xzx_sys_address_level_info
        where level_1_name=#{provinceName}
              and level_2_name=#{cityName} and level_3_name=#{townshipName}
    </select>
 
    <select id="queryUserAddressInfo" resultType="com.xzx.gc.model.admin.UserAddressModel">
        select * from  xzx_user_address_info
        where mobile_phone =  #{mobilePhone}
              and user_id= #{userId}
              and flag=1
        order by create_time desc limit 1
    </select>
 
    <insert id="insertUserAddress" parameterType="com.xzx.gc.model.admin.UserAddressModel">
        insert into xzx_user_address_info (mobile_phone, user_id, province_id, city_id, township_id, address_area,
                                           detail_address,longitude,latitude,flag,rela_phone,rela_name,del_flag,create_time)
        values (
            #{mobilePhone},
            #{userId}, #{provinceId}, #{cityId}, #{townshipId}, #{addressArea},#{detailAddress},#{longitude},#{latitude},1,
            #{relaPhone},#{relaName},0,SYSDATE()
        )
    </insert>
 
</mapper>