|
@@ -16,6 +16,7 @@ import com.zhongzheng.modules.course.domain.MajorExamine;
|
|
import com.zhongzheng.modules.course.mapper.MajorExamineMapper;
|
|
import com.zhongzheng.modules.course.mapper.MajorExamineMapper;
|
|
import com.zhongzheng.modules.course.vo.MajorExamineVo;
|
|
import com.zhongzheng.modules.course.vo.MajorExamineVo;
|
|
import com.zhongzheng.modules.course.service.IMajorExamineService;
|
|
import com.zhongzheng.modules.course.service.IMajorExamineService;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
@@ -33,20 +34,18 @@ public class MajorExamineServiceImpl extends ServiceImpl<MajorExamineMapper, Maj
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public MajorExamineVo queryById(Long id){
|
|
public MajorExamineVo queryById(Long id){
|
|
- MajorExamine db = this.baseMapper.selectById(id);
|
|
|
|
- return BeanUtil.toBean(db, MajorExamineVo.class);
|
|
|
|
|
|
+ MajorExamineQueryBo majorExamineQueryBo = new MajorExamineQueryBo();
|
|
|
|
+ majorExamineQueryBo.setId(id);
|
|
|
|
+ List<MajorExamineVo> majorExamineVos = entity2Vo(baseMapper.queryList(majorExamineQueryBo));
|
|
|
|
+ if (CollectionUtils.isEmpty(majorExamineVos)){
|
|
|
|
+ throw new IllegalArgumentException("请输入正确的ID");
|
|
|
|
+ }
|
|
|
|
+ return BeanUtil.toBean(majorExamineVos.get(0), MajorExamineVo.class);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<MajorExamineVo> queryList(MajorExamineQueryBo bo) {
|
|
public List<MajorExamineVo> queryList(MajorExamineQueryBo bo) {
|
|
- LambdaQueryWrapper<MajorExamine> lqw = Wrappers.lambdaQuery();
|
|
|
|
- lqw.like(bo.getExamineName() != null, MajorExamine::getExamineName, bo.getExamineName());
|
|
|
|
- lqw.eq(bo.getStatus() != null, MajorExamine::getStatus, bo.getStatus());
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getEncoder()), MajorExamine::getEncoder, bo.getEncoder());
|
|
|
|
- lqw.eq(bo.getStartTime() != null, MajorExamine::getStartTime, bo.getStartTime());
|
|
|
|
- lqw.eq(bo.getEndTime() != null, MajorExamine::getEndTime, bo.getEndTime());
|
|
|
|
- lqw.eq(bo.getEnrollmentYear() != null, MajorExamine::getEnrollmentYear, bo.getEnrollmentYear());
|
|
|
|
- return entity2Vo(this.list(lqw));
|
|
|
|
|
|
+ return entity2Vo(baseMapper.queryList(bo));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -55,12 +54,12 @@ public class MajorExamineServiceImpl extends ServiceImpl<MajorExamineMapper, Maj
|
|
* @param collection 实体类集合
|
|
* @param collection 实体类集合
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private List<MajorExamineVo> entity2Vo(Collection<MajorExamine> collection) {
|
|
|
|
|
|
+ private List<MajorExamineVo> entity2Vo(Collection<MajorExamineVo> collection) {
|
|
List<MajorExamineVo> voList = collection.stream()
|
|
List<MajorExamineVo> voList = collection.stream()
|
|
.map(any -> BeanUtil.toBean(any, MajorExamineVo.class))
|
|
.map(any -> BeanUtil.toBean(any, MajorExamineVo.class))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
if (collection instanceof Page) {
|
|
if (collection instanceof Page) {
|
|
- Page<MajorExamine> page = (Page<MajorExamine>)collection;
|
|
|
|
|
|
+ Page<MajorExamineVo> page = (Page<MajorExamineVo>)collection;
|
|
Page<MajorExamineVo> pageVo = new Page<>();
|
|
Page<MajorExamineVo> pageVo = new Page<>();
|
|
BeanUtil.copyProperties(page,pageVo);
|
|
BeanUtil.copyProperties(page,pageVo);
|
|
pageVo.addAll(voList);
|
|
pageVo.addAll(voList);
|