zepengdev
2025-05-30 2dd51502c00f9abd30c61ded7de025aecba0e88c
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
46
47
48
49
50
51
52
53
54
55
56
<?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="com.oying.modules.pc.store.mapper.StoreMapper">
<!--
    <resultMap id="storeWithProductResultMap" type="com.oying.modules.pc.store.domain.Store">
        <result property="storeId" column="store_id"/>
        <result property="merchantId" column="merchant_id"/>
        <result property="platformCategoryId" column="platform_category_id"/>
        <result property="storeName" column="store_name"/>
        <result property="description" column="description"/>
        <result property="deliveryFee" column="delivery_fee"/>
        <result property="deliveryMinimum" column="delivery_minimum"/>
        <result property="contactPhone" column="contact_phone"/>
        <collection property="products" ofType="Product">
            <id column="product_id" property="productId"/>
            <result column="store_id" property="storeId"/>
            <result column="title" property="title"/>
            <result column="status" property="status"/>
            <result column="description" property="description"/>
            <result column="price" property="price"/>
            <result column="stock_quantity" property="stockQuantity"/>
            <result column="min_purchase_quantity" property="minPurchaseQuantity"/>
            <result column="warn_stock" property="warnStock"/>
            <result column="weight" property="weight"/>
            <result column="version" property="version"/>
        </collection>
    </resultMap>
 
    <select id="queryNearStoreWithProduct" resultMap="storeWithProductResultMap">
        SELECT
        s.store_id AS storeId,
        s.store_name AS storeName,
        s.logo_image_id AS logoImageId,
        ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(s.longitude, s.latitude)) AS distance,
        MATCH(s.store_name) AGAINST(#{criteria.blurry}) AS storeNameMatchScore
        FROM pc_store s inner join pc_product p ON s.store_id = p.product_id
        WHERE
        ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(s.longitude, s.latitude)) &lt;= #{criteria.radius}
        AND ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(s.longitude, s.latitude)) &lt;= s.radius
        AND s.status = 1000
        AND p.status in (1000, 1001, 1002)
        AND p.deleted_flag = 0
        AND CURRENT_TIME() BETWEEN s.open_time AND s.close_time
        <choose>
            <when test="criteria.blurry != null and criteria.blurry != ''">
                AND (MATCH(s.store_name) AGAINST(#{criteria.blurry} IN NATURAL LANGUAGE MODE) OR MATCH(p.title) AGAINST(#{criteria.blurry} IN NATURAL LANGUAGE MODE))
            </when>
            <otherwise>
 
            </otherwise>
        </choose>
    </select>-->
 
</mapper>