|
@@ -4,6 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
|
|
|
+import com.zhongzheng.modules.course.domain.Major;
|
|
|
+import com.zhongzheng.modules.course.mapper.MajorMapper;
|
|
|
+import com.zhongzheng.modules.course.service.IMajorService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
|
|
|
+import com.zhongzheng.modules.course.vo.MajorVo;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -17,6 +24,7 @@ import com.zhongzheng.modules.course.mapper.MajorLabelMapper;
|
|
|
import com.zhongzheng.modules.course.vo.MajorLabelVo;
|
|
|
import com.zhongzheng.modules.course.service.IMajorLabelService;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
@@ -31,10 +39,20 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class MajorLabelServiceImpl extends ServiceImpl<MajorLabelMapper, MajorLabel> implements IMajorLabelService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IMajorService majorService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public MajorLabelVo queryById(Long id){
|
|
|
MajorLabel db = this.baseMapper.selectById(id);
|
|
|
- return BeanUtil.toBean(db, MajorLabelVo.class);
|
|
|
+ MajorLabelVo majorLabelVo = BeanUtil.toBean(db, MajorLabelVo.class);
|
|
|
+ LambdaQueryWrapper<Major> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq( Major::getLabelId, majorLabelVo.getId());
|
|
|
+ List<Major> list = majorService.list(lqw);
|
|
|
+ majorLabelVo.setMajorVos(entityMajorVo(list));
|
|
|
+ return majorLabelVo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -42,6 +60,20 @@ public class MajorLabelServiceImpl extends ServiceImpl<MajorLabelMapper, MajorLa
|
|
|
return entity2Vo(baseMapper.queryList(bo));
|
|
|
}
|
|
|
|
|
|
+ private List<MajorVo> entityMajorVo(Collection<Major> collection) {
|
|
|
+ List<MajorVo> voList = collection.stream()
|
|
|
+ .map(any -> BeanUtil.toBean(any, MajorVo.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (collection instanceof Page) {
|
|
|
+ Page<Major> page = (Page<Major>)collection;
|
|
|
+ Page<MajorVo> pageVo = new Page<>();
|
|
|
+ BeanUtil.copyProperties(page,pageVo);
|
|
|
+ pageVo.addAll(voList);
|
|
|
+ voList = pageVo;
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 实体类转化成视图对象
|
|
|
*
|