From d93356927d8a0a5a91963c28d461d9107562d759 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Fri, 30 May 2025 17:38:26 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/xin' --- oying-system/src/main/resources/mapper/pc/search/SearchMapper.xml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/resources/mapper/pc/search/SearchMapper.xml b/oying-system/src/main/resources/mapper/pc/search/SearchMapper.xml new file mode 100644 index 0000000..3c8bb8d --- /dev/null +++ b/oying-system/src/main/resources/mapper/pc/search/SearchMapper.xml @@ -0,0 +1,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)) <= #{criteria.radius} + AND ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(s.longitude, s.latitude)) <= 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> \ No newline at end of file -- Gitblit v1.9.3