add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
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
package com.iotechn.unimall.biz.service.appriaise;
 
import com.dobbinsoft.fw.core.Const;
import com.dobbinsoft.fw.core.exception.ServiceException;
import com.dobbinsoft.fw.support.annotation.AspectCommonCache;
import com.dobbinsoft.fw.support.model.Page;
import com.iotechn.unimall.data.constant.CacheConst;
import com.iotechn.unimall.data.dto.appraise.AppraiseResponseDTO;
import com.iotechn.unimall.data.enums.BizType;
import com.iotechn.unimall.data.mapper.AppraiseMapper;
import com.iotechn.unimall.data.mapper.ImgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
/**
 * Created by rize on 2019/7/13.
 */
@Service
public class AppraiseBizService {
 
    @Autowired
    private AppraiseMapper appraiseMapper;
 
    @Autowired
    private ImgMapper imgMapper;
 
    @AspectCommonCache(value = CacheConst.PRT_APPRAISE_LIST, argIndex = {0, 1, 2}, second = Const.CACHE_ONE_DAY)
    public Page<AppraiseResponseDTO> getSpuAppraisePage(Long spuId, Integer pageNo, Integer pageSize) throws ServiceException {
        return appraiseMapper.selectSpuAppraisePage(Page.div(pageNo, pageSize, AppraiseResponseDTO.class), spuId).trans(item -> {
            item.setImgList(imgMapper.getImgs(BizType.APPRAISE.getCode(), item.getId()));
            return item;
        });
    }
 
    public Page<AppraiseResponseDTO> getUserAppraisePage(Long userId, Integer pageNo, Integer pageSize) {
        return appraiseMapper.selectUserAppraisePage(Page.div(pageNo, pageSize, AppraiseResponseDTO.class), userId).trans(item -> {
            item.setImgList(imgMapper.getImgs(BizType.APPRAISE.getCode(), item.getId()));
            return item;
        });
    }
 
}