From b394df082b875856884d6d02cce2a43c49ad6704 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 30 May 2025 16:44:46 +0800
Subject: [PATCH] Merge branch 'feature/pc-base' into xin

---
 oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml b/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml
new file mode 100644
index 0000000..564abeb
--- /dev/null
+++ b/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml
@@ -0,0 +1,108 @@
+<?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="StoreResult" 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="storeType" column="store_type"/>
+        <result property="storeCode" column="store_code"/>
+        <result property="storeName" column="store_name"/>
+        <result property="businessScope" column="business_scope"/>
+        <result property="status" column="status"/>
+        <result property="logoImageId" column="logo_image_id"/>
+        <result property="coverImageId" column="cover_image_id"/>
+        <result property="description" column="description"/>
+        <result property="tags" column="tags"/>
+        <result property="deliveryFee" column="delivery_fee"/>
+        <result property="deliveryMinimum" column="delivery_minimum"/>
+        <result property="contactPhone" column="contact_phone"/>
+        <result property="openTime" column="open_time"/>
+        <result property="closeTime" column="close_time"/>
+        <result property="address" column="address"/>
+        <result property="longitude" column="longitude"/>
+        <result property="latitude" column="latitude"/>
+        <result property="geoHash" column="geo_hash"/>
+        <result property="coordinateSystem" column="coordinate_system"/>
+        <result property="radius" column="radius"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="store_column_list">
+        store_id, merchant_id, platform_category_id, store_type, store_code, store_name, business_scope, status, logo_image_id,
+        cover_image_id, description, tags, delivery_fee, delivery_minimum, contact_phone, open_time, close_time,
+        address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, create_by, create_time, update_by, update_time
+    </sql>
+
+    <sql id="selectStoreVo">
+        select
+        store_id, merchant_id, platform_category_id, store_type, store_code, store_name, business_scope, status, logo_image_id,
+        cover_image_id, description, tags, delivery_fee, delivery_minimum, contact_phone, open_time, close_time,
+        address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, create_by, create_time, update_by, update_time from pc_store
+    </sql>
+
+    <select id="selectStoreList" resultMap="StoreResult">
+        <include refid="selectStoreVo"/>
+        <where>
+            <if test="criteria.merchantId != null ">and merchant_id = #{criteria.merchantId}</if>
+            <if test="criteria.storeName != null and criteria.storeName != ''">
+                and store_name like concat('%', #{criteria.storeName}, '%')
+            </if>
+            <if test="criteria.status != null ">and status = #{criteria.status}</if>
+        </where>
+    </select>
+
+    <select id="selectStoreByMerchantId" resultMap="StoreResult">
+        <include refid="selectStoreVo"/>
+        where merchant_id = #{merchantId}
+    </select>
+
+    <select id="queryNearStores" resultType="com.oying.modules.pc.search.domain.dto.StoreSearchDto">
+        SELECT
+        <trim prefix="" suffix="" suffixOverrides=",">
+            s.store_id AS storeId,
+            s.store_name AS storeName,
+            s.logo_image AS logoImage,
+            <!--<if test="criteria.longitude != null and criteria.latitude != null and criteria.radius != null">
+                ST_Distance_Sphere(
+                    POINT(#{criteria.longitude}, #{criteria.latitude}),
+                    POINT(s.longitude, s.latitude)
+                ) AS distance,</if>
+            <if test="criteria.blurry != null and criteria.blurry != ''">
+                MATCH(s.store_name) AGAINST(#{criteria.blurry}) AS matchScore
+            </if>-->
+        </trim>
+        FROM pc_store s
+        <where>
+            <!-- 位置条件 -->
+            <if test="criteria.longitude != null and criteria.latitude != null and criteria.radius != null">
+                AND 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
+            </if>
+
+            <!-- 店铺名称模糊查询 AND s.name LIKE CONCAT('%', #{criteria.blurry}, '%') -->
+            <if test="criteria.blurry != null and criteria.blurry != ''">
+                AND MATCH(s.store_name) AGAINST(#{criteria.blurry} IN NATURAL LANGUAGE MODE)
+            </if>
+
+            <!-- 营业状态 -->
+            <if test="criteria.status != null">
+                AND s.status = #{criteria.status}
+            </if>
+
+            <!-- 类目ID -->
+            <if test="criteria.platformCategoryId != null">
+                AND s.platform_category_id = #{criteria.platformCategoryId}
+            </if>
+        </where>
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3