From cd37477841c8e28d4c9a4fdca3bb285694ecbfed Mon Sep 17 00:00:00 2001 From: Alan <3052806735@qq.com> Date: Fri, 23 Aug 2024 10:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/teaching/backend/common/ErrorCode.java | 2 ++ .../service/impl/courses/ObjectiveContentKnowServiceImpl.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/com/teaching/backend/common/ErrorCode.java b/src/main/java/com/teaching/backend/common/ErrorCode.java index a67b684..da1ebfd 100644 --- a/src/main/java/com/teaching/backend/common/ErrorCode.java +++ b/src/main/java/com/teaching/backend/common/ErrorCode.java @@ -22,6 +22,8 @@ public enum ErrorCode { INVALID_ROLE(400010, "角色不存在"), MESSAGE_NO_READ(400011, "消息未读,禁止删除!"), MESSAGE_NO_EXIT(400012, "消息不存在!"), + CONTENT_HAS_NO_KNOWS(400013, "该课程目标暂未关联知识点!"), + NOT_LOGIN_ERROR(40100, "未登录"), NO_AUTH_ERROR(40101, "无权限"), NOT_FOUND_ERROR(40400, "请求数据不存在"), diff --git a/src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java index c1ee035..76f4668 100644 --- a/src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java @@ -107,6 +107,9 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl() .eq(ObjectiveContentKnow::getObjectiveContentId, objectiveContentId) ); + if(objectiveContentKnows.isEmpty()){ + throw new BusinessException(ErrorCode.CONTENT_HAS_NO_KNOWS); + } // 创建并设置ObjectiveContentKnowVO对象的属性 objectiveContentKnowVO = createObjectiveContentKnowVO(objectiveContentId, objectiveContentKnows); @@ -120,6 +123,7 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl objectiveContentKnows) { ObjectiveContentKnowVO vo = new ObjectiveContentKnowVO(); vo.setObjectiveOrContent(objectiveOrContentId);