shinnosuke
2026-09-27 35c0810b268661c79f776fe922f7e3834cba4186
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.talentcard.server.mapper;
 
import java.util.List;
import java.util.Map;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.talentcard.server.entity.TransportCarWashService;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
@Mapper
public interface TransportCarWashServiceMapper extends BaseMapper<TransportCarWashService> {
 
    @Select("""
            select m.id as merchantId,
                   m.merchant_name as merchantName,
                   m.contact_mobile as contactMobile,
                   m.address,
                   m.cover_url as coverUrl,
                   m.status as merchantStatus,
                   s.id as configId,
                   s.external_link_type as externalLinkType,
                   s.external_mini_program_app_id as externalMiniProgramAppId,
                   s.external_mini_program_path as externalMiniProgramPath,
                   s.external_web_url as externalWebUrl,
                   s.status as serviceStatus,
                   s.updated_at as updatedAt
            from merchant m
            left join transport_car_wash_service s on s.merchant_id = m.id and s.deleted = 0
            where m.deleted = 0
              and m.merchant_type_code = 'carWash'
              and (#{keyword} is null or #{keyword} = '' or m.merchant_name like concat('%', #{keyword}, '%')
                   or m.address like concat('%', #{keyword}, '%') or m.contact_mobile like concat('%', #{keyword}, '%'))
              and (#{merchantId} is null or m.id = #{merchantId})
            order by m.sort_no desc, m.created_at desc, m.id desc
            limit #{size} offset #{offset}
            """)
    List<Map<String, Object>> selectConfigPage(@Param("merchantId") Long merchantId,
                                               @Param("keyword") String keyword,
                                               @Param("size") int size,
                                               @Param("offset") int offset);
 
    @Select("""
            select count(*)
            from merchant m
            where m.deleted = 0
              and m.merchant_type_code = 'carWash'
              and (#{keyword} is null or #{keyword} = '' or m.merchant_name like concat('%', #{keyword}, '%')
                   or m.address like concat('%', #{keyword}, '%') or m.contact_mobile like concat('%', #{keyword}, '%'))
              and (#{merchantId} is null or m.id = #{merchantId})
            """)
    Long countConfigPage(@Param("merchantId") Long merchantId, @Param("keyword") String keyword);
 
    @Select("""
            select m.id as merchantId,
                   m.merchant_name as merchantName,
                   m.contact_mobile as contactMobile,
                   m.address,
                   m.cover_url as coverUrl,
                   m.status as merchantStatus,
                   s.id as configId,
                   s.external_link_type as externalLinkType,
                   s.external_mini_program_app_id as externalMiniProgramAppId,
                   s.external_mini_program_path as externalMiniProgramPath,
                   s.external_web_url as externalWebUrl,
                   s.status as serviceStatus,
                   s.updated_at as updatedAt
            from merchant m
            left join transport_car_wash_service s on s.merchant_id = m.id and s.deleted = 0
            where m.deleted = 0
              and m.merchant_type_code = 'carWash'
              and m.id = #{merchantId}
            limit 1
            """)
    Map<String, Object> selectConfigDetail(@Param("merchantId") Long merchantId);
 
    @Select("""
            select m.id as merchantId,
                   m.merchant_name as merchantName,
                   m.status as merchantStatus,
                   s.id as configId,
                   s.external_link_type as externalLinkType,
                   s.external_mini_program_app_id as externalMiniProgramAppId,
                   s.external_mini_program_path as externalMiniProgramPath,
                   s.external_web_url as externalWebUrl,
                   s.unavailable_reason as unavailableReason,
                   s.status as serviceStatus,
                   s.updated_at as updatedAt
            from merchant m
            left join transport_car_wash_service s on s.merchant_id = m.id and s.deleted = 0
            where m.deleted = 0
              and m.merchant_type_code = 'carWash'
              and m.id = #{merchantId}
            limit 1
            """)
    Map<String, Object> selectPortalJumpConfig(@Param("merchantId") Long merchantId);
 
    @Select("""
            select count(*)
            from merchant
            where deleted = 0 and merchant_type_code = 'carWash' and id = #{merchantId}
            """)
    Long countCarWashMerchant(@Param("merchantId") Long merchantId);
}