diff --git a/pom.xml b/pom.xml
index bfd5080..19e0375 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,12 @@
poi-ooxml
+
+
+ io.minio
+ minio
+ 8.2.1
+
commons-fileupload
diff --git a/src/main/java/com/teaching/backend/config/CorsConfig.java b/src/main/java/com/teaching/backend/config/CorsConfig.java
index 9703e85..ba5230f 100644
--- a/src/main/java/com/teaching/backend/config/CorsConfig.java
+++ b/src/main/java/com/teaching/backend/config/CorsConfig.java
@@ -11,6 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
+
@Override
public void addCorsMappings(CorsRegistry registry) {
// 覆盖所有请求
diff --git a/src/main/java/com/teaching/backend/config/SecurityConfig.java b/src/main/java/com/teaching/backend/config/SecurityConfig.java
index 6e5b527..41c5947 100644
--- a/src/main/java/com/teaching/backend/config/SecurityConfig.java
+++ b/src/main/java/com/teaching/backend/config/SecurityConfig.java
@@ -12,6 +12,8 @@ import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.security.web.firewall.HttpFirewall;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
/**
@@ -35,6 +37,20 @@ public class SecurityConfig {
@Autowired(required = false)
private DynamicSecurityFilter dynamicSecurityFilter;
+ /**
+ * 配置地址栏不能识别 // 的情况
+ * @return
+ */
+ @Bean
+ public HttpFirewall allowUrlEncodedSlashHttpFirewall() {
+ StrictHttpFirewall firewall = new StrictHttpFirewall();
+ //此处可添加别的规则,目前只设置 允许双 //
+ firewall.setAllowUrlEncodedDoubleSlash(true);
+ return firewall;
+ }
+
+
+
@Bean
SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity
diff --git a/src/main/java/com/teaching/backend/constant/ViewContentTypeEnum.java b/src/main/java/com/teaching/backend/constant/ViewContentTypeEnum.java
new file mode 100644
index 0000000..cb5b6b2
--- /dev/null
+++ b/src/main/java/com/teaching/backend/constant/ViewContentTypeEnum.java
@@ -0,0 +1,74 @@
+package com.teaching.backend.constant;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author:youhang
+ * @Date:2024-08-07-9:14
+ * @Description:
+ */
+public enum ViewContentTypeEnum {
+ DEFAULT("default","application/octet-stream"),
+ PNG("png", "image/png"),
+ JPEG("jpeg", "image/jpeg"),
+ JPG("jpg", "image/jpeg"),
+ GIF("gif", "image/gif"),
+ WBMP("wbmp", "image/vnd.wap.wbmp"),
+ TIFF("tiff", "image/tiff"),
+ JFIF("jfif", "image/jpeg"),
+ TIF("tif", "image/tiff"),
+ FAX("fax", "image/fax"),
+ JPE("jpe", "image/jpeg"),
+ NET("net", "image/pnetvue"),
+ RP("rp", "image/vnd.rn-realpix"),
+ ICO("ico", "image/x-icon");
+
+ private String prefix;
+
+ private String type;
+
+ private static final Map ENUM_MAP = new HashMap<>();
+
+ static {
+ ViewContentTypeEnum[] values = values();
+ for (ViewContentTypeEnum value : values) {
+ ENUM_MAP.put(value.getPrefix(), value);
+ }
+ }
+
+ public static String getTypeByPrefix(String prefix) {
+ ViewContentTypeEnum viewContentTypeEnum = ENUM_MAP.get(prefix);
+ if (viewContentTypeEnum == null) {
+ return prefix;
+ }
+ return viewContentTypeEnum.getType();
+ }
+
+ public static String getContentType(String prefix){
+ if(StringUtils.isEmpty(prefix)){
+ return DEFAULT.getType();
+ }
+ prefix = prefix.substring(prefix.lastIndexOf(".") + 1);
+ String type = getTypeByPrefix(prefix);
+ if (StringUtils.isNotEmpty(type)) {
+ return type;
+ }
+ return DEFAULT.getType();
+ }
+
+ ViewContentTypeEnum(String prefix, String type) {
+ this.prefix = prefix;
+ this.type = type;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public String getType() {
+ return type;
+ }
+}
diff --git a/src/main/java/com/teaching/backend/controller/Know/KnowController.java b/src/main/java/com/teaching/backend/controller/Know/KnowController.java
new file mode 100644
index 0000000..ee8b95d
--- /dev/null
+++ b/src/main/java/com/teaching/backend/controller/Know/KnowController.java
@@ -0,0 +1,129 @@
+package com.teaching.backend.controller.Know;
+
+/**
+ * @Author:youhang
+ * @Date:2024-06-09-9:55
+ * @Description:
+ */
+import com.teaching.backend.common.BaseResponse;
+
+import com.teaching.backend.model.dto.Know.*;
+import com.teaching.backend.model.entity.know.Know;
+import com.teaching.backend.model.entity.know.KnowChapter;
+import com.teaching.backend.model.entity.know.KnowCourse;
+import com.teaching.backend.model.entity.resource.Resources;
+import com.teaching.backend.model.vo.knowGraph.KnowVO1;
+
+import com.teaching.backend.service.Know.KnowService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Set;
+
+
+@RestController
+@RequestMapping("/knowNeo")
+public class KnowController {
+
+ @Autowired
+ private KnowService knowService;
+
+ // 添加知识点
+ @PostMapping("/addKnow")
+ BaseResponse addKnow(@RequestBody KnowRequest knowRequest){
+ return knowService.addKnow(knowRequest);
+ }
+
+ // 修改知识点
+ @PostMapping("/updateKnow")
+ BaseResponse updateKnow(@RequestBody KnowUpdateRequest knowUpdateRequest){
+ return knowService.updateKnow(knowUpdateRequest);
+ }
+
+ // 删除知识点
+ @GetMapping("/deleteKnow")
+ BaseResponse deleteKnow(@RequestParam Long id){
+ return knowService.deleteKnow(id);
+ }
+
+ //查询知识点通过id
+ @GetMapping("/queryKnow")
+ BaseResponse queryKnow(@RequestParam Long id){
+ return knowService.queryKnow(id);
+ }
+
+ //======================================
+
+ // 添加课程
+ @PostMapping("/addCourse")
+ BaseResponse addCourse(@RequestBody KnowCourseCreateRequest knowCourseCreateRequest){
+ return knowService.addCourse(knowCourseCreateRequest);
+ }
+
+ // 修改课程
+ @PostMapping("/updateCourse")
+ BaseResponse updateCourse(@RequestBody KnowCourseCreateRequest knowCourseCreateRequest){
+ return knowService.updateCourse(knowCourseCreateRequest);
+ }
+
+
+ // 删除课程
+ @PostMapping("/deleteCourse")
+ BaseResponse deleteCourse(@RequestParam String courseId){
+ return knowService.deleteCourse(courseId);
+ }
+
+ //查询课程通过courseid
+ @GetMapping ("/queryCourse")
+ BaseResponse queryCourse(@RequestParam String courseId){
+ return knowService.queryCourse(courseId);
+ }
+
+
+ //=========================
+
+ // 添加章节
+ @PostMapping("/addChapter")
+ BaseResponse addChapter(@RequestBody KnowChapterCreateRequest knowChapterCreateRequest){
+ return knowService.addChapter(knowChapterCreateRequest);
+ }
+
+ // 修改章节
+ @PostMapping("/updateChapter")
+ BaseResponse updateChapter(@RequestBody KnowChapterCreateRequest knowChapterCreateRequest){
+ return knowService.updateChapter(knowChapterCreateRequest);
+ }
+
+ // 删除章节
+ @GetMapping("/deleteChapter")
+ BaseResponse deleteChapter(@RequestParam Long chapterId){
+ return knowService.deleteChapter(chapterId);
+ }
+
+ //查询章节通过chapterId
+ @PostMapping("/queryChapter")
+ BaseResponse queryChapter(@RequestParam Long chapterId){
+ return knowService.queryChapter(chapterId);
+ }
+
+ //=====================
+
+ //获取课程下的所有知识点
+ @GetMapping("/getAllKnowByCourseId")
+ BaseKnowReturn getAllKnowByCourseId(@RequestParam String id){
+ return knowService.getAllKnowByCourseId(id);
+ }
+
+ //获取课程下的所有资源
+ @GetMapping("/getAllResourcesByCourseId")
+ BaseResponse> getAllResourcesByCourseId(@RequestParam String id){
+ return knowService.getAllResourcesByCourseId(id);
+ }
+
+ //获取知识点下二级的所有资源
+ @GetMapping("/getSecondResources")
+ Set getSecondResources(@RequestParam Long id){
+ return knowService.getSecondResources(id);
+ }
+
+}
diff --git a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java b/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java
deleted file mode 100644
index 261bf7b..0000000
--- a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowController.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package com.teaching.backend.controller.KnowGraph;
-
-/**
- * @Author:youhang
- * @Date:2024-06-09-9:55
- * @Description:
- */
-import com.teaching.backend.common.BaseResponse;
-
-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;
-import java.util.Set;
-
-
-@RestController
-@RequestMapping("/know")
-public class KnowController {
-
- @Autowired
- private KnowService knowService;
-
- //根据 章节id 创建知识点到mysql中
- @PostMapping("/add")
- public BaseResponse add(@RequestBody KnowtempAdd knowtempAdd) {
- return knowService.add(knowtempAdd);
- }
-
- @PostMapping("/update")
- public BaseResponse update(@RequestBody KnowtempUpdate knowtempUpdate) {
- return knowService.update(knowtempUpdate);
- }
- @PostMapping("/delete")
- public BaseResponse delete(@RequestParam Long id) {
- return knowService.delete(id);
- }
- @PostMapping("/query")
- public BaseResponse query(@RequestParam Long id) {
- return knowService.query(id);
- }
-
- //根据 课程id 从chapter表中获取List 章节
- @PostMapping("/addAll")
- public BaseResponse addAll(@RequestParam String id) {
- return knowService.saveKnowToNeo(id);
- }
-
- // 改变节点关系
- @PostMapping("/update/relationship")
- public BaseResponse updateRelationship(@RequestParam Long id, @RequestParam List ids, @RequestParam String relationship) {
- return knowService.updateRelationship(id,ids,relationship);
- }
-
- //获取该节点下所有的节点
- @GetMapping("/all")
- public BaseResponse getKnowAll(@RequestParam String id) {
- BaseKnowReturn baseKnowReturn =knowService.getKnowAll(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
deleted file mode 100644
index dcbc2d8..0000000
--- a/src/main/java/com/teaching/backend/controller/KnowGraph/KnowGraphController.java
+++ /dev/null
@@ -1,56 +0,0 @@
-//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
deleted file mode 100644
index f8411eb..0000000
--- a/src/main/java/com/teaching/backend/controller/KnowGraph/ResourcesController.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.teaching.backend.controller.KnowGraph;
-
-/**
- * @Author:youhang
- * @Date:2024-06-09-9:55
- * @Description:
- */
-
-
-import com.teaching.backend.common.BaseResponse;
-import com.teaching.backend.model.dto.KnowGraph.*;
-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;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-
-
-@RestController
-@RequestMapping("/resources")
-public class ResourcesController {
-
- @Autowired
- private ResourcesService resourcesService;
-
- //添加知识点
- @PostMapping("/upload")
- public BaseResponse uploadFile(@RequestParam("file")MultipartFile file) {
- return resourcesService.uploadFile(file);
- }
-
-
- //根据 id查询所关联的resources结点
- @PostMapping ("/query/{id}")
- public List queryKnowAllKnowById(@PathVariable Long id) {
- return resourcesService.queryKnowAllResources(id);
- }
-
- //添加资源
- @PostMapping("/add")
- public Resources createResources(@RequestBody ResourcesAddRequest resourceAddRequest) {
- return resourcesService.createResource(resourceAddRequest);
- }
-
- //添加知识点 - 课程
- @PostMapping("/addKnowResources")
- public void createCourseKnow(@RequestBody RelationshipResourceRequest relationshipResourceRequest) {
- resourcesService.addKnowWithResources(relationshipResourceRequest);
- }
-
- //修改知识点
- @PostMapping ("/update")
- public Resources updateKnow(@RequestBody ResourceUpdateRequest resourceUpdateRequest ) {
- return resourcesService.updateResources(resourceUpdateRequest);
- }
-
-
- //删除知识点
- @GetMapping ("delete/{id}")
- public void deleteResource(@PathVariable Long id) {
- resourcesService.deleteResources(id);
- }
-
- //添加知识点与资源的关系
- @PostMapping ("/addKnowResourcesResources")
- public void addKnowWithResource(@RequestBody RelationshipResourceRequest relationshipResourceRequest) {
- resourcesService.addKnowWithResources(relationshipResourceRequest);
- }
-
- @GetMapping ("queryCourseKnow/{KnowId}")
- public Set queryCourseKnowToResources(@PathVariable Long KnowId) {
- return resourcesService.queryCourseKnowToResources(KnowId);
- }
-
- @GetMapping ("queryBesidesKnowToResources/{KnowId}")
- public List queryBesidesKnowToResources(@PathVariable Long KnowId) {
- return resourcesService.queryBesidesKnowToResources(KnowId);
- }
-
-
-
-}
diff --git a/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java b/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java
new file mode 100644
index 0000000..8b28b1b
--- /dev/null
+++ b/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java
@@ -0,0 +1,51 @@
+package com.teaching.backend.controller.Knowtmp;
+
+import com.teaching.backend.common.BaseResponse;
+import com.teaching.backend.model.dto.Knowtmp.KnowtempAdd;
+import com.teaching.backend.model.dto.Knowtmp.KnowtempUpdate;
+import com.teaching.backend.model.entity.knowtmp.Knowtmp;
+import com.teaching.backend.service.knowtmp.KnowtmpService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @Author:youhang
+ * @Date:2024-08-07-19:38
+ * @Description:
+ */
+@RestController
+@RequestMapping("/knowtmp")
+public class KnowtmpController {
+
+ @Autowired
+ private KnowtmpService knowtmpService;
+
+
+ // 添加知识点
+ @PostMapping("/addKnow")
+ BaseResponse add(@RequestBody KnowtempAdd knowtempAdd){
+ return knowtmpService.add(knowtempAdd);
+ }
+
+
+ //修改知识点
+ @PostMapping("/updateKnow")
+ BaseResponse update(@RequestBody KnowtempUpdate knowtempUpdate){
+ return knowtmpService.update(knowtempUpdate);
+ }
+
+
+ //删除知识点
+ @GetMapping("/deleteKnow")
+ BaseResponse delete(Long id){
+ return knowtmpService.delete(id);
+ }
+
+ //查询通过chapterId List
+ @GetMapping("/queryKnow")
+ BaseResponse> queryByChapterId(Long chapterId){
+ return knowtmpService.queryByChapterId(chapterId);
+ }
+}
diff --git a/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java b/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java
index efbb8f2..77adf9d 100644
--- a/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java
+++ b/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java
@@ -20,10 +20,10 @@ public class ResourceLearningRecordController {
@Resource
private ResourceLearningRecordServiceImpl resourceLearningRecordService;
- @ApiOperation("添加资源学习记录")
-// @ValidateParams({"userId","type","coursesId"})
- @PostMapping("/saverecords")
- public BaseResponse saveResourceRecords(@RequestBody ResourceLearningRecord resourceLearningRecord) {
- return resourceLearningRecordService.saveCoursesRecords(resourceLearningRecord);
- }
+// @ApiOperation("添加资源学习记录")
+//// @ValidateParams({"userId","type","coursesId"})
+// @PostMapping("/saverecords")
+// public BaseResponse saveResourceRecords(@RequestBody ResourceLearningRecord resourceLearningRecord) {
+// return resourceLearningRecordService.saveCoursesRecords(resourceLearningRecord);
+// }
}
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 16102ee..71b0884 100644
--- a/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
+++ b/src/main/java/com/teaching/backend/controller/resource/ResourceController.java
@@ -1,52 +1,83 @@
package com.teaching.backend.controller.resource;
-import com.teaching.backend.common.BaseResponse;
-import com.teaching.backend.common.ResultUtils;
-import com.teaching.backend.service.KnowGraph.ResourcesService;
+/**
+ * @Author:youhang
+ * @Date:2024-06-09-9:55
+ * @Description:
+ */
+
+import com.teaching.backend.common.BaseResponse;
+import com.teaching.backend.model.dto.resource.ResourceUploadDto;
+import com.teaching.backend.model.entity.resource.Resources;
import com.teaching.backend.service.resource.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Set;
-import java.io.*;
-/**
- * ClassName: CommonController
- * Package: com.teaching.backend.controller
- * Description:
- *
- * @Author 姜钧瀚
- * @Create 2024/6/1 10:30
- * @Version 1.0
- */
@RestController
@RequestMapping("/resource")
public class ResourceController {
@Autowired
- private ResourcesService resourcesService;
+ private ResourceService resourceService;
+
//添加知识点
@PostMapping("/upload")
- public BaseResponse uploadFile(@RequestParam("file")MultipartFile file) {
- return resourcesService.uploadFile(file);
+ @ResponseBody
+ public BaseResponse uploadFile(@RequestPart("file") MultipartFile file) {
+ return resourceService.upload(file);
}
+ //删除资源
+ @GetMapping ("delete")
+ @ResponseBody
+ public BaseResponse deleteResource(@RequestParam("filename") String filename) {
+ return resourceService.delete(filename);
+ }
+ @GetMapping("/read")
+ public ResponseEntity readFile(@RequestParam String filename) {
+ return resourceService.readFile(filename);
+ }
+ @GetMapping("/addRelationship/BetweenCourseAndResources")
+ public BaseResponse addResourcesAndKnowByCourseId(@RequestParam String courseId, @RequestParam List resourcesIds){
+ return resourceService.addResourcesAndKnowByCourseId(courseId,resourcesIds);
+ }
+ @GetMapping("/addRelationship/BetweenChapterAndResources")
+ public BaseResponse addResourcesAndKnowByChapterId(@RequestParam Long chapterId,@RequestParam List resourcesIds){
+ return resourceService.addResourcesAndKnowByChapterId(chapterId,resourcesIds);
+ }
+ @GetMapping("/addRelationship/BetweenKnowAndResources")
+ public BaseResponse addResourcesAndKnowById(@RequestParam Long id, @RequestParam List resourcesIds){
+ return resourceService.addResourcesAndKnowById(id,resourcesIds);
+ }
-}
-
-
-
-
-
-
-
+ //查询课程下资源
+ @GetMapping("/queryByCourseId")
+ Set queryResourcesByCourseId(String courseId){
+ return resourceService.queryResourcesByCourseId(courseId);
+ }
+ //查询章节下资源
+ @GetMapping("/queryByChapterId")
+ Set queryResourcesByChapterId(Long chapterId){
+ return resourceService.queryResourcesByChapterId(chapterId);
+ }
+ //查询二级节点下资源
+ @GetMapping("/queryBesidesKnow")
+ Set queryBesidesKnowToResources(Long KnowId){
+ return resourceService.queryBesidesKnowToResources(KnowId);
+ }
+}
diff --git a/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java b/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java
deleted file mode 100644
index cbfbcf6..0000000
--- a/src/main/java/com/teaching/backend/mapper/KnowGraph/KnowRepository.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.teaching.backend.mapper.KnowGraph;
-
-/**
- * @Author:youhang
- * @Date:2024-06-09-8:59
- * @Description:
- */
-
-
-import com.teaching.backend.model.dto.KnowGraph.KnowCourseCreateRequest;
-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 org.springframework.data.neo4j.repository.Neo4jRepository;
-import org.springframework.data.neo4j.repository.query.Query;
-
-import java.util.List;
-import java.util.Set;
-
-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:FatherAndSon]->(c) return r")
- int addKnowFatherAndSonKnow(Long id, List KnowIds);
-
- @Query("MATCH(n)-[r:related]->(nn:Know) where ID(nn) = $id RETURN n")
- List queryKnowAllKnowById(Long id);
-
-
- @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);
-
- @Query("MATCH (p:Know {courseId:$courseId }) RETURN count(p);")
- Boolean deleteKnowCourse(String courseId);
-
- @Query("CREATE (n:Know {name: $name, chapterId: $chapterId,info:$info}) return count(n)")
- 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);
-
- @Query("MATCH (p:Know {chapterId:$chapterId }) RETURN count(p);")
- Boolean deleteKnowChapter(Long chapterId);
-
- @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
deleted file mode 100644
index b4609af..0000000
--- a/src/main/java/com/teaching/backend/mapper/KnowGraph/ResourcesRepository.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.teaching.backend.mapper.KnowGraph;
-
-/**
- * @Author:youhang
- * @Date:2024-06-09-8:59
- * @Description:
- */
-import java.util.concurrent.*;
-
-import com.teaching.backend.model.entity.KnowGraph.Know;
-
-import com.teaching.backend.model.entity.KnowGraph.Resources;
-import org.neo4j.driver.Result;
-import org.springframework.data.neo4j.repository.Neo4jRepository;
-import org.springframework.data.neo4j.repository.query.Query;
-
-import java.util.List;
-import java.util.Set;
-
-public interface ResourcesRepository extends Neo4jRepository {
-
-
- @Query("MATCH(n:Resources) where n.resourcesId = $resourcesId RETURN n")
- 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 addResourceResourcesKnow(Long id, List ResourcesIds);
-
-
- @Query("MATCH(n:Know)-[r:resources]->(nn:Resources) where ID(nn) = $id RETURN nn")
- List queryResourceAllId(Long id);
-
- @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")
- 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
deleted file mode 100644
index 38c1cab..0000000
--- a/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtempMapper.java
+++ /dev/null
@@ -1,15 +0,0 @@
-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/mapper/Knowtemp/KnowtmpMapper.java b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtmpMapper.java
new file mode 100644
index 0000000..5aee0cb
--- /dev/null
+++ b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowtmpMapper.java
@@ -0,0 +1,18 @@
+package com.teaching.backend.mapper.Knowtemp;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.teaching.backend.model.entity.knowtmp.Knowtmp;
+import org.apache.ibatis.annotations.Mapper;
+
+
+/**
+ *
+ */
+@Mapper
+public interface KnowtmpMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java b/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java
new file mode 100644
index 0000000..9871a0d
--- /dev/null
+++ b/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java
@@ -0,0 +1,66 @@
+package com.teaching.backend.mapper.know;
+
+/**
+ * @Author:youhang
+ * @Date:2024-06-09-8:59
+ * @Description:
+ */
+
+
+import com.teaching.backend.model.entity.know.Know;
+import com.teaching.backend.model.entity.know.KnowChapter;
+import com.teaching.backend.model.entity.know.KnowCourse;
+import com.teaching.backend.model.entity.resource.Resources;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.neo4j.repository.query.Query;
+
+import java.util.Set;
+
+public interface KnowRepository extends Neo4jRepository {
+
+ @Query("CREATE (n:Know {name: $name,info:$info}) return count(n)")
+ int addKnow(String name,String info);
+
+
+ @Query("MATCH ID(p:Know) = $id SET p.name = $name set p.info= $info RETURN count(p);")
+ int updateKnow(Long id, String name, String info);
+
+ @Query("MATCH ID(p:Know) = $id delete p RETURN count(p);")
+ int deleteKnow(Long id);
+
+ @Query("MATCH ID(p:Know) = $id RETURN p;")
+ Know queryKnow(Long id);
+
+ //=============================
+
+ @Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info}) return count(n)")
+ int addCourse(String courseId, String name, String info);
+
+ @Query("MATCH (p:Know {courseId:$courseId }) SET p.name = $name set p.info= $info RETURN count(p);")
+ int updateCourse(String courseId, String name, String info);
+
+ @Query("MATCH (p:Know {courseId:$courseId }) delete p RETURN count(p);")
+ int deleteCourse(String courseId);
+
+ @Query("MATCH (p:Know {courseId:$courseId }) RETURN p;")
+ KnowCourse queryCourse(String courseId);
+
+ //====================
+
+ @Query("CREATE (n:Know {name: $name, chapterId:$chapterId,info:$info}) return count(n)")
+ int addChapter(Long chapterId, String name, String info);
+
+ @Query("MATCH (p:Know {chapterId:$chapterId }) SET p.name = $name set p.info= $info RETURN count(p);")
+ int updateChapter(Long chapterId, String name, String info);
+
+ @Query("MATCH (p:Know {chapterId:$chapterId }) delete p RETURN count(p);")
+ int deleteChapter(Long chapterId);
+
+ @Query("MATCH (p:Know {chapterId:$chapterId }) RETURN p;")
+ KnowChapter queryChapter(Long chapterId);
+
+ //查询二级节点下资源
+ @Query("MATCH (p:Know)-[:FatherAndSon]->(n:Know)-[:resources]->(m:Resources) WHERE ID(p) = $id RETURN m")
+ Set queryBesidesKnowToResources(Long id);
+
+}
diff --git a/src/main/java/com/teaching/backend/mapper/resource/ResourceLearningNumberMapper.java b/src/main/java/com/teaching/backend/mapper/resource/ResourceLearningNumberMapper.java
deleted file mode 100644
index 8542b97..0000000
--- a/src/main/java/com/teaching/backend/mapper/resource/ResourceLearningNumberMapper.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.teaching.backend.mapper.resource;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.teaching.backend.model.entity.resource.ResourceLearningNumber;
-
-/**
- *
- * Mapper 接口
- *
- *
- * @author author
- * @since 2024-07-29
- */
-public interface ResourceLearningNumberMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/com/teaching/backend/mapper/resource/ResourcesMapper.java b/src/main/java/com/teaching/backend/mapper/resource/ResourcesMapper.java
deleted file mode 100644
index de072b2..0000000
--- a/src/main/java/com/teaching/backend/mapper/resource/ResourcesMapper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.teaching.backend.mapper.resource;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import com.teaching.backend.model.entity.resource.Resource;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * ClassName: FileTableMapper
- * Package: com.teaching.backend.mapper
- * Description:
- *
- * @Author 姜钧瀚
- * @Create 2024/6/4 11:51
- * @Version 1.0
- */
-@Mapper
-public interface ResourcesMapper extends BaseMapper {
-
-}
diff --git a/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java b/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java
new file mode 100644
index 0000000..16286ed
--- /dev/null
+++ b/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java
@@ -0,0 +1,64 @@
+package com.teaching.backend.mapper.resource;
+
+/**
+ * @Author:youhang
+ * @Date:2024-06-09-8:59
+ * @Description:
+ */
+
+
+import com.teaching.backend.model.entity.resource.Resources;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.neo4j.repository.query.Query;
+
+import java.util.List;
+import java.util.Set;
+
+public interface ResourcesRepository extends Neo4jRepository {
+
+ //删除资源节点
+ @Query("MATCH(n:Resources) where n.name = $name DETACH DELETE n RETURN COUNT(n) >0;")
+ Boolean deleteByobjectName(String name);
+
+ //添加课程与资源关系
+ @Query("MATCH (p:Know), (c:Resources) WHERE p.courseId = $courseId AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)")
+ int addResourcesAndKnowByCourseId(String courseId, List resourcesIds);
+
+
+ //添加章节与资源关系
+ @Query("MATCH (p:Know), (c:Resources) WHERE p.chapterId = $chapterId AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)")
+ int addResourcesAndKnowByChapterId(Long chapterId, List resourcesIds);
+
+ //添加知识点与资源关系
+ @Query("MATCH (p:Know), (c:Resources) WHERE ID(p) = $id AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)")
+ int addResourcesAndKnowById(Long id, List resourcesIds);
+
+ //查询课程下资源
+ @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE a.courseId = $courseId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b")
+ Set queryResourcesByCourseId(String courseId);
+
+ //查询章节下资源
+ @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE a.chapterId = chapterId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b")
+ Set queryResourcesByChapterId(Long chapterId);
+
+ //查询二级节点下资源
+ @Query("MATCH (p:Know)-[:FatherAndSon]->(n:Know)-[:resources]->(m:Resources) WHERE ID(p) = $KnowId RETURN m")
+ Set queryBesidesKnowToResources(Long KnowId);
+
+
+
+
+//
+//
+// @Query("MATCH(n:Know)-[r:resources]->(nn:Resources) where ID(nn) = $id RETURN nn")
+// List queryResourceAllId(Long id);
+//
+// @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)-[:resources]->(m:Resources) WHERE ID(p) = 272 RETURN m")
+// Set queryKnowToResources(Long KnowId);
+
+}
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/BaseKnowReturn.java b/src/main/java/com/teaching/backend/model/dto/Know/BaseKnowReturn.java
similarity index 80%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/BaseKnowReturn.java
rename to src/main/java/com/teaching/backend/model/dto/Know/BaseKnowReturn.java
index 8dc8bef..03e31df 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/BaseKnowReturn.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/BaseKnowReturn.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
/**
* @Author:youhang
@@ -7,7 +7,7 @@ package com.teaching.backend.model.dto.KnowGraph;
*/
-import com.teaching.backend.model.entity.KnowGraph.Links;
+import com.teaching.backend.model.entity.know.Links;
import com.teaching.backend.model.vo.knowGraph.KnowVO;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowChapterCreateRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/KnowChapterCreateRequest.java
similarity index 70%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowChapterCreateRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/KnowChapterCreateRequest.java
index 85f542b..293b44c 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowChapterCreateRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/KnowChapterCreateRequest.java
@@ -1,10 +1,8 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
-import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Data
public class KnowChapterCreateRequest implements Serializable {
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowCourseCreateRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/KnowCourseCreateRequest.java
similarity index 70%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowCourseCreateRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/KnowCourseCreateRequest.java
index 9e15c8e..61815f2 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowCourseCreateRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/KnowCourseCreateRequest.java
@@ -1,10 +1,8 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
-import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Data
public class KnowCourseCreateRequest implements Serializable {
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/KnowRequest.java
similarity index 63%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/KnowRequest.java
index 13061f1..14f8492 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/KnowRequest.java
@@ -1,10 +1,8 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
-import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Data
public class KnowRequest implements Serializable {
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowUpdateRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/KnowUpdateRequest.java
similarity index 68%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowUpdateRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/KnowUpdateRequest.java
index e3955d2..feb2520 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/KnowUpdateRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/KnowUpdateRequest.java
@@ -1,10 +1,8 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
-import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Data
public class KnowUpdateRequest implements Serializable {
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipKnowRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/RelationshipKnowRequest.java
similarity index 84%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipKnowRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/RelationshipKnowRequest.java
index ff3b1ae..d4d0bda 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipKnowRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/RelationshipKnowRequest.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipResourceRequest.java b/src/main/java/com/teaching/backend/model/dto/Know/RelationshipResourceRequest.java
similarity index 84%
rename from src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipResourceRequest.java
rename to src/main/java/com/teaching/backend/model/dto/Know/RelationshipResourceRequest.java
index 3d46088..d7b7708 100644
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/RelationshipResourceRequest.java
+++ b/src/main/java/com/teaching/backend/model/dto/Know/RelationshipResourceRequest.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.dto.KnowGraph;
+package com.teaching.backend.model.dto.Know;
import lombok.Data;
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
deleted file mode 100644
index 4775269..0000000
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourceUpdateRequest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.teaching.backend.model.dto.KnowGraph;
-
-import lombok.Data;
-
-/**
- * @Author:youhang
- * @Date:2024-07-25-8:39
- * @Description:
- */
-@Data
-public class ResourceUpdateRequest {
-
- private Long id;
-
- private String name;
-
-
- private Integer type;
-
-
- private String path;
-}
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
deleted file mode 100644
index 32b408d..0000000
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesAddRequest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.teaching.backend.model.dto.KnowGraph;
-
-import lombok.Data;
-import org.springframework.data.neo4j.core.schema.Property;
-
-/**
- * @Author:youhang
- * @Date:2024-07-25-8:39
- * @Description:
- */
-@Data
-public class ResourcesAddRequest {
-
- private String name;
-
- private Integer type;
-
- private String path;
-}
diff --git a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesRequest.java b/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesRequest.java
deleted file mode 100644
index 37e4bdf..0000000
--- a/src/main/java/com/teaching/backend/model/dto/KnowGraph/ResourcesRequest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.teaching.backend.model.dto.KnowGraph;
-
-import lombok.Data;
-import org.springframework.web.multipart.MultipartFile;
-
-/**
- * @Author:youhang
- * @Date:2024-07-25-8:39
- * @Description:
- */
-@Data
-public class ResourcesRequest {
-
- private MultipartFile file;
-}
diff --git a/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java b/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java
similarity index 55%
rename from src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java
rename to src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java
index 953db74..3c09119 100644
--- a/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempAdd.java
+++ b/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java
@@ -1,8 +1,5 @@
-package com.teaching.backend.model.dto.Knowtemp;
+package com.teaching.backend.model.dto.Knowtmp;
-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;
@@ -24,7 +21,6 @@ public class KnowtempAdd implements Serializable {
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/Knowtmp/KnowtempUpdate.java
similarity index 73%
rename from src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempUpdate.java
rename to src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempUpdate.java
index 427aa4b..2002e75 100644
--- a/src/main/java/com/teaching/backend/model/dto/Knowtemp/KnowtempUpdate.java
+++ b/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempUpdate.java
@@ -1,6 +1,5 @@
-package com.teaching.backend.model.dto.Knowtemp;
+package com.teaching.backend.model.dto.Knowtmp;
-import io.swagger.models.auth.In;
import lombok.Data;
import java.io.Serializable;
@@ -23,8 +22,6 @@ public class KnowtempUpdate implements Serializable {
private String info;
private Long chapterid;
- private String courseid;
-
private Integer ordernum;
diff --git a/src/main/java/com/teaching/backend/model/dto/resource/BucketPolicyConfigDto.java b/src/main/java/com/teaching/backend/model/dto/resource/BucketPolicyConfigDto.java
new file mode 100644
index 0000000..3242d3a
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/dto/resource/BucketPolicyConfigDto.java
@@ -0,0 +1,31 @@
+package com.teaching.backend.model.dto.resource;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * Minio Bucket访问策略配置
+ * Created by macro on 2020/8/11.
+ */
+@Data
+@EqualsAndHashCode
+@Builder
+public class BucketPolicyConfigDto {
+
+ private String Version;
+ private List Statement;
+
+ @Data
+ @EqualsAndHashCode
+ @Builder
+ public static class Statement {
+ private String Effect;
+ private String Principal;
+ private String Action;
+ private String Resource;
+
+ }
+}
diff --git a/src/main/java/com/teaching/backend/model/dto/resource/ResourceUploadDto.java b/src/main/java/com/teaching/backend/model/dto/resource/ResourceUploadDto.java
new file mode 100644
index 0000000..0fd2f4d
--- /dev/null
+++ b/src/main/java/com/teaching/backend/model/dto/resource/ResourceUploadDto.java
@@ -0,0 +1,22 @@
+package com.teaching.backend.model.dto.resource;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 文件上传返回结果
+ * Created by macro on 2019/12/25.
+ */
+@Data
+@EqualsAndHashCode
+public class ResourceUploadDto {
+
+
+ private String url;
+
+
+ private String name;
+
+ private String objectName;
+}
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 4cadcb9..c7d6e80 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
@@ -4,8 +4,8 @@ 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 com.teaching.backend.model.entity.KnowGraph.Know;
-import com.teaching.backend.model.entity.Knowtemp.Knowtemp;
+
+import com.teaching.backend.model.entity.knowtmp.Knowtmp;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -90,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/entity/KnowGraph/Know.java b/src/main/java/com/teaching/backend/model/entity/know/Know.java
similarity index 88%
rename from src/main/java/com/teaching/backend/model/entity/KnowGraph/Know.java
rename to src/main/java/com/teaching/backend/model/entity/know/Know.java
index 10eff7f..b570705 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Know.java
+++ b/src/main/java/com/teaching/backend/model/entity/know/Know.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.entity.KnowGraph;
+package com.teaching.backend.model.entity.know;
import lombok.Data;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
@@ -7,7 +7,6 @@ import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Node
@Data
@@ -20,7 +19,6 @@ public class Know implements Serializable {
@GeneratedValue
private Long id;
-
/**
* 知识点名称
*/
diff --git a/src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowChapter.java b/src/main/java/com/teaching/backend/model/entity/know/KnowChapter.java
similarity index 85%
rename from src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowChapter.java
rename to src/main/java/com/teaching/backend/model/entity/know/KnowChapter.java
index 3454ed0..07e330a 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowChapter.java
+++ b/src/main/java/com/teaching/backend/model/entity/know/KnowChapter.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.entity.KnowGraph;
+package com.teaching.backend.model.entity.know;
import lombok.Data;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
@@ -7,7 +7,6 @@ import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Node
@Data
@@ -24,7 +23,7 @@ public class KnowChapter implements Serializable {
/**
* 章节id
*/
- private String chapterId;
+ private Long chapterId;
/**
diff --git a/src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowCourse.java b/src/main/java/com/teaching/backend/model/entity/know/KnowCourse.java
similarity index 89%
rename from src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowCourse.java
rename to src/main/java/com/teaching/backend/model/entity/know/KnowCourse.java
index 5860524..f85d1d2 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/KnowCourse.java
+++ b/src/main/java/com/teaching/backend/model/entity/know/KnowCourse.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.entity.KnowGraph;
+package com.teaching.backend.model.entity.know;
import lombok.Data;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
@@ -7,7 +7,6 @@ import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import java.io.Serializable;
-import java.util.List;
@Node
@Data
diff --git a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Links.java b/src/main/java/com/teaching/backend/model/entity/know/Links.java
similarity index 91%
rename from src/main/java/com/teaching/backend/model/entity/KnowGraph/Links.java
rename to src/main/java/com/teaching/backend/model/entity/know/Links.java
index 139c1dd..b8d47ec 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Links.java
+++ b/src/main/java/com/teaching/backend/model/entity/know/Links.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.entity.KnowGraph;
+package com.teaching.backend.model.entity.know;
import lombok.Data;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
diff --git a/src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java b/src/main/java/com/teaching/backend/model/entity/knowtmp/Knowtmp.java
similarity index 65%
rename from src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java
rename to src/main/java/com/teaching/backend/model/entity/knowtmp/Knowtmp.java
index 4538b48..1668352 100644
--- a/src/main/java/com/teaching/backend/model/entity/Knowtemp/Knowtemp.java
+++ b/src/main/java/com/teaching/backend/model/entity/knowtmp/Knowtmp.java
@@ -1,13 +1,9 @@
-package com.teaching.backend.model.entity.Knowtemp;
+package com.teaching.backend.model.entity.knowtmp;
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;
@@ -20,7 +16,7 @@ import java.io.Serializable;
* @since 2024-05-31
*/
@Data
-public class Knowtemp implements Serializable {
+public class Knowtmp implements Serializable {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@@ -36,7 +32,5 @@ public class Knowtemp implements Serializable {
private Long chapterid;
- private String courseid;
-
}
diff --git a/src/main/java/com/teaching/backend/model/entity/resource/Resource.java b/src/main/java/com/teaching/backend/model/entity/resource/Resource.java
deleted file mode 100644
index 0b0a9da..0000000
--- a/src/main/java/com/teaching/backend/model/entity/resource/Resource.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.teaching.backend.model.entity.resource;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-
-import java.util.stream.Stream;
-
-/**
- * ClassName: FileTable
- * Package: com.teaching.backend.model.entity
- * Description:
- *
- * @Author youhang
- * @Create 2024/6/4 11:48
- * @Version 1.0
- */
-@Data
-@TableName("Resource")
-public class Resource {
- private static final long serialVersionUID = 1L;
-
- /**
- * 内部编号
- */
- @TableId(value = "id", type = IdType.ASSIGN_ID)
- private String id;
- private String name;
- private int type;
- private int status;
- private String tags;
- private String path;
-
- /**
- * 简介
- */
- private String description;
-
- /**
- * 封面
- */
- private String img;
-}
diff --git a/src/main/java/com/teaching/backend/model/entity/resource/ResourceLearningNumber.java b/src/main/java/com/teaching/backend/model/entity/resource/ResourceLearningNumber.java
deleted file mode 100644
index 4ae2ee2..0000000
--- a/src/main/java/com/teaching/backend/model/entity/resource/ResourceLearningNumber.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.teaching.backend.model.entity.resource;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-/**
- *
- *
- *
- *
- * @author author
- * @since 2024-07-29
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@TableName("resource_learning_number")
-@ApiModel(value="ResourceLearningNumber对象", description="")
-public class ResourceLearningNumber implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "资源学习记录id")
- @TableId(value = "id", type = IdType.ASSIGN_ID)
- private String id;
-
- @ApiModelProperty(value = "课程id")
- private String courseId;
-
- @ApiModelProperty(value = "知识点id")
- private String knowledgeId;
-
- @ApiModelProperty(value = "资源id")
- private String resourceId;
-
- @ApiModelProperty(value = "学习人数")
- private Integer number;
-
-
-}
diff --git a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java b/src/main/java/com/teaching/backend/model/entity/resource/Resources.java
similarity index 82%
rename from src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java
rename to src/main/java/com/teaching/backend/model/entity/resource/Resources.java
index bacbe59..c2cc9bb 100644
--- a/src/main/java/com/teaching/backend/model/entity/KnowGraph/Resources.java
+++ b/src/main/java/com/teaching/backend/model/entity/resource/Resources.java
@@ -1,4 +1,4 @@
-package com.teaching.backend.model.entity.KnowGraph;
+package com.teaching.backend.model.entity.resource;
import lombok.Data;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
@@ -18,13 +18,13 @@ public class Resources {
@GeneratedValue
private Long id;
-
@Property
private String name;
+
@Property
- private Integer type;
+ private Integer status;
@Property
- private String path;
+ private String url;
}
diff --git a/src/main/java/com/teaching/backend/service/Know/KnowService.java b/src/main/java/com/teaching/backend/service/Know/KnowService.java
new file mode 100644
index 0000000..14cdb91
--- /dev/null
+++ b/src/main/java/com/teaching/backend/service/Know/KnowService.java
@@ -0,0 +1,74 @@
+package com.teaching.backend.service.Know;
+
+import com.teaching.backend.common.BaseResponse;
+import com.teaching.backend.model.dto.Know.*;
+import com.teaching.backend.model.entity.know.Know;
+import com.teaching.backend.model.entity.know.KnowChapter;
+import com.teaching.backend.model.entity.know.KnowCourse;
+import com.teaching.backend.model.entity.resource.Resources;
+import com.teaching.backend.model.vo.knowGraph.KnowVO1;
+
+import java.util.Set;
+
+/**
+ * @Author:youhang
+ * @Date:2024-08-07-15:50
+ * @Description:
+ */
+public interface KnowService {
+
+ // 添加知识点
+ BaseResponse addKnow(KnowRequest knowRequest);
+
+ // 修改知识点
+ BaseResponse updateKnow(KnowUpdateRequest knowUpdateRequest);
+
+ // 删除知识点
+ BaseResponse deleteKnow(Long id);
+
+ //查询知识点通过id
+ BaseResponse queryKnow(Long id);
+
+ //======================================
+
+ // 添加课程
+ BaseResponse addCourse(KnowCourseCreateRequest knowCourseCreateRequest);
+
+ // 修改课程
+ BaseResponse updateCourse(KnowCourseCreateRequest knowCourseCreateRequest);
+
+
+ // 删除课程
+ BaseResponse deleteCourse(String courseId);
+
+ //查询课程通过courseid
+ BaseResponse queryCourse(String courseId);
+
+
+ //=========================
+
+ // 添加章节
+ BaseResponse addChapter(KnowChapterCreateRequest knowChapterCreateRequest);
+
+ // 修改章节
+ BaseResponse updateChapter(KnowChapterCreateRequest knowChapterCreateRequest);
+
+ // 删除章节
+ BaseResponse deleteChapter(Long chapterId);
+
+ //查询章节通过chapterId
+ BaseResponse queryChapter(Long chapterId);
+
+ //=====================
+
+ //获取课程下的所有知识点
+ BaseKnowReturn getAllKnowByCourseId(String id);
+
+ //获取课程下的所有资源
+ BaseResponse> getAllResourcesByCourseId(String id);
+
+ //获取知识点下二级的所有资源
+ Set getSecondResources(Long id);
+
+
+}
diff --git a/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java b/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java
deleted file mode 100644
index 8797762..0000000
--- a/src/main/java/com/teaching/backend/service/KnowGraph/KnowGraphService.java
+++ /dev/null
@@ -1,138 +0,0 @@
-//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
deleted file mode 100644
index b74a779..0000000
--- a/src/main/java/com/teaching/backend/service/KnowGraph/KnowService.java
+++ /dev/null
@@ -1,431 +0,0 @@
-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;
-import java.util.*;
-
-/**
- * @Author:youhang
- * @Date:2024-07-21-14:46
- * @Description:
- */
-@Service
-public class KnowService {
- @Autowired
- private KnowRepository knowRepository;
- @Autowired
- private ChapterMapper chapterMapper;
-
- @Autowired
- private KnowtempMapper knowtempMapper;
-
- @Autowired
- private CoursesMapper coursesMapper;
-
- @Resource
- private Neo4jClient neo4jClient;
-
- 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("添加成功");
- }
- return ResultUtils.error(ErrorCode.OPERATION_ERROR);
- }
- 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);
- }
- knowtemp.setName(name);
- knowtemp.setInfo(info);
- knowtemp.setChapterid(chapterId);
- knowtemp.setCourseid(courseid);
- int insert = knowtempMapper.updateById(knowtemp);
- if(insert > 0){
- return ResultUtils.success("修改成功");
- }
- return ResultUtils.error(ErrorCode.OPERATION_ERROR);
- }
-
- 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 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 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);
- }
-
- }
- 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 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) {
- Collection