|
@@ -1,20 +1,23 @@
|
|
|
package com.miaxis.teachingVideo.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.miaxis.common.core.domain.Response;
|
|
|
+import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
|
|
|
import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
|
|
|
+import com.miaxis.teachingVideo.dto.TeachingVideoInfoTypeIdDto;
|
|
|
+import com.miaxis.teachingVideo.mapper.TeachingVideoInfoMapper;
|
|
|
import com.miaxis.teachingVideo.mapper.TeachingVideoTypeInfoMapper;
|
|
|
import com.miaxis.teachingVideo.service.ITeachingVideoTypeInfoService;
|
|
|
+import com.miaxis.teachingVideo.vo.AppletTeachingVideoTypeInfoVo;
|
|
|
+import com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo;
|
|
|
import com.miaxis.teachingVideo.vo.TeachingVideoTypeInfoVo;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -28,6 +31,8 @@ import java.util.List;
|
|
|
public class TeachingVideoTypeInfoServiceImpl extends ServiceImpl<TeachingVideoTypeInfoMapper, TeachingVideoTypeInfo> implements ITeachingVideoTypeInfoService {
|
|
|
|
|
|
private final TeachingVideoTypeInfoMapper teachingVideoTypeInfoMapper;
|
|
|
+ private final TeachingVideoInfoMapper teachingVideoInfoMapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询教学视频分类列表
|
|
@@ -92,4 +97,51 @@ public class TeachingVideoTypeInfoServiceImpl extends ServiceImpl<TeachingVideoT
|
|
|
return Response.success();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询教学视频分类树形列表
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Response<List<AppletTeachingVideoTypeInfoVo>> selectAppletTeachingVideoTypeInfoTreeList() {
|
|
|
+ List<AppletTeachingVideoTypeInfoVo> list = teachingVideoTypeInfoMapper.selectAppletTeachingVideoTypeInfoTreeList();
|
|
|
+ for (AppletTeachingVideoTypeInfoVo productTypeInfoVo : list) {
|
|
|
+ if(!"0".equals(productTypeInfoVo.getPid())){
|
|
|
+ PageHelper.startPage(1, 4, null);
|
|
|
+ productTypeInfoVo.setVideos(teachingVideoInfoMapper.getTeachingVideoByTypeId(productTypeInfoVo.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Response.success(builTree2(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ //建立树形结构
|
|
|
+ public List<AppletTeachingVideoTypeInfoVo> builTree2(List<AppletTeachingVideoTypeInfoVo> productList){
|
|
|
+ List<AppletTeachingVideoTypeInfoVo> infoVos =new ArrayList<>();
|
|
|
+ //获取根节点
|
|
|
+ List<AppletTeachingVideoTypeInfoVo> rootMenuLists =new ArrayList<>();
|
|
|
+ for(AppletTeachingVideoTypeInfoVo productType : productList) {
|
|
|
+ if(productType.getPid().toString().equals("0")) {
|
|
|
+ rootMenuLists.add(productType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(AppletTeachingVideoTypeInfoVo productTypeInfoVo : rootMenuLists) {
|
|
|
+ productTypeInfoVo=getTree2(productTypeInfoVo,productList);
|
|
|
+ infoVos.add(productTypeInfoVo);
|
|
|
+ }
|
|
|
+ return infoVos;
|
|
|
+ }
|
|
|
+ //递归,建立子树形结构
|
|
|
+ private AppletTeachingVideoTypeInfoVo getTree2(AppletTeachingVideoTypeInfoVo productTypeInfo,List<AppletTeachingVideoTypeInfoVo> menuList){
|
|
|
+ List<AppletTeachingVideoTypeInfoVo> infoVos = new ArrayList<>();
|
|
|
+ for (AppletTeachingVideoTypeInfoVo productTypeInfoVo : menuList) {
|
|
|
+ if (productTypeInfoVo.getPid().toString().equals(productTypeInfo.getId().toString())) { //当前对象为这个的子类
|
|
|
+ infoVos.add(getTree2(productTypeInfoVo, menuList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ productTypeInfo.setChildren(infoVos);
|
|
|
+ return productTypeInfo;
|
|
|
+ }
|
|
|
+
|
|
|
}
|