知识图谱

main
王家东 7 months ago
parent 092334ccb4
commit ea68f35043
  1. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/mapper/SeKonwMapper.java
  2. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/ISeKonwService.java
  3. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/service/impl/SeKonwServiceImpl.java
  4. 12
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/controller/SeKnowGroupController.java
  5. 7
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeList.java
  6. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/seknowgroup/entity/NodeName.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<SeKonw> {
@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<NodeName> getallnodes(String id);
@Select("select per_kow_id as source,next_know_id as target from se_konw_relationship_main where courseid=#{id}")
List<NodeList> getalllikes(String id);
}

@ -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<SeKonw> {
Boolean importExcel(List<SeKonw> zlListByE);
String getrelaint(String relationId);
List<NodeName> getallnodes(String id);
List<NodeList> getalllikes(String id);
}

@ -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<SeKonwMapper, SeKonw> impleme
return seKonwMapper.getrelaint(relationId);
}
@Override
public List<NodeName> getallnodes(String id) {
return seKonwMapper.getallnodes(id);
}
@Override
public List<NodeList> getalllikes(String id) {
return seKonwMapper.getalllikes(id);
}
}

@ -202,8 +202,16 @@ public class SeKnowGroupController extends JeecgController<SeKnowGroup, ISeKnowG
@GetMapping(value = "/createGroup")
public Result<?> createGroup(@RequestParam(name="id",required=true) String id) {
System.out.println(id);
return Result.OK("更新完成");
//开始获取并组装单个知识点
List<NodeName> nodes = seKonwService.getallnodes(id);
//开始组装知识点链接
List<NodeList> links = seKonwService.getalllikes(id);
//开始组装完整的只是节点
Exports exports = new Exports();
exports.setNodes(nodes);
exports.setLinks(links);
System.out.println(exports);
return Result.OK(exports);
}
/*

@ -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;
}

@ -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;
}

Loading…
Cancel
Save