From 4548c5045b3a5522ad14df7c939f0303c1e17587 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Sat, 11 Oct 2025 19:07:29 +0800
Subject: [PATCH] ้
้่ดน
---
oying-system/src/main/resources/mapper/sh/UserAddressMapper.xml | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/oying-system/src/main/resources/mapper/sh/UserAddressMapper.xml b/oying-system/src/main/resources/mapper/sh/UserAddressMapper.xml
index a12e793..71bfbea 100644
--- a/oying-system/src/main/resources/mapper/sh/UserAddressMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/UserAddressMapper.xml
@@ -16,6 +16,7 @@
<result column="latitude" property="latitude"/>
<result column="is_default" property="isDefault"/>
<result column="tag" property="tag"/>
+ <result column="distance" property="distance"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
@@ -34,6 +35,10 @@
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
+ <if test="criteria.longitude != null and criteria.latitude != null and criteria.longitude != '' and criteria.latitude != ''">
+ , ROUND(ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(longitude,
+ latitude)), 2) distance
+ </if>
from sh_user_address
<where>
<if test="criteria.userId != null and criteria.userId != ''">
@@ -45,10 +50,21 @@
<if test="criteria.phone != null and criteria.phone != ''">
and receiver_phone like concat('%',#{criteria.phone},'%')
</if>
+ <if test="criteria.radius != null and criteria.radius != ''">
+ and ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(longitude,
+ latitude)) distance <= #{criteria.radius}
+ </if>
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
</if>
</where>
order by address_id desc
</select>
+ <select id="getById" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ , ROUND(ST_Distance_Sphere(POINT(#{longitude}, #{latitude}), POINT(longitude, latitude)), 2) distance
+ from sh_user_address
+ where user_id = #{userId} and address_id = #{addressId}
+ </select>
</mapper>
--
Gitblit v1.9.3