知识点xiugai2

master
you hang 3 months ago committed by youhang20021127
parent 1dcbffefec
commit e5c79d8c90
  1. 9
      src/main/java/com/teaching/backend/controller/Know/KnowController.java
  2. 24
      src/main/java/com/teaching/backend/controller/Know/RelsNodesVO.java
  3. 19
      src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java

@ -51,7 +51,7 @@ public class KnowController {
return knowService.knowLearnPath(corseId);
}
//生成知识点学习路径 默认从第一个知识点到第最后个知识点
@ApiOperation(value = "生成知识点学习路径")
@ApiOperation(value = "生成知识点学习路径-图信息")
@GetMapping("/knowLearnPathGraph")
BaseResponse<BaseKnowReturn> knowLearnPathGraph(@RequestParam String corseId){
return knowService.knowLearnPathGraph(corseId);
@ -74,8 +74,11 @@ public class KnowController {
//返回课程下指定关系的知识图谱
@ApiOperation(value = "返回课程下指定关系的知识图谱")
@GetMapping("/getRelsNodesByCourseId")
BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(@RequestParam String courseId,@RequestParam Integer level,@RequestParam List<String>types){
@PostMapping("/getRelsNodesByCourseId")
BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(@RequestBody RelsNodesVO relsNodesVO){
String courseId = relsNodesVO.getCourseId();
Integer level = relsNodesVO.getLevel();
List<String> types = relsNodesVO.getTypes();
return knowService.getRelsNodesByCourseId(courseId, level,types);
}

@ -0,0 +1,24 @@
package com.teaching.backend.controller.Know;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @Author:youhang
* @Date:2024-09-02-9:47
* @Description:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RelsNodesVO {
@NonNull
private String courseId;
private Integer level;
private List<String> types;
}

@ -833,8 +833,23 @@ public class knowServiceImpl implements KnowService {
@Override
public BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(String courseId, Integer level,List<String> types) {
List<String> typesTemp = new ArrayList<>();
String str;
if(types == null || types.size() <= 0){
typesTemp.add("contain");
typesTemp.add("orer");
typesTemp.add("dependent");
str = "match(n:Know)-[r:";
for (int i = 0; i < typesTemp.size(); i++) {
if (i == typesTemp.size() - 1) {
str = str + typesTemp.get(i) + "*";
} else {
str = str + typesTemp.get(i) + "|";
}
String str = "match(n:Know)-[r:";
}
}else{
str = "match(n:Know)-[r:";
for (int i = 0; i < types.size(); i++) {
if (i == types.size() - 1) {
str = str + types.get(i) + "*";
@ -843,6 +858,8 @@ public class knowServiceImpl implements KnowService {
}
}
}
if(level == null || level <= 0){
str = str +"]->(p:Know) where n.courseId = '" + courseId + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`";
}else{

Loading…
Cancel
Save