Hentua
2023-04-20 929bbd74135fd867537adc18a171491b83679090
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,11 @@
                </if>
            </if>
        </where>
        order by id desc
        <if test="record.longitude != null and record.latitude != null">
            order by lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) desc
        </if>
        <if test="record.longitude == null or record.latitude == null">
            order by id desc
        </if>
    </select>
</mapper>