he2802 2 سال پیش
والد
کامیت
ec29b6742c

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CoursePhotoLogServiceImpl.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.course.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.bo.CoursePhotoLogAddBo;
 import com.zhongzheng.modules.course.bo.CoursePhotoLogEditBo;
@@ -70,6 +72,9 @@ public class CoursePhotoLogServiceImpl extends ServiceImpl<CoursePhotoLogMapper,
 
     @Override
     public Boolean insertByAddBo(CoursePhotoLogAddBo bo) {
+        if(Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("缺OrderGoodsId");
+        }
         CoursePhotoLog add = BeanUtil.toBean(bo, CoursePhotoLog.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CoursePhotoLogVo.java

@@ -80,4 +80,5 @@ public class CoursePhotoLogVo {
 	@Excel(name = "课程ID")
 	@ApiModelProperty("课程ID")
 	private Long courseId;
+	private Long orderGoodsId;
 }

+ 3 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CoursePhotoLogMapper.xml

@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="currentStatus" column="current_status"/>
         <result property="timeInterval" column="time_interval"/>
         <result property="courseId" column="course_id"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.course.vo.CoursePhotoLogVo" id="CoursePhotoLogVoResult">
@@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="currentStatus" column="current_status"/>
         <result property="timeInterval" column="time_interval"/>
         <result property="courseId" column="course_id"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
     <select id="getLastInfo" parameterType="com.zhongzheng.modules.course.bo.CoursePhotoLogQueryBo"  resultMap="CoursePhotoLogVoResult">
@@ -62,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and chapter_id = #{chapterId}
         </if>
         <if test="orderGoodsId != null">
-            and order_goods_id = #{orderGoodsId}
+            and (order_goods_id = #{orderGoodsId} or order_goods_id is null )
         </if>
     </select>