package cn.iselab.mooctest.user.web.wrapper;

import cn.iselab.mooctest.rpc.user.data.MedalDTO;
import cn.iselab.mooctest.user.model.Medal;
import org.springframework.stereotype.Service;

/**
 * @Author ROKG
 * @Description
 * @Date: Created in 下午1:38 2018/2/14
 * @Modified By:
 */
@Service
public class Medalwrapper extends BaseWrapper<MedalDTO, Medal> {

    @Override
    public MedalDTO wrap(Medal medal){
        MedalDTO dto=new MedalDTO();
        dto.setDescription(medal.getDescription());
        dto.setImgUrl(medal.getImgUrl());
        dto.setName(medal.getName());
        dto.setType(medal.getType());
        dto.setCreateTime(medal.getCreateTime().getTime());
        dto.setId(medal.getId());
        return dto;
    }

    @Override
    public Medal unwrap(MedalDTO dto){
        Medal medal=new Medal();
        medal.setImgUrl(dto.getImgUrl());
        medal.setDescription(dto.getDescription());
        medal.setName(dto.getName());
        return medal;
    }
}
