Commit da0e6fa9 authored by 刘基明's avatar 刘基明

Convert

parent 28642621
...@@ -5,7 +5,6 @@ import com.tanpu.community.api.constants.BlockTypeEnum; ...@@ -5,7 +5,6 @@ import com.tanpu.community.api.constants.BlockTypeEnum;
import com.tanpu.community.api.constants.CollectionTypeEnum; import com.tanpu.community.api.constants.CollectionTypeEnum;
import com.tanpu.community.api.constants.CommentTypeEnum; import com.tanpu.community.api.constants.CommentTypeEnum;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.ThemeConvert;
import com.tanpu.community.dao.entity.community.BlackListEntity; import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.FansRelEntity; import com.tanpu.community.dao.entity.community.FansRelEntity;
......
package com.tanpu.community.util;
import com.tanpu.community.api.beans.ThemeDTO;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import org.springframework.beans.BeanUtils;
public class ThemeConvert {
public static ThemeDTO convertToDTO(ThemeEntity themeEntity){
ThemeDTO themeDTO = new ThemeDTO();
BeanUtils.copyProperties(themeEntity, themeDTO);
themeDTO.setId(themeEntity.getId());
themeDTO.setTitle(themeEntity.getTitle());
themeDTO.setTopicId(themeEntity.getTopicId());
themeDTO.setContent(themeEntity.getContent());
themeDTO.setThemeType(themeEntity.getThemeType());
themeDTO.setAttachment(themeEntity.getAttachment());
themeDTO.setAttachType(themeEntity.getAttachType());
themeDTO.setFormerThemeId(themeEntity.getFormerThemeId());
themeDTO.setAuthorId(themeEntity.getAuthorId());
themeDTO.setCreateBy(themeEntity.getCreateBy());
themeDTO.setUpdateBy(themeEntity.getUpdateBy());
themeDTO.setCreateTime(themeEntity.getCreateTime());
themeDTO.setUpdateBy(themeEntity.getUpdateBy());
return themeDTO;
}
public static ThemeEntity convertToEntity(ThemeDTO themeDTO){
ThemeEntity themeEntity = new ThemeEntity();
themeEntity.setTitle(themeDTO.getTitle());
themeEntity.setTopicId(themeDTO.getTopicId());
themeEntity.setContent(themeDTO.getContent());
themeEntity.setThemeType(themeDTO.getThemeType());
themeEntity.setAttachment(themeDTO.getAttachment());
themeEntity.setAttachType(themeDTO.getAttachType());
themeEntity.setFormerThemeId(themeDTO.getFormerThemeId());
themeEntity.setAuthorId(themeDTO.getAuthorId());
themeEntity.setCreateBy(themeDTO.getCreateBy());
themeEntity.setUpdateBy(themeDTO.getUpdateBy());
themeEntity.setCreateTime(themeDTO.getCreateTime());
themeEntity.setUpdateBy(themeDTO.getUpdateBy());
return themeEntity;
}
}
package com.tanpu.community.util;
import com.tanpu.community.api.beans.TopicDTO;
import com.tanpu.community.dao.entity.community.TopicEntity;
public class TopicConverter {
public static TopicDTO convertToDTO(TopicEntity topicEntity){
TopicDTO topicDTO = new TopicDTO();
topicDTO.setTopicTitle(topicEntity.getTopicTitle());
topicDTO.setId(topicEntity.getId());
topicDTO.setIsTop(topicEntity.getIsTop());
topicDTO.setIsConceal(topicEntity.getIsConceal());
topicDTO.setCreateBy(topicEntity.getCreateBy());
topicDTO.setCreateTime(topicEntity.getCreateTime());
topicDTO.setUpdateTime(topicEntity.getUpdateTime());
topicDTO.setUpdateBy(topicEntity.getUpdateBy());
topicDTO.setDeleteTag(topicEntity.getDeleteTag());
return topicDTO;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment