查询优化

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

@ -22,6 +22,8 @@ public enum ErrorCode {
INVALID_ROLE(400010, "角色不存在"), INVALID_ROLE(400010, "角色不存在"),
MESSAGE_NO_READ(400011, "消息未读,禁止删除!"), MESSAGE_NO_READ(400011, "消息未读,禁止删除!"),
MESSAGE_NO_EXIT(400012, "消息不存在!"), MESSAGE_NO_EXIT(400012, "消息不存在!"),
CONTENT_HAS_NO_KNOWS(400013, "该课程目标暂未关联知识点!"),
NOT_LOGIN_ERROR(40100, "未登录"), NOT_LOGIN_ERROR(40100, "未登录"),
NO_AUTH_ERROR(40101, "无权限"), NO_AUTH_ERROR(40101, "无权限"),
NOT_FOUND_ERROR(40400, "请求数据不存在"), NOT_FOUND_ERROR(40400, "请求数据不存在"),

@ -107,6 +107,9 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
new LambdaQueryWrapper<ObjectiveContentKnow>() new LambdaQueryWrapper<ObjectiveContentKnow>()
.eq(ObjectiveContentKnow::getObjectiveContentId, objectiveContentId) .eq(ObjectiveContentKnow::getObjectiveContentId, objectiveContentId)
); );
if(objectiveContentKnows.isEmpty()){
throw new BusinessException(ErrorCode.CONTENT_HAS_NO_KNOWS);
}
// 创建并设置ObjectiveContentKnowVO对象的属性 // 创建并设置ObjectiveContentKnowVO对象的属性
objectiveContentKnowVO = createObjectiveContentKnowVO(objectiveContentId, objectiveContentKnows); objectiveContentKnowVO = createObjectiveContentKnowVO(objectiveContentId, objectiveContentKnows);
@ -120,6 +123,7 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
} }
// 创建ObjectiveContentKnowVO对象,并计算知识点数量、总时间和关联的知识点部分数据 // 创建ObjectiveContentKnowVO对象,并计算知识点数量、总时间和关联的知识点部分数据
// TODO 查询知识点的数据 有优化空间!!!
private ObjectiveContentKnowVO createObjectiveContentKnowVO(String objectiveOrContentId, List<ObjectiveContentKnow> objectiveContentKnows) { private ObjectiveContentKnowVO createObjectiveContentKnowVO(String objectiveOrContentId, List<ObjectiveContentKnow> objectiveContentKnows) {
ObjectiveContentKnowVO vo = new ObjectiveContentKnowVO(); ObjectiveContentKnowVO vo = new ObjectiveContentKnowVO();
vo.setObjectiveOrContent(objectiveOrContentId); vo.setObjectiveOrContent(objectiveOrContentId);

Loading…
Cancel
Save