diff --git a/pom.xml b/pom.xml
index af309d8..6fdc2db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,12 @@
commons-io
1.4
+
+ org.springframework
+ spring-test
+ 5.1.5.RELEASE
+
+
diff --git a/src/main/java/com/teaching/backend/common/ErrorCode.java b/src/main/java/com/teaching/backend/common/ErrorCode.java
index 6685de7..4b2a66e 100644
--- a/src/main/java/com/teaching/backend/common/ErrorCode.java
+++ b/src/main/java/com/teaching/backend/common/ErrorCode.java
@@ -27,6 +27,8 @@ public enum ErrorCode {
CONTENT_EXISTS(41000, "内容存在"),
KNOWS_EXISTS(41001, "存在关联的知识点"),
+ ADD_RELATION_FAILED(41002, "添加关系失败"),
+
FORBIDDEN_ERROR(40300, "禁止访问"),
@@ -44,7 +46,10 @@ public enum ErrorCode {
UPLOAD_FAILED(40006, "上传失败"),
DELETE_RELATIONSHIP_FAILED(40006, "添加关系失败"),
+
+ KNOW_EXISIT(40007, "课程已存在"),
SYSTEM_ERROR(50000, "系统内部异常"),
+ FILE_ERROR(50010, "附件无效"),
UNKNOW_ERROR(50002, "系统内部异常"),
OPERATION_ERROR(50001, "操作失败");
diff --git a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java b/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java
index b29720e..261bf7b 100644
--- a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java
+++ b/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java
@@ -6,17 +6,16 @@ package com.teaching.backend.controller.KnowGraph;
* @Description:
*/
import com.teaching.backend.common.BaseResponse;
-import com.teaching.backend.common.ResultUtils;
-import com.teaching.backend.model.dto.KnowGraph.*;
-import com.teaching.backend.model.dto.chapter.ChapterDTO;
-import com.teaching.backend.model.dto.courses.CoursesDTO;
-import com.teaching.backend.model.entity.KnowGraph.Know;
-import com.teaching.backend.model.entity.KnowGraph.KnowChapter;
-import com.teaching.backend.model.entity.KnowGraph.KnowCourse;
-import com.teaching.backend.model.entity.chapter.Chapter;
-import com.teaching.backend.model.entity.courses.Courses;
+import com.teaching.backend.common.ResultUtils;
+import com.teaching.backend.model.dto.KnowGraph.BaseKnowReturn;
+import com.teaching.backend.model.dto.Knowtemp.KnowtempAdd;
+import com.teaching.backend.model.dto.Knowtemp.KnowtempUpdate;
+import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
+import com.teaching.backend.model.vo.knowGraph.KnowVO;
+import com.teaching.backend.model.vo.knowGraph.KnowVO1;
import com.teaching.backend.service.KnowGraph.KnowService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -27,86 +26,38 @@ import java.util.Set;
@RequestMapping("/know")
public class KnowController {
+ @Autowired
private KnowService knowService;
- public KnowController(KnowService knowService) {
- this.knowService = knowService;
- }
-
- //根据 id查询所关联的所有结点
- @PostMapping ("/query/{id}")
- public List queryKnowAllKnowById(@PathVariable Long id) {
- return knowService.queryKnowAllKnowById(id);
- }
-
- //添加知识点
+ //根据 章节id 创建知识点到mysql中
@PostMapping("/add")
- public BaseResponse createKnow(@RequestBody KnowRequest knowRequest) {
- return knowService.createKnow(knowRequest);
- }
- //修改知识点
- @PostMapping ("/update")
- public BaseResponse updateKnow(@RequestBody KnowUpdateRequest knowUpdateRequest) {
- return knowService.updateKnow(knowUpdateRequest);
- }
- //删除知识点
- @GetMapping ("delete/{id}")
- public BaseResponse deleteKnow(@PathVariable Long id) {
- return knowService.deleteKnow(id);
- }
-
- //添加知识点 - 课程
- @PostMapping("/add/KnowCourse")
- public BaseResponse createCourseKnow(@RequestBody Courses courses) {
- return knowService.createCourseKnow(courses);
- }
-
- //修改知识点 - 课程
- @PostMapping("/update/KnowCourse")
- public BaseResponse updateCourseKnow(@RequestBody Courses courses) {
- return knowService.createCourseKnow(courses);
- }
-
- //删除知识点 - 课程
- @PostMapping("/delete/KnowCourse")
- public BaseResponse deleteCourseKnow(@RequestParam String courseId) {
- return knowService.deleteCourseKnow(courseId);
+ public BaseResponse add(@RequestBody KnowtempAdd knowtempAdd) {
+ return knowService.add(knowtempAdd);
}
- //添加知识点 - 章节
- @PostMapping("/addKnowChapter")
- public BaseResponse createKnowChapter(@RequestBody Chapter chapter) {
- return knowService.createKnowChapter(chapter);
+ @PostMapping("/update")
+ public BaseResponse update(@RequestBody KnowtempUpdate knowtempUpdate) {
+ return knowService.update(knowtempUpdate);
}
-
- //修改知识点 - 章节
- @PostMapping("/update/KnowChapter")
- public BaseResponse updateKnowChapter(@RequestBody Chapter chapter) {
- return knowService.updateKnowChapter(chapter);
+ @PostMapping("/delete")
+ public BaseResponse delete(@RequestParam Long id) {
+ return knowService.delete(id);
}
- //删除知识点 - 章节
- @PostMapping("/delete/KnowChapter")
- public BaseResponse deleteKnowChapter(@RequestParam Long chapterId) {
- return knowService.deleteKnowChapter(chapterId);
+ @PostMapping("/query")
+ public BaseResponse query(@RequestParam Long id) {
+ return knowService.query(id);
}
- @GetMapping("/KnowBychapterId")
- public Set queryByChapterId(@RequestParam Long chapterId) {
- return knowService.queryByChapterId(chapterId);
+ //根据 课程id 从chapter表中获取List 章节
+ @PostMapping("/addAll")
+ public BaseResponse addAll(@RequestParam String id) {
+ return knowService.saveKnowToNeo(id);
}
-
-
- //添加知识点与知识点的关系 related
- @PostMapping ("/addKnowRelatedKnow")
- public BaseResponse addKnowRelatedKnow(@RequestBody RelationshipKnowRequest relationshipKnowRequest) {
- return knowService.addKnowRelatedKnow(relationshipKnowRequest);
- }
-
- //添加知识点与知识点的关系 fatherandSon
- @PostMapping ("/addKnowFatherAndSonKnow")
- public BaseResponse addKnowFatherAndSonKnow(@RequestBody RelationshipKnowRequest relationshipKnowRequest) {
- return knowService.addKnowFatherAndSonKnow(relationshipKnowRequest);
+ // 改变节点关系
+ @PostMapping("/update/relationship")
+ public BaseResponse updateRelationship(@RequestParam Long id, @RequestParam List ids, @RequestParam String relationship) {
+ return knowService.updateRelationship(id,ids,relationship);
}
//获取该节点下所有的节点
@@ -115,13 +66,99 @@ public class KnowController {
BaseKnowReturn baseKnowReturn =knowService.getKnowAll(id);
return ResultUtils.success(baseKnowReturn);
}
-
- //返回该节点以及二级节点
- @GetMapping("/KnowById")
- public BaseResponse getKnowById(@RequestParam Long id) {
- BaseKnowReturn baseKnowReturn =knowService.getKnowById(id);
- return ResultUtils.success(baseKnowReturn);
- }
+ @GetMapping("/getAllByCourseId")
+ public BaseResponse> getKnowByCourseId(String id) {
+ return knowService.getKnowByCourseId(id);
+ }
+// //根据 id查询所关联的所有结点
+// @PostMapping ("/query/{id}")
+// public List queryKnowAllKnowById(@PathVariable Long id) {
+// return knowService.queryKnowAllKnowById(id);
+// }
+//
+// //添加知识点
+// @PostMapping("/add")
+// public BaseResponse createKnow(@RequestBody KnowRequest knowRequest) {
+// return knowService.createKnow(knowRequest);
+// }
+// //修改知识点
+// @PostMapping ("/update")
+// public BaseResponse updateKnow(@RequestBody KnowUpdateRequest knowUpdateRequest) {
+// return knowService.updateKnow(knowUpdateRequest);
+// }
+// //删除知识点
+// @GetMapping ("delete/{id}")
+// public BaseResponse deleteKnow(@PathVariable Long id) {
+// return knowService.deleteKnow(id);
+// }
+//
+// //添加知识点 - 课程
+// @PostMapping("/add/KnowCourse")
+// public BaseResponse createCourseKnow(@RequestBody Courses courses) {
+// return knowService.createCourseKnow(courses);
+// }
+//
+// //修改知识点 - 课程
+// @PostMapping("/update/KnowCourse")
+// public BaseResponse updateCourseKnow(@RequestBody Courses courses) {
+// return knowService.createCourseKnow(courses);
+// }
+//
+// //删除知识点 - 课程
+// @PostMapping("/delete/KnowCourse")
+// public BaseResponse deleteCourseKnow(@RequestParam String courseId) {
+// return knowService.deleteCourseKnow(courseId);
+// }
+//
+// //添加知识点 - 章节
+// @PostMapping("/addKnowChapter")
+// public BaseResponse createKnowChapter(@RequestBody Chapter chapter) {
+// return knowService.createKnowChapter(chapter);
+// }
+//
+// //修改知识点 - 章节
+// @PostMapping("/update/KnowChapter")
+// public BaseResponse updateKnowChapter(@RequestBody Chapter chapter) {
+// return knowService.updateKnowChapter(chapter);
+// }
+// //删除知识点 - 章节
+// @PostMapping("/delete/KnowChapter")
+// public BaseResponse deleteKnowChapter(@RequestParam Long chapterId) {
+// return knowService.deleteKnowChapter(chapterId);
+// }
+//
+// @GetMapping("/KnowBychapterId")
+// public Set queryByChapterId(@RequestParam Long chapterId) {
+// return knowService.queryByChapterId(chapterId);
+// }
+//
+//
+//
+// //添加知识点与知识点的关系 related
+// @PostMapping ("/addKnowRelatedKnow")
+// public BaseResponse addKnowRelatedKnow(@RequestBody RelationshipKnowRequest relationshipKnowRequest) {
+// return knowService.addKnowRelatedKnow(relationshipKnowRequest);
+// }
+//
+// //添加知识点与知识点的关系 fatherandSon
+// @PostMapping ("/addKnowFatherAndSonKnow")
+// public BaseResponse addKnowFatherAndSonKnow(@RequestBody RelationshipKnowRequest relationshipKnowRequest) {
+// return knowService.addKnowFatherAndSonKnow(relationshipKnowRequest);
+// }
+//
+// //获取该节点下所有的节点
+// @GetMapping("/all")
+// public BaseResponse getKnowAll(@RequestParam String id) {
+// BaseKnowReturn baseKnowReturn =knowService.getKnowAll(id);
+// return ResultUtils.success(baseKnowReturn);
+// }
+//
+// //返回该节点以及二级节点
+// @GetMapping("/KnowById")
+// public BaseResponse getKnowById(@RequestParam Long id) {
+// BaseKnowReturn baseKnowReturn =knowService.getKnowById(id);
+// return ResultUtils.success(baseKnowReturn);
+// }
}
diff --git a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowGraphController.java b/src/main/java/com/teaching/backend/controller/KnowGraph/KnowGraphController.java
new file mode 100644
index 0000000..dcbc2d8
--- /dev/null
+++ b/src/main/java/com/teaching/backend/controller/KnowGraph/KnowGraphController.java
@@ -0,0 +1,56 @@
+//package com.teaching.backend.controller.KnowGraph;
+//
+//import com.teaching.backend.common.BaseResponse;
+//import com.teaching.backend.model.dto.Knowtemp.KnowtempAdd;
+//import com.teaching.backend.model.dto.Knowtemp.KnowtempUpdate;
+//import com.teaching.backend.model.entity.KnowGraph.Know;
+//import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
+//import com.teaching.backend.model.entity.chapter.Chapter;
+//import com.teaching.backend.service.KnowGraph.KnowGraphService;
+//import io.swagger.models.auth.In;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.*;
+//
+//import java.util.List;
+//
+///**
+// * @Author:youhang
+// * @Date:2024-07-29-10:32
+// * @Description:
+// */
+//@RestController
+//@RequestMapping("/knowGraph")
+//public class KnowGraphController {
+//
+// @Autowired
+// private KnowGraphService knowGraphService;
+//
+// //add knowtemp
+// @PostMapping("/add")
+// public BaseResponse add(@RequestBody KnowtempAdd knowtempAdd) {
+// return knowGraphService.add(knowtempAdd);
+// }
+//
+// @PostMapping("/update")
+// public BaseResponse update(@RequestBody KnowtempUpdate knowtempUpdate) {
+// return knowGraphService.update(knowtempUpdate);
+// }
+// @PostMapping("/delete")
+// public BaseResponse delete(@RequestParam Integer id) {
+// return knowGraphService.delete(id);
+// }
+// @PostMapping("/query")
+// public BaseResponse query(@RequestParam Integer id) {
+// return knowGraphService.query(id);
+// }
+//
+//
+// //根据 课程id 从chapter表中获取List 章节
+// @PostMapping("/addAll")
+// public BaseResponse addAll(@PathVariable String id) {
+// return knowGraphService.saveKnowToNeo(id);
+// }
+//
+//
+//
+//}
diff --git a/src/main/java/com/teaching/backend/controller/KnowGraph/ResourcesController.java b/src/main/java/com/teaching/backend/controller/KnowGraph/ResourcesController.java
index 9892f91..f8411eb 100644
--- a/src/main/java/com/teaching/backend/controller/KnowGraph/ResourcesController.java
+++ b/src/main/java/com/teaching/backend/controller/KnowGraph/ResourcesController.java
@@ -14,6 +14,7 @@ import com.teaching.backend.model.entity.KnowGraph.Know;
import com.teaching.backend.model.entity.KnowGraph.Resources;
import com.teaching.backend.service.KnowGraph.ResourcesService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -27,10 +28,8 @@ import java.util.Set;
@RequestMapping("/resources")
public class ResourcesController {
+ @Autowired
private ResourcesService resourcesService;
- public ResourcesController(ResourcesService resourcesService) {
- this.resourcesService = resourcesService;
- }
//添加知识点
@PostMapping("/upload")
@@ -70,7 +69,7 @@ public class ResourcesController {
resourcesService.deleteResources(id);
}
- //添加知识点与知识点的关系 related
+ //添加知识点与资源的关系
@PostMapping ("/addKnowResourcesResources")
public void addKnowWithResource(@RequestBody RelationshipResourceRequest relationshipResourceRequest) {
resourcesService.addKnowWithResources(relationshipResourceRequest);
@@ -82,7 +81,7 @@ public class ResourcesController {
}
@GetMapping ("queryBesidesKnowToResources/{KnowId}")
- public Set queryBesidesKnowToResources(@PathVariable Long KnowId) {
+ public List queryBesidesKnowToResources(@PathVariable Long KnowId) {
return resourcesService.queryBesidesKnowToResources(KnowId);
}
diff --git a/src/main/java/com/teaching/backend/controller/resource/ResourceController.java b/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
index a9c9dec..16102ee 100644
--- a/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
+++ b/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
@@ -5,6 +5,7 @@ import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.service.KnowGraph.ResourcesService;
import com.teaching.backend.service.resource.ResourceService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -25,14 +26,13 @@ import java.io.*;
@RequestMapping("/resource")
public class ResourceController {
-
- private ResourceService resourceService;
+ @Autowired
+ private ResourcesService resourcesService;
//添加知识点
@PostMapping("/upload")
- public String uploadFile(@RequestParam("file")MultipartFile file) {
- System.out.println(file.getOriginalFilename());
- return resourceService.upload(file);
+ public BaseResponse uploadFile(@RequestParam("file")MultipartFile file) {
+ return resourcesService.uploadFile(file);
}
diff --git a/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java b/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java
index 7483a9c..cbfbcf6 100644
--- a/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java
+++ b/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java
@@ -23,8 +23,6 @@ public interface KnowRepository extends Neo4jRepository {
@Query("MATCH (p:Know) where ID(p) = $id RETURN count(p);")
Boolean deleteKnow(Long id);
- @Query("MATCH (p:Know), (c:Know) WHERE ID(p) = $id AND ID(c) IN $KnowIds CREATE (p)-[r:related]->(c),(c)-[:related]->(p) return count(r)")
- int addKnowRelatedKnow(Long id, List KnowIds);
@Query("MATCH (p:Know), (c:Know) WHERE ID(p) = $id AND ID(c) IN $KnowIds CREATE (p)-[r:FatherAndSon]->(c) return r")
int addKnowFatherAndSonKnow(Long id, List KnowIds);
@@ -33,8 +31,8 @@ public interface KnowRepository extends Neo4jRepository {
List queryKnowAllKnowById(Long id);
- @Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info}) return n")
- KnowCourse createKnowCourse(String courseId, String name, String info);
+ @Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info}) return count(n)")
+ int createKnowCourse(String courseId, String name, String info);
@Query("MATCH (p:Know {courseId:$courseId }) SET p.name = $name set p.info= $info RETURN p;")
Boolean updateKnowCourse(String courseId, String name, String info);
@@ -43,7 +41,7 @@ public interface KnowRepository extends Neo4jRepository {
Boolean deleteKnowCourse(String courseId);
@Query("CREATE (n:Know {name: $name, chapterId: $chapterId,info:$info}) return count(n)")
- KnowChapter createKnowChapter(Long chapterId, String name, String info);
+ int createKnowChapter(Long chapterId, String name, String info);
@Query("MATCH (p:Know {chapterId:$chapterId }) SET p.name = $name set p.info= $info RETURN p;")
Boolean updateKnowChapter(Long chapterId, String name, String info);
@@ -54,4 +52,27 @@ public interface KnowRepository extends Neo4jRepository {
@Query("MATCH(n:Know)-[r:FatherAndSon*]->(nn:Know) where n.chapterId = $chapterId RETURN nn")
Set queryByChapterId(Long chapterId);
+
+ //在章节表里面添加章与课程的关系
+ @Query("MATCH (p:Know), (c:Know) WHERE p.courseId = $courseId AND c.chapterId = $ChapterId CREATE (p)-[r:FatherAndSon]->(c) return count(r)")
+ int addChapterAndCourse(String courseId, Long ChapterId);
+
+ //添加章与节的关系
+ @Query("MATCH (p:Know), (c:Know) WHERE p.chapterId = $ChapterId1 AND c.chapterId = $ChapterId2 CREATE (p)-[r:FatherAndSon]->(c) return count(r)")
+ int addChapterAndCourse( Long ChapterId1, Long ChapterId2);
+
+ //创造知识点并,添加节与知识点的关系
+ @Query("MATCH (p:Know) WHERE p.chapterId = $ChapterId CREATE (c:Know{name:$name,info:$info}),(p)-[r:FatherAndSon]->(c) return count(r)")
+ int CreateKnowaddChapter( Long ChapterId, String name,String info);
+
+ @Query("MATCH (p:Know), (c:Know) WHERE ID(p) = $id AND ID(c) IN $KnowIds CREATE (p)-[r:FatherAndSon]->(c),(c)-[:related]->(p) return count(r)")
+ int addKnowWithFaherAndSon(Long id, List KnowIds);
+
+ @Query("MATCH (p:Know), (c:Know) WHERE ID(p) = $id AND ID(c) IN $KnowIds CREATE (p)-[r:related]->(c),(c)-[:related]->(p) return count(r)")
+ int addKnowWithRelated(Long id, List KnowIds);
+
+ @Query("MATCH (p:Know), (c:Know) WHERE ID(p) = $id AND ID(c) IN $KnowIds CREATE (p)-[r:PreCondition]->(c),(c)-[:related]->(p) return count(r)")
+ int addKnowWithPreCondition(Long id, List KnowIds);
+
+
}
diff --git a/src/main/java/com/teaching/backend/mapper/KnowGraph/ResourcesRepository.java b/src/main/java/com/teaching/backend/mapper/KnowGraph/ResourcesRepository.java
index 98de5e8..b4609af 100644
--- a/src/main/java/com/teaching/backend/mapper/KnowGraph/ResourcesRepository.java
+++ b/src/main/java/com/teaching/backend/mapper/KnowGraph/ResourcesRepository.java
@@ -21,11 +21,11 @@ public interface ResourcesRepository extends Neo4jRepository {
@Query("MATCH(n:Resources) where n.resourcesId = $resourcesId RETURN n")
- Resources queryResources(String resourcesId);
+ Resources queryResources(Long resourcesId);
@Query("MATCH (p:Know), (c:Resources) WHERE ID(p) = $id AND ID(c) in $ResourcesIds CREATE (p)-[r:resources]->(c)")
- void addResourceRelatedKnow(Long id, List ResourcesIds);
+ void addResourceResourcesKnow(Long id, List ResourcesIds);
@Query("MATCH(n:Know)-[r:resources]->(nn:Resources) where ID(nn) = $id RETURN nn")
@@ -34,9 +34,10 @@ public interface ResourcesRepository extends Neo4jRepository {
@Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE ID(a) = $KnowId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b")
Set queryCourseKnowToResources(Long KnowId);
- @Query(" MATCH (p:Know)-[:FatherAndSon]->(n:Know)-[:resources]->(m:Resources) WHERE ID(p) = $KnowId RETURN m")
+ @Query("MATCH (p:Know)-[:FatherAndSon]->(n:Know)-[:resources]->(m:Resources) WHERE ID(p) = $KnowId RETURN m")
Set queryBesidesKnowToResources(Long KnowId);
-
+ @Query(" MATCH (p:Know)-[:resources]->(m:Resources) WHERE ID(p) = 272 RETURN m")
+ Set queryKnowToResources(Long KnowId);
}
diff --git a/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtempMapper.java b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtempMapper.java
new file mode 100644
index 0000000..38c1cab
--- /dev/null
+++ b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtempMapper.java
@@ -0,0 +1,15 @@
+package com.teaching.backend.mapper.Knowtemp;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
+
+/**
+ * 课程点赞数据库操作
+ */
+public interface KnowtempMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourceUpdateRequest.java b/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourceUpdateRequest.java
index 7404cee..4775269 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourceUpdateRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourceUpdateRequest.java
@@ -12,7 +12,7 @@ public class ResourceUpdateRequest {
private Long id;
- private String resourceId;
+ private String name;
private Integer type;
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesAddRequest.java b/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesAddRequest.java
index 14bf6ec..32b408d 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesAddRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesAddRequest.java
@@ -11,8 +11,6 @@ import org.springframework.data.neo4j.core.schema.Property;
@Data
public class ResourcesAddRequest {
- private String resourcesId;
-
private String name;
private Integer type;
diff --git a/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java b/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java
new file mode 100644
index 0000000..953db74
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java
@@ -0,0 +1,32 @@
+package com.teaching.backend.model.dto.Knowtemp;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ *
+ *
+ * @author author
+ * @since 2024-05-31
+ */
+@Data
+public class KnowtempAdd implements Serializable {
+
+ private String name;
+
+ private String info;
+
+ private Long chapterid;
+
+ private String courseid;
+
+ private Integer ordernum;
+
+
+}
diff --git a/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempUpdate.java b/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempUpdate.java
new file mode 100644
index 0000000..427aa4b
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempUpdate.java
@@ -0,0 +1,32 @@
+package com.teaching.backend.model.dto.Knowtemp;
+
+import io.swagger.models.auth.In;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ *
+ *
+ * @author author
+ * @since 2024-05-31
+ */
+@Data
+public class KnowtempUpdate implements Serializable {
+
+ private Long id;
+
+ private String name;
+
+ private String info;
+
+ private Long chapterid;
+ private String courseid;
+
+
+ private Integer ordernum;
+
+
+}
diff --git a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java b/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java
index 2f8ada6..bacbe59 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java
+++ b/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java
@@ -18,8 +18,6 @@ public class Resources {
@GeneratedValue
private Long id;
- @Property
- private String resourcesId;
@Property
private String name;
diff --git a/src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java b/src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java
new file mode 100644
index 0000000..4538b48
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java
@@ -0,0 +1,42 @@
+package com.teaching.backend.model.entity.Knowtemp;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.models.auth.In;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ *
+ *
+ * @author author
+ * @since 2024-05-31
+ */
+@Data
+public class Knowtemp implements Serializable {
+
+ @TableField(exist = false)
+ private static final long serialVersionUID = 1L;
+
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ private String name;
+
+ private String info;
+
+ private Integer ordernum;
+
+ private Long chapterid;
+
+ private String courseid;
+
+
+}
diff --git a/src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java b/src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java
index e70465a..e03dfdf 100644
--- a/src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java
+++ b/src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.teaching.backend.model.entity.KnowGraph.Know;
+import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -59,7 +60,7 @@ public class Chapter implements Serializable {
private String content;
@ApiModelProperty(value = "父级节点")
- private String pid;
+ private Long pid;
@ApiModelProperty(value = "课程")
@@ -89,7 +90,7 @@ public class Chapter implements Serializable {
@ApiModelProperty(value = "知识点")
@TableField(exist = false)
- private List knowledgePoints; // 用于存储章节下的知识点
+ private List knowledgePoints; // 用于存储章节下的知识点
}
diff --git a/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowVO1.java b/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowVO1.java
new file mode 100644
index 0000000..98f53cf
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/vo/knowGraph/KnowVO1.java
@@ -0,0 +1,25 @@
+package com.teaching.backend.model.vo.knowGraph;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class KnowVO1 implements Serializable {
+
+
+ /**
+ * id
+ */
+ private Long id;
+
+
+ /**
+ * 知识点名称
+ */
+ private String label;
+
+
+}
+
diff --git a/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java b/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java
new file mode 100644
index 0000000..8797762
--- /dev/null
+++ b/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java
@@ -0,0 +1,138 @@
+//package com.teaching.backend.service.KnowGraph;
+//
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import com.teaching.backend.common.BaseResponse;
+//import com.teaching.backend.common.ErrorCode;
+//import com.teaching.backend.common.ResultUtils;
+//import com.teaching.backend.mapper.KnowGraph.KnowRepository;
+//import com.teaching.backend.mapper.Knowtemp.KnowtempMapper;
+//import com.teaching.backend.mapper.chapter.ChapterMapper;
+//import com.teaching.backend.mapper.courses.CoursesMapper;
+//import com.teaching.backend.model.dto.Knowtemp.KnowtempAdd;
+//import com.teaching.backend.model.dto.Knowtemp.KnowtempUpdate;
+//import com.teaching.backend.model.entity.KnowGraph.Know;
+//import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
+//import com.teaching.backend.model.entity.chapter.Chapter;
+//import com.teaching.backend.model.entity.courses.Courses;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//
+//import java.time.LocalDateTime;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * @Author:youhang
+// * @Date:2024-07-29-10:33
+// * @Description:
+// */
+//@Service
+//public class KnowGraphService {
+//
+// @Autowired
+// private ChapterMapper chapterMapper;
+//
+// @Autowired
+// private KnowtempMapper knowtempMapper;
+//
+// @Autowired
+// private CoursesMapper coursesMapper;
+//
+// @Autowired
+// private KnowRepository knowRepository;
+//
+// public BaseResponse add(KnowtempAdd knowtempAdd){
+// String name = knowtempAdd.getName();
+// String info = knowtempAdd.getInfo();
+// Integer chapterId = knowtempAdd.getChapterId();
+//
+// Knowtemp knowtemp = new Knowtemp();
+// knowtemp.setName(name);
+// knowtemp.setInfo(info);
+// knowtemp.setChapterId(chapterId);
+// int insert = knowtempMapper.insert(knowtemp);
+// if(insert > 0){
+// return ResultUtils.success("添加成功");
+// }
+// return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+// }
+//
+//// public BaseResponse update(KnowtempUpdate knowtempUpdate){
+//// Integer id = knowtempUpdate.getId();
+//// String name = knowtempUpdate.getName();
+//// String info = knowtempUpdate.getInfo();
+//// Integer chapterId = knowtempUpdate.getChapterId();
+//// Knowtemp knowtemp = new Knowtemp();
+//// knowtemp = knowtempMapper.selectById(id);
+//// if(knowtemp == null){
+//// return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
+//// }
+//// knowtemp.setName(name);
+//// knowtemp.setInfo(info);
+//// knowtemp.setChapterId(chapterId);
+//// int insert = knowtempMapper.updateById(knowtemp);
+//// if(insert > 0){
+//// return ResultUtils.success("修改成功");
+//// }
+//// return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }
+////
+//// public BaseResponse delete(Integer id){
+//// Knowtemp knowtemp = new Knowtemp();
+//// knowtemp = knowtempMapper.selectById(id);
+//// if(knowtemp == null){
+//// return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
+//// }
+//// int insert = knowtempMapper.deleteById(id);
+//// if(insert > 0){
+//// return ResultUtils.success("删除成功");
+//// }
+//// return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }
+////
+//// public BaseResponse query(Integer id){
+//// Knowtemp knowtemp = new Knowtemp();
+//// knowtemp = knowtempMapper.selectById(id);
+//// if(knowtemp != null){
+//// return ResultUtils.success(knowtemp);
+//// }
+//// return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
+//// }
+//
+//
+//// public BaseResponse saveKnowToNeo(String id) {
+//// Courses courses = coursesMapper.selectById(id);
+//// int f = knowRepository.createKnowCourse(courses.getId(),courses.getName(),courses.getDescription());
+//// if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+////
+//// List chapterList = chapterMapper.selectSectionsByCourseId(id);
+//// for (int i = 0; i < chapterList.size(); i++) {
+//// Chapter chapter = chapterList.get(i);
+//// f = knowRepository.createKnowChapter(chapter.getId(),chapter.getName(),chapter.getContent());
+//// if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }
+//// for (int i = 0; i < chapterList.size(); i++) {
+//// Chapter chapter = chapterList.get(i);
+//// if("".equals(chapter.getPid())){
+//// f = knowRepository.addCourseFatherAndSonKnow(chapter.getCourseId(),chapter.getId());
+//// if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }else{
+//// f = knowRepository.addChapterFatherAndSonKnow(chapter.getPid(),chapter.getId());
+//// if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }
+////
+//// }
+//// QueryWrapper queryWrapper = new QueryWrapper<>();
+//// queryWrapper.eq("courseid",id);
+//// List list = knowtempMapper.selectList(queryWrapper);
+//// for (int j = 0; j < list.size(); j++) {
+//// Knowtemp knowtemp = list.get(j);
+//// f = knowRepository.addFatherAndSonKnow(knowtemp.getChapterId(),knowtemp.getName(),knowtemp.getInfo());
+//// if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+//// }
+////
+//// return ResultUtils.success("添加成功");
+//// }
+//
+//
+//}
diff --git a/src/main/java/com/teaching/backend/service/KnowGraph/KnowService.java b/src/main/java/com/teaching/backend/service/KnowGraph/KnowService.java
index 4f0f1a8..b74a779 100644
--- a/src/main/java/com/teaching/backend/service/KnowGraph/KnowService.java
+++ b/src/main/java/com/teaching/backend/service/KnowGraph/KnowService.java
@@ -1,24 +1,35 @@
package com.teaching.backend.service.KnowGraph;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.KnowGraph.KnowRepository;
+import com.teaching.backend.mapper.Knowtemp.KnowtempMapper;
+import com.teaching.backend.mapper.chapter.ChapterMapper;
+import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.model.dto.KnowGraph.*;
+import com.teaching.backend.model.dto.Knowtemp.KnowtempAdd;
+import com.teaching.backend.model.dto.Knowtemp.KnowtempUpdate;
import com.teaching.backend.model.dto.chapter.ChapterDTO;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.entity.KnowGraph.Know;
import com.teaching.backend.model.entity.KnowGraph.KnowChapter;
import com.teaching.backend.model.entity.KnowGraph.KnowCourse;
import com.teaching.backend.model.entity.KnowGraph.Links;
+import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
import com.teaching.backend.model.entity.chapter.Chapter;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.vo.knowGraph.KnowVO;
+import com.teaching.backend.model.vo.knowGraph.KnowVO1;
import org.neo4j.driver.internal.InternalRelationship;
import org.neo4j.driver.types.Node;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.neo4j.core.Neo4jClient;
import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.time.LocalDateTime;
@@ -31,109 +42,132 @@ import java.util.*;
*/
@Service
public class KnowService {
-
+ @Autowired
private KnowRepository knowRepository;
+ @Autowired
+ private ChapterMapper chapterMapper;
- @Resource
- private Neo4jClient neo4jClient;
-
- public KnowService(KnowRepository knowRepository) {
- this.knowRepository = knowRepository;
- }
-
+ @Autowired
+ private KnowtempMapper knowtempMapper;
- public List queryKnowAllKnowById(Long id) {
- return knowRepository.queryKnowAllKnowById(id);
- }
+ @Autowired
+ private CoursesMapper coursesMapper;
+ @Resource
+ private Neo4jClient neo4jClient;
- public BaseResponse createKnow(KnowRequest knowRequest ) {
- String name = knowRequest.getName();
- String info = knowRequest.getInfo();
- if("".equals(name) || name.length()<=0){
- return ResultUtils.error(ErrorCode.PARAMS_EMPTY);
+ public BaseResponse add(KnowtempAdd knowtempAdd){
+ String name = knowtempAdd.getName();
+ String info = knowtempAdd.getInfo();
+ Long chapterId = knowtempAdd.getChapterid();
+ String courseid = knowtempAdd.getCourseid();
+ Knowtemp knowtemp = new Knowtemp();
+ knowtemp.setName(name);
+ knowtemp.setInfo(info);
+ knowtemp.setChapterid(chapterId);
+ knowtemp.setCourseid(courseid);
+ int insert = knowtempMapper.insert(knowtemp);
+ if(insert > 0){
+ return ResultUtils.success("添加成功");
}
- Know know = new Know();
- BeanUtils.copyProperties(knowRequest,know);
- return ResultUtils.success(knowRepository.save(know)) ;
+ return ResultUtils.error(ErrorCode.OPERATION_ERROR);
}
-
- public BaseResponse updateKnow(KnowUpdateRequest knowUpdateRequest ) {
- Know know = new Know();
- try {
- know = knowRepository.findById(knowUpdateRequest.getId()).orElseThrow(() -> new RuntimeException("知识点 not found"));
- }catch (RuntimeException e){
+ public BaseResponse update(KnowtempUpdate knowtempUpdate){
+ Long id = knowtempUpdate.getId();
+ String name = knowtempUpdate.getName();
+ String info = knowtempUpdate.getInfo();
+ Long chapterId = knowtempUpdate.getChapterid();
+ String courseid = knowtempUpdate.getCourseid();
+ Knowtemp knowtemp = new Knowtemp();
+ knowtemp = knowtempMapper.selectById(id);
+ if(knowtemp == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
}
- String name = knowUpdateRequest.getName();
- String info = knowUpdateRequest.getInfo();
- if("".equals(name) || name.length()<=0){
- return ResultUtils.error(ErrorCode.PARAMS_EMPTY);
+ knowtemp.setName(name);
+ knowtemp.setInfo(info);
+ knowtemp.setChapterid(chapterId);
+ knowtemp.setCourseid(courseid);
+ int insert = knowtempMapper.updateById(knowtemp);
+ if(insert > 0){
+ return ResultUtils.success("修改成功");
}
- BeanUtils.copyProperties(knowUpdateRequest,know);
- return ResultUtils.success(knowRepository.save(know));
+ return ResultUtils.error(ErrorCode.OPERATION_ERROR);
}
- public BaseResponse deleteKnow(Long id) {
- Boolean f = knowRepository.deleteKnow(id);
- if(f)return ResultUtils.success("删除成功");
- return ResultUtils.error(ErrorCode.DELETE_FAILED);
- }
-
-
- public BaseResponse createCourseKnow( Courses courses) {
- String courseId = courses.getId();
- String name = courses.getName();
- String description = courses.getDescription();
- return ResultUtils.success(knowRepository.createKnowCourse(courseId,name,description));
+ public BaseResponse delete(Long id){
+ Knowtemp knowtemp = new Knowtemp();
+ knowtemp = knowtempMapper.selectById(id);
+ if(knowtemp == null){
+ return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
+ }
+ int insert = knowtempMapper.deleteById(id);
+ if(insert > 0){
+ return ResultUtils.success("删除成功");
+ }
+ return ResultUtils.error(ErrorCode.OPERATION_ERROR);
}
- public BaseResponse deleteCourseKnow( String courseId) {
- boolean f = knowRepository.deleteKnowCourse(courseId);
- if(f)return ResultUtils.success("删除成功");
- return ResultUtils.error(ErrorCode.DELETE_FAILED);
+ public BaseResponse query(Long id){
+ Knowtemp knowtemp = new Knowtemp();
+ knowtemp = knowtempMapper.selectById(id);
+ if(knowtemp != null){
+ return ResultUtils.success(knowtemp);
+ }
+ return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
}
- public Boolean updateCourseKnow( Courses courses) {
- String id = courses.getId();
- String name = courses.getName();
- String description = courses.getDescription();
- return knowRepository.updateKnowCourse(id,name,description);
+ public BaseResponse saveKnowToNeo(String id) {
+ Courses courses = coursesMapper.selectById(id);
+ int f = knowRepository.createKnowCourse(courses.getId(),courses.getName(),courses.getDescription());
+ if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
- }
+ List chapterList = chapterMapper.selectSectionsByCourseId(id);
+ for (int i = 0; i < chapterList.size(); i++) {
+ Chapter chapter = chapterList.get(i);
+ f = knowRepository.createKnowChapter(chapter.getId(),chapter.getName(),chapter.getContent());
+ if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+ }
+ for (int i = 0; i < chapterList.size(); i++) {
+ Chapter chapter = chapterList.get(i);
+ if(chapter.getPid()== 0){
+ f = knowRepository.addChapterAndCourse(chapter.getCourseId(),chapter.getId());
+ if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+ }else{
+ f = knowRepository.addChapterAndCourse(chapter.getPid(),chapter.getId());
+ if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+ }
- public BaseResponse createKnowChapter(Chapter chapter) {
- return ResultUtils.success(knowRepository.createKnowChapter(chapter.getId(), chapter.getName(), chapter.getContent()));
+ }
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("courseid",id);
+ List list = knowtempMapper.selectList(queryWrapper);
+ for (int j = 0; j < list.size(); j++) {
+ Knowtemp knowtemp = list.get(j);
+ f = knowRepository.CreateKnowaddChapter(knowtemp.getChapterid(),knowtemp.getName(),knowtemp.getInfo());
+ if(f <= 0)return ResultUtils.error(ErrorCode.OPERATION_ERROR);
+ }
+ return ResultUtils.success("添加成功");
}
- public BaseResponse updateKnowChapter(Chapter chapter) {
- return ResultUtils.success(knowRepository.createKnowChapter(chapter.getId(), chapter.getName(), chapter.getContent()));
- }
- public BaseResponse deleteKnowChapter(Long chapterId) {
- boolean f = knowRepository.deleteKnowChapter(chapterId);
- if(f)return ResultUtils.success("删除成功");
- return ResultUtils.error(ErrorCode.DELETE_FAILED);
- }
- public Set queryByChapterId(Long chapterId){
- Set knows = knowRepository.queryByChapterId(chapterId);
- return knows;
- }
-
-
- public BaseResponse addKnowRelatedKnow(RelationshipKnowRequest relationshipKnowRequest) {
- int num = knowRepository.addKnowRelatedKnow(relationshipKnowRequest.getId(),relationshipKnowRequest.getKnowIds());
- if(num == relationshipKnowRequest.getKnowIds().size())return ResultUtils.success("添加关系成功,共添加了"+num+" 条关系");
- return ResultUtils.error(ErrorCode.DELETE_RELATIONSHIP_FAILED);
- }
- public BaseResponse addKnowFatherAndSonKnow( RelationshipKnowRequest relationshipKnowRequest) {
- int num = knowRepository.addKnowFatherAndSonKnow(relationshipKnowRequest.getId(),relationshipKnowRequest.getKnowIds());
- if(num == relationshipKnowRequest.getKnowIds().size())return ResultUtils.success("添加关系成功,共添加了"+num+" 条关系");
- return ResultUtils.error(ErrorCode.DELETE_RELATIONSHIP_FAILED);
+ public BaseResponse updateRelationship(Long id,List ids,String relationship){
+ //必须先学id1的知识点才能学习id2的知识点
+ int f = -1;
+ if("PreCondition".equals(relationship)){
+ f = knowRepository.addKnowWithPreCondition(id,ids);
+ if(f<=0)return ResultUtils.error(ErrorCode.ADD_RELATION_FAILED);
+ } else if ("FatherAndSon".equals(relationship)) {
+ f = knowRepository.addKnowWithFaherAndSon(id,ids);
+ if(f<=0)return ResultUtils.error(ErrorCode.ADD_RELATION_FAILED);
+ }else{
+ f = knowRepository.addKnowWithRelated(id,ids);
+ if(f<=0)return ResultUtils.error(ErrorCode.ADD_RELATION_FAILED);
+ }
+ return ResultUtils.success("添加成功");
}
- public BaseKnowReturn getKnowAll(String id) {
+ public BaseKnowReturn getKnowAll(String id) {
Collection