Browse Source

fix 试听配置

he2802 3 years ago
parent
commit
74941f5ed6

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsAddBo.java

@@ -111,4 +111,5 @@ public class GoodsAddBo {
     private List<GoodsCourseAddBo> courseList;
     @ApiModelProperty("试听列表")
     private List<GoodsAuditionConfigAddBo> auditionList;
+
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/Goods.java

@@ -89,4 +89,11 @@ private static final long serialVersionUID=1L;
     private String supplyName;
     /** 项目id */
     private Integer projectId;
+
+    /** 试听设置 */
+    private String goodsAuditionConfig;
+    /** 拍照设置 */
+    private String goodsPhotographConfig;
+    /** 播放设置 */
+    private String goodsPlayConfig;
 }

+ 7 - 20
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -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);
     }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsVo.java

@@ -152,4 +152,16 @@ public class GoodsVo {
 	@ApiModelProperty("专业名称")
 	private String categoryName;
 
+	/** 试听设置 */
+	@Excel(name = "试听设置")
+	@ApiModelProperty("试听设置")
+	private String goodsAuditionConfig;
+	/** 拍照设置 */
+	@Excel(name = "拍照设置")
+	@ApiModelProperty("拍照设置")
+	private String goodsPhotographConfig;
+	/** 播放设置 */
+	@Excel(name = "播放设置")
+	@ApiModelProperty("播放设置")
+	private String goodsPlayConfig;
 }

+ 0 - 16
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAuditionConfigMapper.xml

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zhongzheng.modules.goods.mapper.GoodsAuditionConfigMapper">
-
-    <resultMap type="com.zhongzheng.modules.goods.domain.GoodsAuditionConfig" id="GoodsAuditionConfigResult">
-        <result property="id" column="id"/>
-        <result property="goodsId" column="goods_id"/>
-        <result property="sectionId" column="section_id"/>
-        <result property="auditionMinute" column="audition_minute"/>
-        <result property="courseId" column="course_id"/>
-    </resultMap>
-
-
-</mapper>

+ 6 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
         <result property="supplyName" column="supply_name"/>
         <result property="projectId" column="project_id"/>
+        <result property="goodsAuditionConfig" column="goods_audition_config"/>
+        <result property="goodsPhotographConfig" column="goods_photograph_config"/>
+        <result property="goodsPlayConfig" column="goods_play_config"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.goods.vo.GoodsVo" id="GoodsResultVo">
@@ -69,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="standPriceJson" column="stand_price_json"/>
         <result property="code" column="code"/>
         <result property="projectId" column="project_id"/>
+        <result property="goodsAuditionConfig" column="goods_audition_config"/>
+        <result property="goodsPhotographConfig" column="goods_photograph_config"/>
+        <result property="goodsPlayConfig" column="goods_play_config"/>
 
         <result property="supplyName" column="supply_name"/>
         <result property="educationName" column="education_name"/>