|
@@ -9,95 +9,5 @@ import java.util.List;
|
|
|
|
|
|
public class DTOConverter {
|
|
|
|
|
|
- public static RecommendVo convert(Recommend recommend) {
|
|
|
- RecommendVo recommendVo = new RecommendVo();
|
|
|
- recommendVo.setId(recommend.getPid());
|
|
|
- recommendVo.setCode(recommend.getCode());
|
|
|
- recommendVo.setTitle(recommend.getTitle());
|
|
|
- recommendVo.setSubTitle(recommend.getSubTitle());
|
|
|
- recommendVo.setBreadCrumb(recommend.getBreadCrumb());
|
|
|
- recommendVo.setCoverUrl(recommend.getCoverUrl());
|
|
|
- return recommendVo;
|
|
|
- }
|
|
|
|
|
|
- public static TagGroupVo convert(TagGroup tagGroup) {
|
|
|
- TagGroupVo tagGroupVo = new TagGroupVo();
|
|
|
- tagGroupVo.setName(tagGroup.getName());
|
|
|
- List<TagVo> tagVoList = new ArrayList<>();
|
|
|
- List<Tag> tagList = tagGroup.getTagList();
|
|
|
- if (CollectionUtils.isEmpty(tagList)) {
|
|
|
- return tagGroupVo;
|
|
|
- }
|
|
|
- for (Tag tag : tagList) {
|
|
|
- TagVo tagVo = new TagVo();
|
|
|
- tagVo.setId(tag.getId());
|
|
|
- tagVo.setName(tag.getName());
|
|
|
- tagVoList.add(tagVo);
|
|
|
- }
|
|
|
- tagGroupVo.setList(tagVoList);
|
|
|
- return tagGroupVo;
|
|
|
- }
|
|
|
-
|
|
|
- public static TagTypeVo convert(TagType tagType) {
|
|
|
- TagTypeVo tagTypeVo = new TagTypeVo();
|
|
|
- tagTypeVo.setName(tagType.getName());
|
|
|
- List<TagVo> tagVoList = new ArrayList<>();
|
|
|
- List<Tag> tagList = tagType.getTagList();
|
|
|
- if (CollectionUtils.isEmpty(tagList)) {
|
|
|
- return tagTypeVo;
|
|
|
- }
|
|
|
- for (Tag tag : tagList) {
|
|
|
- TagVo tagVo = new TagVo();
|
|
|
- tagVo.setId(tag.getId());
|
|
|
- tagVo.setName(tag.getName());
|
|
|
- tagVoList.add(tagVo);
|
|
|
- }
|
|
|
- tagTypeVo.setList(tagVoList);
|
|
|
- return tagTypeVo;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static CourseVo convert(Course course) {
|
|
|
- CourseVo courseVo = new CourseVo();
|
|
|
- courseVo.setBreadCrumb(course.getBreadCrumb());
|
|
|
- courseVo.setBgUrl(course.getBgUrl());
|
|
|
- courseVo.setTitle(course.getTitle());
|
|
|
- List<CourseSubItemVo> subItemVoList = course.getSubItemList();
|
|
|
- if (subItemVoList == null) {
|
|
|
- return courseVo;
|
|
|
- }
|
|
|
- List<LessonVo> lessonVoList = new ArrayList<>();
|
|
|
- for (CourseSubItemVo courseSubItemVo : subItemVoList) {
|
|
|
- LessonVo lessonVo = new LessonVo();
|
|
|
- lessonVo.setId(courseSubItemVo.getId());
|
|
|
- lessonVo.setTitle(courseSubItemVo.getTitle());
|
|
|
- lessonVo.setCode(courseSubItemVo.getCode());
|
|
|
- lessonVoList.add(lessonVo);
|
|
|
- }
|
|
|
- courseVo.setList(lessonVoList);
|
|
|
- return courseVo;
|
|
|
- }
|
|
|
-
|
|
|
- public static CourseDetailVo convert(CourseItemVo courseItemVo) {
|
|
|
- CourseDetailVo courseDetailVo = new CourseDetailVo();
|
|
|
- BeanUtils.copyProperties(courseItemVo, courseDetailVo);
|
|
|
- return courseDetailVo;
|
|
|
- }
|
|
|
-
|
|
|
- public static LessonVo convert(Lesson lesson) {
|
|
|
- LessonVo lessonVo = new LessonVo();
|
|
|
- lessonVo.setId(lesson.getId());
|
|
|
- lessonVo.setCode(lesson.getCode());
|
|
|
- lessonVo.setTitle(lesson.getTitle());
|
|
|
- return lessonVo;
|
|
|
- }
|
|
|
-
|
|
|
- public static CourseWareVo convert(CourseWare courseWare) {
|
|
|
- CourseWareVo courseWareVo = new CourseWareVo();
|
|
|
- courseWareVo.setId(courseWare.getId());
|
|
|
- courseWareVo.setCode(courseWare.getCode());
|
|
|
- courseWareVo.setTitle(courseWare.getTitle());
|
|
|
- courseWareVo.setCategory(courseWare.getCategory());
|
|
|
- return courseWareVo;
|
|
|
- }
|
|
|
}
|