|
@@ -9,6 +9,7 @@ import com.zhongzheng.modules.course.domain.CourseEducationTier;
|
|
|
import com.zhongzheng.modules.course.domain.CourseHandoutsBusiness;
|
|
|
import com.zhongzheng.modules.course.service.ICourseHandoutsBusinessService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseHandoutsBusinessVo;
|
|
|
+import org.apache.commons.math3.distribution.AbstractMultivariateRealDistribution;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -22,6 +23,7 @@ import com.zhongzheng.modules.course.domain.CourseHandouts;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseHandoutsMapper;
|
|
|
import com.zhongzheng.modules.course.vo.CourseHandoutsVo;
|
|
|
import com.zhongzheng.modules.course.service.ICourseHandoutsService;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
@@ -42,8 +44,16 @@ public class CourseHandoutsServiceImpl extends ServiceImpl<CourseHandoutsMapper,
|
|
|
|
|
|
@Override
|
|
|
public CourseHandoutsVo queryById(Long handoutsId){
|
|
|
- CourseHandouts db = this.baseMapper.selectById(handoutsId);
|
|
|
- return BeanUtil.toBean(db, CourseHandoutsVo.class);
|
|
|
+ CourseHandoutsQueryBo courseHandoutsQueryBo = new CourseHandoutsQueryBo();
|
|
|
+ courseHandoutsQueryBo.setId(handoutsId);
|
|
|
+ List<CourseHandoutsVo> courseHandoutsVos = entity2Vo(baseMapper.queryList(courseHandoutsQueryBo));
|
|
|
+ if (CollectionUtils.isEmpty(courseHandoutsVos)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CourseHandoutsVo courseHandoutsVo = courseHandoutsVos.get(0);
|
|
|
+ List<CourseHandoutsBusinessVo> courseHandoutsBusinessVos = baseMapper.selectEntity(courseHandoutsVo.getHandoutsId());
|
|
|
+ courseHandoutsVo.setCourseHandoutsBusinessVo(courseHandoutsBusinessVos);
|
|
|
+ return courseHandoutsVo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -102,12 +112,14 @@ public class CourseHandoutsServiceImpl extends ServiceImpl<CourseHandoutsMapper,
|
|
|
LambdaQueryWrapper<CourseHandoutsBusiness> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(CourseHandoutsBusiness::getHandoutsId,bo.getHandoutsId());
|
|
|
courseHandoutsBusinessService.remove(lqw);
|
|
|
- for (CourseHandoutsBusinessAddBo courseHandoutsBusinessAddBo : bo.getCourseHandoutsBusinessAddBos()) {
|
|
|
- CourseHandoutsBusiness addBusiness = BeanUtil.toBean(courseHandoutsBusinessAddBo, CourseHandoutsBusiness.class);
|
|
|
- addBusiness.setHandoutsId(bo.getHandoutsId());
|
|
|
- addBusiness.setCreateTime(DateUtils.getNowTime());
|
|
|
- addBusiness.setUpdateTime(DateUtils.getNowTime());
|
|
|
- courseHandoutsBusinessService.save(addBusiness);
|
|
|
+ if (!CollectionUtils.isEmpty(bo.getCourseHandoutsBusinessAddBos())) {
|
|
|
+ for (CourseHandoutsBusinessAddBo courseHandoutsBusinessAddBo : bo.getCourseHandoutsBusinessAddBos()) {
|
|
|
+ CourseHandoutsBusiness addBusiness = BeanUtil.toBean(courseHandoutsBusinessAddBo, CourseHandoutsBusiness.class);
|
|
|
+ addBusiness.setHandoutsId(bo.getHandoutsId());
|
|
|
+ addBusiness.setCreateTime(DateUtils.getNowTime());
|
|
|
+ addBusiness.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ courseHandoutsBusinessService.save(addBusiness);
|
|
|
+ }
|
|
|
}
|
|
|
return this.updateById(update);
|
|
|
}
|