From 9b37e8a73df3836e1ae3ded8e2f70f4a8ac1acfa Mon Sep 17 00:00:00 2001 From: zhaolongfei <2651195677@qq.com> Date: Tue, 18 Jun 2024 09:09:52 +0800 Subject: [PATCH] =?UTF-8?q?content=E8=A1=A8=E6=B7=BB=E5=8A=A0processVideo?= =?UTF-8?q?=E5=AD=97=E6=AE=B5,=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CourseContentServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/service/impl/CourseContentServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/service/impl/CourseContentServiceImpl.java index 6137e027..8a6396a8 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/service/impl/CourseContentServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/service/impl/CourseContentServiceImpl.java @@ -1,5 +1,7 @@ package com.xboe.module.course.service.impl; +import java.sql.PreparedStatement; +import java.sql.SQLException; import java.util.List; import javax.annotation.Resource; @@ -143,10 +145,12 @@ public class CourseContentServiceImpl implements ICourseContentService { @Override public void updateProcessVideo(String id, String courseId, Float processVideo) { - CourseContent cc= new CourseContent(); - cc.setProgressVideo(processVideo); - String sql = "update boe_course_content set progress_video="+ processVideo+" where id="+id+" and course_id="+courseId+" "; - ccDao.sqlUpdate(sql); + // 处理 processVideo 为 null 的情况 + if (processVideo == null) { + processVideo = 0.0f; + } + String sql = "UPDATE boe_course_content SET progress_video = "+ processVideo+" WHERE id = "+ id+" AND course_id = "+ courseId+" "; + ccDao.update(sql); } @Override