From ea68f35043e813dfed03cd7a526dc7b97d6118da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=B6=E4=B8=9C?= <1654135867@qq.com> Date: Wed, 8 May 2024 16:37:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=9B=BE=E8=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/demo/know/mapper/SeKonwMapper.java | 8 ++++++++ .../demo/know/service/ISeKonwService.java | 9 +++++++++ .../know/service/impl/SeKonwServiceImpl.java | 17 +++++++++++++++++ .../controller/SeKnowGroupController.java | 12 ++++++++++-- .../demo/seknowgroup/entity/NodeList.java | 7 ++++++- .../demo/seknowgroup/entity/NodeName.java | 5 ++++- 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/mapper/SeKonwMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/mapper/SeKonwMapper.java index 65b2145..3c0f96e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/mapper/SeKonwMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/mapper/SeKonwMapper.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.jeecg.modules.demo.know.entity.SeKonw; +import org.jeecg.modules.demo.seknowgroup.entity.NodeList; +import org.jeecg.modules.demo.seknowgroup.entity.NodeName; /** * @Description: 知识点表 @@ -34,4 +36,10 @@ public interface SeKonwMapper extends BaseMapper { @Select("select wight from se_konw_relationship where id =#{relationId}") String getrelaint(String relationId); + + @Select("select id, name as label from se_konw where courseid =#{id}") + List getallnodes(String id); + + @Select("select per_kow_id as source,next_know_id as target from se_konw_relationship_main where courseid=#{id}") + List getalllikes(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/ISeKonwService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/ISeKonwService.java index 265c694..1cc1cf8 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/ISeKonwService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/ISeKonwService.java @@ -3,6 +3,9 @@ package org.jeecg.modules.demo.know.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.demo.know.entity.SeKonw; +import org.jeecg.modules.demo.seknowgroup.entity.Exports; +import org.jeecg.modules.demo.seknowgroup.entity.NodeList; +import org.jeecg.modules.demo.seknowgroup.entity.NodeName; import java.util.List; @@ -25,4 +28,10 @@ public interface ISeKonwService extends IService { Boolean importExcel(List zlListByE); String getrelaint(String relationId); + + List getallnodes(String id); + + List getalllikes(String id); + + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/impl/SeKonwServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/impl/SeKonwServiceImpl.java index 449548f..4400c11 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/impl/SeKonwServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/impl/SeKonwServiceImpl.java @@ -6,11 +6,15 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.demo.know.entity.SeKonw; import org.jeecg.modules.demo.know.mapper.SeKonwMapper; import org.jeecg.modules.demo.know.service.ISeKonwService; +import org.jeecg.modules.demo.seknowgroup.entity.Exports; +import org.jeecg.modules.demo.seknowgroup.entity.NodeList; +import org.jeecg.modules.demo.seknowgroup.entity.NodeName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.ArrayList; import java.util.List; /** @@ -68,5 +72,18 @@ public class SeKonwServiceImpl extends ServiceImpl impleme return seKonwMapper.getrelaint(relationId); } + @Override + public List getallnodes(String id) { + + return seKonwMapper.getallnodes(id); + } + + @Override + public List getalllikes(String id) { + return seKonwMapper.getalllikes(id); + } + + + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/controller/SeKnowGroupController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/controller/SeKnowGroupController.java index c44362f..eebb380 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/controller/SeKnowGroupController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/controller/SeKnowGroupController.java @@ -202,8 +202,16 @@ public class SeKnowGroupController extends JeecgController createGroup(@RequestParam(name="id",required=true) String id) { - System.out.println(id); - return Result.OK("更新完成"); + //开始获取并组装单个知识点 + List nodes = seKonwService.getallnodes(id); + //开始组装知识点链接 + List links = seKonwService.getalllikes(id); + //开始组装完整的只是节点 + Exports exports = new Exports(); + exports.setNodes(nodes); + exports.setLinks(links); + System.out.println(exports); + return Result.OK(exports); } /* diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeList.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeList.java index 09d644f..7da0c29 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeList.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeList.java @@ -4,7 +4,12 @@ import lombok.Data; @Data public class NodeList { +/* private String source; + private String target; + private String value;*/ + private String source; private String target; - private String value; + private String label; + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeName.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeName.java index a592ac0..16f3e62 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeName.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeName.java @@ -4,6 +4,9 @@ import lombok.Data; @Data public class NodeName { - private String name; + /*private String name;*/ + private String id; + private String label; + private String color; }