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

import cn.iselab.mooctest.rpc.user.data.MedalCaughtDTO;
import cn.iselab.mooctest.user.model.User2Medal;
import org.springframework.stereotype.Service;

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

    @Override
    public MedalCaughtDTO wrap(User2Medal user2Medal){
        MedalCaughtDTO dto=new MedalCaughtDTO();
        dto.setCreateTime(user2Medal.getCreateTime().getTime());
        dto.setId(user2Medal.getId());
        dto.setMedalId(user2Medal.getMedalId());
        dto.setUserId(user2Medal.getUserId());
        return dto;
    }

    @Override
    public User2Medal unwrap(MedalCaughtDTO dto){
        User2Medal user2Medal=new User2Medal();
        user2Medal.setMedalId(dto.getMedalId());
        user2Medal.setUserId(dto.getUserId());
        return user2Medal;
    }
}
