fix
Hentua
2023-04-25 b0b794718f9604414ad249c20ed2282106d95e11
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
<?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="cc.mrbird.febs.mall.mapper.MallShopMapper">
 
    <select id="selectShopListInPage" 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>
    </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>