|
@@ -10,9 +10,11 @@ import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
|
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsAttached;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsAuditionConfig;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
import com.zhongzheng.modules.goods.mapper.GoodsMapper;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsAuditionConfigService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
@@ -48,6 +50,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private IGoodsAttachedService iGoodsAttachedService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGoodsAuditionConfigService iGoodsAuditionConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
public GoodsVo queryById(Long goodsId){
|
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
@@ -119,6 +124,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
boolean result = this.save(add);
|
|
|
+ //课程列表
|
|
|
if(bo.getCourseList()!=null){
|
|
|
Collection<GoodsCourse> coll = new HashSet<>();
|
|
|
for(int i=0;i<bo.getCourseList().size();i++){
|
|
@@ -131,6 +137,17 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
iGoodsCourseService.saveBatch(coll);
|
|
|
}
|
|
|
+ //试听列表
|
|
|
+ if(bo.getAuditionList()!=null){
|
|
|
+ Collection<GoodsAuditionConfig> coll1 = new HashSet<>();
|
|
|
+ for(int i=0;i<bo.getAuditionList().size();i++){
|
|
|
+ GoodsAuditionConfigAddBo item = bo.getAuditionList().get(i);
|
|
|
+ GoodsAuditionConfig addItem = BeanUtil.toBean(item, GoodsAuditionConfig.class);
|
|
|
+ addItem.setGoodsId(add.getGoodsId());
|
|
|
+ coll1.add(addItem);
|
|
|
+ }
|
|
|
+ iGoodsAuditionConfigService.saveBatch(coll1);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -164,7 +181,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Goods update = BeanUtil.toBean(bo, Goods.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
- if(bo.getCourseList()!=null){
|
|
|
+ //课程列表
|
|
|
+ if(bo.getCourseList()!=null&&bo.getCourseList().size()>0){
|
|
|
iGoodsCourseService.remove(new LambdaQueryWrapper<GoodsCourse>().eq(GoodsCourse::getGoodsId, bo.getGoodsId()));
|
|
|
Collection<GoodsCourse> coll = new HashSet<>();
|
|
|
for(int i=0;i<bo.getCourseList().size();i++){
|
|
@@ -177,6 +195,18 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
iGoodsCourseService.saveBatch(coll);
|
|
|
}
|
|
|
+ //试听列表
|
|
|
+ if(bo.getAuditionList()!=null&&bo.getAuditionList().size()>0){
|
|
|
+ iGoodsAuditionConfigService.remove(new LambdaQueryWrapper<GoodsAuditionConfig>().eq(GoodsAuditionConfig::getGoodsId, bo.getGoodsId()));
|
|
|
+ Collection<GoodsAuditionConfig> coll1 = new HashSet<>();
|
|
|
+ for(int i=0;i<bo.getAuditionList().size();i++){
|
|
|
+ GoodsAuditionConfigEditBo item = bo.getAuditionList().get(i);
|
|
|
+ GoodsAuditionConfig addItem = BeanUtil.toBean(item, GoodsAuditionConfig.class);
|
|
|
+ addItem.setGoodsId(update.getGoodsId());
|
|
|
+ coll1.add(addItem);
|
|
|
+ }
|
|
|
+ iGoodsAuditionConfigService.saveBatch(coll1);
|
|
|
+ }
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|