xiangpei
2025-05-27 f2cc79e9e83aafacc1af0e2c86e3c8df384fc895
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
package cn.lili.modules.statistics.mapper;
 
import cn.lili.modules.member.entity.dos.MemberEvaluation;
import cn.lili.modules.member.entity.vo.MemberEvaluationListVO;
import cn.lili.modules.member.entity.vo.StoreRatingVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
import java.util.Map;
 
/**
 * 会员商品评价数据处理层
 *
 * @author Bulbasaur
 * @since 2020-02-25 14:10:16
 */
public interface MemberEvaluationStatisticsMapper extends BaseMapper<MemberEvaluation> {
 
 
    /**
     * 会员评价分页
     *
     * @param page         分页
     * @param queryWrapper 查询条件
     * @return 会员评价分页
     */
    @Select("select me.* from li_member_evaluation as me ${ew.customSqlSegment}")
    IPage<MemberEvaluationListVO> getMemberEvaluationList(IPage<MemberEvaluationListVO> page, @Param(Constants.WRAPPER) Wrapper<MemberEvaluationListVO> queryWrapper);
 
    /**
     * 评价数量
     *
     * @param goodsId 商品ID
     * @return 会员评价
     */
    @Select("select grade,count(1) as num from li_member_evaluation Where goods_id=#{goodsId} and status='OPEN' GROUP BY grade")
    List<Map<String, Object>> getEvaluationNumber(String goodsId);
 
    /**
     * 获取店铺评分
     *
     * @param queryWrapper 查询条件
     * @return 店铺评分
     */
    @Select("SELECT round( AVG( delivery_score ), 2 ) AS delivery_score" +
            ",round( AVG( description_score ), 2 ) AS description_score" +
            ",round( AVG( service_score ), 2 ) AS service_score " +
            "FROM li_member_evaluation ${ew.customSqlSegment}")
    StoreRatingVO getStoreRatingVO(@Param(Constants.WRAPPER) Wrapper<MemberEvaluation> queryWrapper);
 
    /**
     * 商品会员评价数量
     *
     * @param queryWrapper 查询条件
     * @return 评价数量
     */
    @Select("SELECT goods_id,COUNT(goods_id) AS num FROM li_member_evaluation GROUP BY goods_id")
    List<Map<String, Object>> memberEvaluationNum(@Param(Constants.WRAPPER) Wrapper<MemberEvaluation> queryWrapper);
}