From bc2efbdb52190fe2e7be9920bbed6902d4ee28aa Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期五, 21 八月 2026 11:53:37 +0800
Subject: [PATCH] fix: centralize merchant type integration
---
talent-card-server/src/main/java/com/talentcard/server/mapper/DisplayServiceMapper.java | 87 ++++---------------------------------------
1 files changed, 8 insertions(+), 79 deletions(-)
diff --git a/talent-card-server/src/main/java/com/talentcard/server/mapper/DisplayServiceMapper.java b/talent-card-server/src/main/java/com/talentcard/server/mapper/DisplayServiceMapper.java
index 1533c4e..034f6e2 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/mapper/DisplayServiceMapper.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/mapper/DisplayServiceMapper.java
@@ -16,15 +16,7 @@
<script>
select m.id as merchantId,
m.merchant_name as merchantName,
- case
- when m.merchant_type = 'parking' then 'parking'
- when m.merchant_type = 'medical' then 'medical'
- when m.merchant_type = 'apartment' then 'apartment'
- when exists (select 1 from shopping_topic_merchant s1 where s1.merchant_id = m.id and s1.deleted = 0 and s1.category_key = 'housing') then 'housing'
- when exists (select 1 from shopping_topic_merchant s2 where s2.merchant_id = m.id and s2.deleted = 0 and s2.category_key = 'car') then 'car'
- when exists (select 1 from shopping_topic_merchant s3 where s3.merchant_id = m.id and s3.deleted = 0 and s3.category_key = 'appliance') then 'appliance'
- else m.merchant_type
- end as category,
+ m.merchant_type_code as category,
m.merchant_type as merchantType,
m.contact_name as contactName,
m.contact_mobile as contactMobile,
@@ -45,32 +37,9 @@
m.updated_at as updatedAt
from merchant m
where m.deleted = 0
- and (
- m.merchant_type in ('parking', 'medical', 'apartment')
- or exists (
- select 1
- from shopping_topic_merchant sm
- where sm.merchant_id = m.id
- and sm.deleted = 0
- and sm.category_key in ('housing', 'car', 'appliance')
- )
- )
+ and m.merchant_type_code in ('parking', 'medical', 'apartment', 'housing', 'car', 'appliance')
<if test="category != null and category != ''">
- <choose>
- <when test="category == 'housing' or category == 'car' or category == 'appliance'">
- and m.merchant_type = 'shopping'
- and exists (
- select 1
- from shopping_topic_merchant sm
- where sm.merchant_id = m.id
- and sm.deleted = 0
- and sm.category_key = #{category}
- )
- </when>
- <otherwise>
- and m.merchant_type = #{category}
- </otherwise>
- </choose>
+ and m.merchant_type_code = #{category}
</if>
<if test="status != null">and m.status = #{status}</if>
<if test="keyword != null and keyword != ''">
@@ -93,32 +62,9 @@
select count(*)
from merchant m
where m.deleted = 0
- and (
- m.merchant_type in ('parking', 'medical', 'apartment')
- or exists (
- select 1
- from shopping_topic_merchant sm
- where sm.merchant_id = m.id
- and sm.deleted = 0
- and sm.category_key in ('housing', 'car', 'appliance')
- )
- )
+ and m.merchant_type_code in ('parking', 'medical', 'apartment', 'housing', 'car', 'appliance')
<if test="category != null and category != ''">
- <choose>
- <when test="category == 'housing' or category == 'car' or category == 'appliance'">
- and m.merchant_type = 'shopping'
- and exists (
- select 1
- from shopping_topic_merchant sm
- where sm.merchant_id = m.id
- and sm.deleted = 0
- and sm.category_key = #{category}
- )
- </when>
- <otherwise>
- and m.merchant_type = #{category}
- </otherwise>
- </choose>
+ and m.merchant_type_code = #{category}
</if>
<if test="status != null">and m.status = #{status}</if>
<if test="keyword != null and keyword != ''">
@@ -136,15 +82,7 @@
<script>
select m.id as merchantId,
m.merchant_name as merchantName,
- case
- when m.merchant_type = 'parking' then 'parking'
- when m.merchant_type = 'medical' then 'medical'
- when m.merchant_type = 'apartment' then 'apartment'
- when exists (select 1 from shopping_topic_merchant s1 where s1.merchant_id = m.id and s1.deleted = 0 and s1.category_key = 'housing') then 'housing'
- when exists (select 1 from shopping_topic_merchant s2 where s2.merchant_id = m.id and s2.deleted = 0 and s2.category_key = 'car') then 'car'
- when exists (select 1 from shopping_topic_merchant s3 where s3.merchant_id = m.id and s3.deleted = 0 and s3.category_key = 'appliance') then 'appliance'
- else m.merchant_type
- end as category,
+ m.merchant_type_code as category,
m.merchant_type as merchantType,
m.contact_name as contactName,
m.contact_mobile as contactMobile,
@@ -166,18 +104,9 @@
from merchant m
where m.deleted = 0
and m.id = #{serviceId}
- and (
- m.merchant_type in ('parking', 'medical', 'apartment')
- or exists (
- select 1
- from shopping_topic_merchant sm
- where sm.merchant_id = m.id
- and sm.deleted = 0
- and sm.category_key in ('housing', 'car', 'appliance')
- )
- )
+ and m.merchant_type_code in ('parking', 'medical', 'apartment', 'housing', 'car', 'appliance')
limit 1
</script>
""")
Map<String, Object> selectAdminDetail(@Param("serviceId") Long serviceId);
-}
\ No newline at end of file
+}
--
Gitblit v1.7.1