1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.tanpu.community.controller.convert;
import com.tanpu.community.api.beans.ThemeDTO;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import java.util.List;
import java.util.stream.Collectors;
public class ThemeConvert {
public static ThemeDTO convertToDTO(ThemeEntity themeEntity){
ThemeDTO themeDTO = new ThemeDTO();
themeDTO.setId(themeEntity.getId());
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.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;
}
public static List<ThemeDTO> convertToEntitys(List<ThemeEntity> topicEntities){
return topicEntities.stream().map(ThemeConvert::convertToDTO).collect(Collectors.toList());
}
public static List<ThemeDTO> convertToDTOs(List<ThemeEntity> topicEntities){
return topicEntities.stream().map(ThemeConvert::convertToDTO).collect(Collectors.toList());
}
}