|
@@ -2,6 +2,7 @@ package com.zhongzheng.modules.goods.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
@@ -123,6 +124,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ //试听列表
|
|
|
+ if(bo.getAuditionList()!=null){
|
|
|
+ add.setGoodsAuditionConfig(JSON.toJSONString(bo.getAuditionList()));
|
|
|
+ }
|
|
|
boolean result = this.save(add);
|
|
|
//课程列表
|
|
|
if(bo.getCourseList()!=null){
|
|
@@ -137,17 +142,7 @@ 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;
|
|
|
}
|
|
|
|
|
@@ -197,15 +192,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
//试听列表
|
|
|
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);
|
|
|
+ update.setGoodsAuditionConfig(JSON.toJSONString(bo.getAuditionList()));
|
|
|
}
|
|
|
return this.updateById(update);
|
|
|
}
|