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