package com.tourguide.modules.order.mapper;
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.tourguide.modules.order.entity.TourOrder;
|
import com.tourguide.modules.order.dto.GuideTodayStatsResponse;
|
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Update;
|
import java.util.List;
|
|
public interface TourOrderMapper extends BaseMapper<TourOrder> {
|
@Select("SELECT COUNT(*) AS today_order_count, COALESCE(SUM(people_count), 0) AS today_people_count " +
|
"FROM tour_order WHERE deleted = 0 AND guide_id = #{guideId} " +
|
"AND accepted_at >= CURDATE() AND accepted_at < DATE_ADD(CURDATE(), INTERVAL 1 DAY) " +
|
"AND status NOT IN ('CANCELLED', 'REFUNDED')")
|
GuideTodayStatsResponse selectGuideTodayStats(Long guideId);
|
|
@Select("SELECT DISTINCT scenic_name FROM tour_order WHERE deleted = 0 AND scenic_name IS NOT NULL AND scenic_name <> '' ORDER BY scenic_name")
|
List<String> selectScenicOptions();
|
|
@Update("UPDATE tour_order SET status = 'CANCELLED', refund_status = 'REFUNDING', updated_at = NOW() " +
|
"WHERE id = #{id} AND deleted = 0 AND status = 'PENDING_ACCEPT' " +
|
"AND payment_time IS NOT NULL AND (refund_status IS NULL OR refund_status = 'NONE')")
|
int claimUnacceptedOrderForRefund(Long id);
|
}
|