
package org.lym.pom.dto.posts.convert;

import org.lym.pom.dto.posts.AttitudeIndexDTO;
import org.lym.pom.repository.mongo.Attitude;
import org.shoulder.core.converter.BaseDataConverter;
import org.springframework.stereotype.Component;

/**
 * 将PostDTO转换为Post实体类的转换器。
 *
 * @author lym
 */
@Component
public class AttitudeIndexDTO2DomainConvertor extends BaseDataConverter<AttitudeIndexDTO, Attitude> {

    @Override
    public void doConvert(AttitudeIndexDTO sourceModel, Attitude targetModel) {
        // 基本信息转换
        targetModel.setRelatedType(conversionService.convert(sourceModel.getRelatedType(), String.class));
        targetModel.setRelatedId(sourceModel.getRelatedId());
        targetModel.setRelatedUserId(sourceModel.getUserId());
        targetModel.setType(conversionService.convert(sourceModel.getType(), String.class));
    }

}