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 { @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> 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 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 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); }