package com.xindazhou.platform.convert.service.evaluation;

import com.xindazhou.platform.controller.admin.service.evaluation.vo.EvaluationRespVO;
import com.xindazhou.platform.dal.service.dataobject.evaluation.EvaluationDO;
import com.xindazhou.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 服务评价 Convert
 *
 * @author xindazhou
 */
@Mapper
public interface EvaluationConvert {

    EvaluationConvert INSTANCE = Mappers.getMapper(EvaluationConvert.class);

    @Mapping(target = "userInfo", ignore = true) // userInfo 需要通过 RPC 调用用户服务获取
    @Mapping(target = "images", ignore = true) // images 需要从JSON字符串解析
    @Mapping(target = "orderInfo", ignore = true) // orderInfo 需要通过 RPC 调用订单服务获取
    EvaluationRespVO convert(EvaluationDO bean);

    List<EvaluationRespVO> convertList(List<EvaluationDO> list);

    PageResult<EvaluationRespVO> convertPage(PageResult<EvaluationDO> page);

}

