添加CONTENT_HAS_NO_KNOWS

master
Alan 3 months ago
parent 814a05234d
commit d47cd60437
  1. 2
      src/main/java/com/teaching/backend/common/ErrorCode.java
  2. 4
      src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java

@ -24,6 +24,8 @@ public enum ErrorCode {
MESSAGE_NO_EXIT(400012, "消息不存在!"),
TOTOAL_OBJECTIVE_CANT_DELETE(400013, "课程总目标内容禁止删除!"),
CONTENT_HAS_NO_KNOWS(400014, "当前课程目标下面没有关联的知识点!"),
NOT_LOGIN_ERROR(40100, "未登录"),
NO_AUTH_ERROR(40101, "无权限"),

@ -18,6 +18,8 @@ import com.teaching.backend.model.entity.knowtmp.Knowtmp;
import com.teaching.backend.model.vo.courses.ObjectiveContentKnowVO;
import com.teaching.backend.model.vo.knowtmp.KnowTmpVO;
import com.teaching.backend.service.courses.IObjectiveContentKnowService;
import com.teaching.backend.utils.CourseCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -39,6 +41,7 @@ import java.util.stream.Collectors;
* @since 2024-06-13
*/
@Service
@Slf4j
public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveContentKnowMapper, ObjectiveContentKnow> implements IObjectiveContentKnowService {
@Autowired
@ -108,6 +111,7 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
.eq(ObjectiveContentKnow::getObjectiveContentId, objectiveContentId)
);
if(objectiveContentKnows.isEmpty()){
log.warn("当前课程目标下面没有关联的知识点contentId:{}",objectiveContentId);
throw new BusinessException(ErrorCode.CONTENT_HAS_NO_KNOWS);
}

Loading…
Cancel
Save