From 8bf923b44bbe9b45b73ddcc25df75c9c59f54e07 Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Thu, 15 Jun 2023 11:19:44 +0800
Subject: [PATCH] fix

---
 src/main/resources/mapper/modules/MallShopMapper.xml |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallShopMapper.xml b/src/main/resources/mapper/modules/MallShopMapper.xml
index fe9c97d..3a47643 100644
--- a/src/main/resources/mapper/modules/MallShopMapper.xml
+++ b/src/main/resources/mapper/modules/MallShopMapper.xml
@@ -3,7 +3,10 @@
 <mapper namespace="cc.mrbird.febs.mall.mapper.MallShopMapper">
 
     <select id="selectShopListInPage" resultType="cc.mrbird.febs.mall.entity.MallShop">
-        select * from mall_shop
+        select
+               a.*,
+               lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) distance
+        from mall_shop a
         <where>
             1=1
             <if test="record != null">
@@ -15,6 +18,28 @@
                 </if>
             </if>
         </where>
-        order by id desc
+    </select>
+
+
+    <select id="selectShopDistanceList" resultType="cc.mrbird.febs.mall.entity.MallShop">
+        select
+        a.*,
+        lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) distance
+        from mall_shop a
+        <where>
+            1=1
+            <if test="record != null">
+                <if test="record.shopName != null and record.shopName != ''">
+                    and shop_name like concat('%', concat(#{record.shopName}, '%'))
+                </if>
+                <if test="record.state != null">
+                    and state = #{record.state}
+                </if>
+            </if>
+        </where>
+        <if test="record.longitude != null and record.latitude != null">
+            order by lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) desc
+        </if>
+        limit #{page.pageNum},#{page.pageSize}
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1