package com.zioinfo.mall.review.mapper;

import com.zioinfo.mall.review.MallReview;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ReviewMapper {
    List<MallReview> findByProduct(@Param("productId") Long productId, @Param("limit") int limit);
    MallReview findById(@Param("id") Long id);
    int insert(MallReview r);
    int delete(@Param("id") Long id, @Param("author") String author);
    int incHelpful(@Param("id") Long id);
    /** 상품 평점 통계 {avg, cnt}. */
    Map<String, Object> stats(@Param("productId") Long productId);
    int applyStats(@Param("productId") Long productId);
    List<String> recentContents(@Param("productId") Long productId, @Param("limit") int limit);
}
