select a.*,b.level_1_name provinceName,b.level_2_name cityName,
b.level_3_name townshipName,c.config_value_name stairTypeName
from xzx_user_address_info a
left OUTER join xzx_sys_address_level_info b on a.province_id=b.level_1_id and a.city_id=b.level_2_id and a.township_id=b.level_3_id
left OUTER join xzx_sys_config_info c on a.stair_type=c.config_value and c.config_type_code='STAIR_TYPE'
where 1=1 and a.del_flag='0'
and a.address_id=#{addressId}
and a.user_id=#{userId}
select level_1_id province_id,level_2_id city_id,level_3_id township_id,citycode,adcode,pcode
from xzx_sys_address_level_info
where level_1_name=#{provinceName}
and level_2_name=#{cityName} and level_3_name=#{townshipName}
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_id=#{provinceId}
and level_2_id=#{cityId} and level_3_id=#{townshipId}
update xzx_user_address_info
set flag="0"
where mobile_phone=#{mobilePhone} and address_id!=#{addressId}
update
xzx_user_address_info
set
del_flag="1"
where
address_id=#{addressId}
update
xzx_user_address_info a
set
a.flag="1"
where
a.address_id =
(
select c.minid from (select min(b.address_id) as minid
from xzx_user_address_info b where b.del_flag='0' and b.user_id=#{userId})c)
SELECT address_area as addressArea,del_flag as delFlag,flag,create_time as createTime
,township_id as townShipId, detail_address as detailAddress ,latitude ,longitude,rela_name as relaName,
address_id as addressId,rela_phone as relaPhone ,user_id as userId FROM xzx_user_address_info
WHERE mobile_phone=#{phone} and user_id=#{userId} and del_flag = 0