he2802 2 lat temu
rodzic
commit
4379a6ed6f

+ 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 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CoursePhotoLogMapper.xml

@@ -64,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>