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

import cn.iselab.mooctest.rpc.user.data.IntegralCaughtDTO;
import cn.iselab.mooctest.user.model.User2Integral;
import org.springframework.stereotype.Service;

/**
 * @Author ROKG
 * @Description
 * @Date: Created in 下午1:19 2018/2/14
 * @Modified By:
 */
@Service
public class IntegralCaughtWrapper extends BaseWrapper<IntegralCaughtDTO,User2Integral>{

    @Override
    public IntegralCaughtDTO wrap(User2Integral user2Integral){
        IntegralCaughtDTO dto=new IntegralCaughtDTO();
        dto.setCreateTime(user2Integral.getCreateTime().getTime());
        dto.setId(user2Integral.getId());
        dto.setPoints(user2Integral.getPoints());
        dto.setSource(user2Integral.getSource());
        dto.setType(user2Integral.getType());
        dto.setUserId(user2Integral.getUserId());
        return dto;
    }

    @Override
    public User2Integral unwrap(IntegralCaughtDTO dto){
        User2Integral integral=new User2Integral();
        integral.setPoints(dto.getPoints());
        integral.setSource(dto.getSource());
        integral.setType(dto.getType());
        integral.setUserId(dto.getUserId());
        return integral;
    }
}
