package io.hmit.modules.fhjw.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author Eve
 * @email mengmengeve@gmail.com
 * @create 2021/7/6
 */
@Data
@ApiModel(value = "反馈数量表")
public class FeedbackCountListDTO {
    @ApiModelProperty(value = "统计的名字")
    private String name;

    @ApiModelProperty(value = "反馈意见详情")
    private FeedbackCountDTO feedbackCount;

    /**
     * 组装返回的统计数据
     * @param countName
     * @param dto
     * @return
     */
    public FeedbackCountListDTO assembleCountListDTO(String countName,FeedbackCountDTO dto){

        FeedbackCountListDTO feedbackCountListDTO = new FeedbackCountListDTO();

        //为方便前端页面展示，如果查询出的总数为0，则将各项数值设置成0，不设置则默认为null
        if( dto.getTotalCount().equals(0)){
            feedbackCountListDTO.setFeedbackCount(new FeedbackCountDTO().assembleZeroCountDTO());
        }else{
            feedbackCountListDTO.setFeedbackCount(dto);

        }
        feedbackCountListDTO.setName(countName);

        return feedbackCountListDTO;
    }
}
