知识点xiugai2

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

@ -51,7 +51,7 @@ public class KnowController {
return knowService.knowLearnPath(corseId); return knowService.knowLearnPath(corseId);
} }
//生成知识点学习路径 默认从第一个知识点到第最后个知识点 //生成知识点学习路径 默认从第一个知识点到第最后个知识点
@ApiOperation(value = "生成知识点学习路径") @ApiOperation(value = "生成知识点学习路径-图信息")
@GetMapping("/knowLearnPathGraph") @GetMapping("/knowLearnPathGraph")
BaseResponse<BaseKnowReturn> knowLearnPathGraph(@RequestParam String corseId){ BaseResponse<BaseKnowReturn> knowLearnPathGraph(@RequestParam String corseId){
return knowService.knowLearnPathGraph(corseId); return knowService.knowLearnPathGraph(corseId);
@ -74,9 +74,12 @@ public class KnowController {
//返回课程下指定关系的知识图谱 //返回课程下指定关系的知识图谱
@ApiOperation(value = "返回课程下指定关系的知识图谱") @ApiOperation(value = "返回课程下指定关系的知识图谱")
@GetMapping("/getRelsNodesByCourseId") @PostMapping("/getRelsNodesByCourseId")
BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(@RequestParam String courseId,@RequestParam Integer level,@RequestParam List<String>types){ BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(@RequestBody RelsNodesVO relsNodesVO){
return knowService.getRelsNodesByCourseId(courseId, level,types); 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,16 +833,33 @@ public class knowServiceImpl implements KnowService {
@Override @Override
public BaseResponse<BaseKnowReturn> getRelsNodesByCourseId(String courseId, Integer level,List<String> types) { 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:";
for (int i = 0; i < types.size(); i++) {
if (i == types.size() - 1) {
str = str + types.get(i) + "*";
} else {
str = str + types.get(i) + "|";
} }
}else{
str = "match(n:Know)-[r:";
for (int i = 0; i < types.size(); i++) {
if (i == types.size() - 1) {
str = str + types.get(i) + "*";
} else {
str = str + types.get(i) + "|";
}
}
} }
if(level == null || level <= 0){ 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`"; str = str +"]->(p:Know) where n.courseId = '" + courseId + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`";
}else{ }else{

Loading…
Cancel
Save