package com.ruoyi.web.modules.farming.mapper;

import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.web.modules.farming.domain.BizServiceAppointmentReview;

/**
 * 服务预约评价 Mapper。
 */
public interface BizServiceAppointmentReviewMapper
{
    List<BizServiceAppointmentReview> selectReviewListByAppointmentId(@Param("appointmentId") Long appointmentId);

    BizServiceAppointmentReview selectLatestReviewByAppointmentId(@Param("appointmentId") Long appointmentId);

    List<BizServiceAppointmentReview> selectReviewListByExpertProviderId(@Param("providerId") Long providerId);

    int countByAppointmentId(@Param("appointmentId") Long appointmentId);

    int insertBizServiceAppointmentReview(BizServiceAppointmentReview row);

    /**
     * 专家评分：(三项星级各自求和后相加) / 3。
     */
    BigDecimal selectExpertRatingScoreByProviderId(@Param("providerId") Long providerId);

    /** 存在预约评价的专家资源 ID（用于定时同步 expert_rating）。 */
    List<Long> selectExpertProviderIdsForRatingSync();
}
