From 7504b809da1a6188dfa03c06be3eb0f0a9fd0c8e Mon Sep 17 00:00:00 2001 From: zepengdev <lzpsmith@outlook.com> Date: Mon, 16 Jun 2025 21:39:25 +0800 Subject: [PATCH] fix(store):修复店铺分页查询异常 --- oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 41 insertions(+), 2 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 index 564abeb..25f5a00 100644 --- a/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml +++ b/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml @@ -28,23 +28,26 @@ <result property="geoHash" column="geo_hash"/> <result property="coordinateSystem" column="coordinate_system"/> <result property="radius" column="radius"/> + <result column="returns" property="returns"/> + <result column="self_pickup" property="selfPickup"/> <result property="createBy" column="create_by"/> <result property="createTime" column="create_time"/> <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> + <result column="version" property="version"/> </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 + address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, returns, self_pickup, create_by, create_time, update_by, update_time, version </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 + address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, returns, self_pickup, create_by, create_time, update_by, update_time, version from pc_store </sql> <select id="selectStoreList" resultMap="StoreResult"> @@ -105,4 +108,40 @@ </where> </select> + <select id="queryStoreIds" resultType="java.lang.Long"> + SELECT s.store_id AS storeId + 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)) <= #{criteria.radius} + AND ST_Distance_Sphere(POINT(#{criteria.longitude}, #{criteria.latitude}), POINT(s.longitude, + s.latitude)) <= 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> + LIMIT 1000 + </select> + + <select id="queryUserStores" parameterType="java.lang.Long" resultMap="StoreResult"> + SELECT s.* + FROM sys_user_store u INNER JOIN pc_store s ON u.store_id = s.store_id + WHERE u.user_id = #{userId} + </select> + </mapper> \ No newline at end of file -- Gitblit v1.9.3