知识图谱

main
王家东 7 months ago
parent 579ae30886
commit c59052947d
  1. 21
      ant-design-vue-jeecg/src/views/course/SeCourseList.vue
  2. 6
      ant-design-vue-jeecg/src/views/course/modules/SeCoursechapterPointModal.vue
  3. 8
      ant-design-vue-jeecg/src/views/know/SeKonwList.vue
  4. 41
      ant-design-vue-jeecg/src/views/know/modules/SeKonwForm.vue
  5. 238
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/SeCourseController.java
  6. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/entity/SeCourse.java
  7. 3
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/mapper/SeCourseMapper.java
  8. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeCourseService.java
  9. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeCourseServiceImpl.java
  10. 75
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/entity/SeKonw.java
  11. 49
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/controller/KnowcourseController.java
  12. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/mapper/KnowcourseMapper.java
  13. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/IKnowcourseService.java
  14. 30
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/impl/KnowcourseServiceImpl.java

@ -120,8 +120,10 @@
<a @click="showkcbz(record)"> 课程标准 </a>
<a-divider type="vertical"/>
<a @click="knowshow(record)"> 学时分配 </a>
<a-divider type="vertical"/>
<a @click="knowshow(record)"> 添加知识点 </a>
<a-divider type="vertical"/>
<a @click="cretegroup(record)">生成图谱</a>
<!-- <a-divider type="vertical"/>
<a @click="knowshow(record)"> 添加知识点 </a>-->
<!-- <a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
@ -384,6 +386,7 @@ export default {
importExcelUrl: 'course/seCourse/importExcel',
downLoad: '/course/seCourse/exportWord',
fzkc: '/course/seCourse/fzkc',
cretegroup: '/course/seCourse/cretegroup',
},
dictOptions: {
depid: [],
@ -438,6 +441,16 @@ export default {
// this.$refs.modalForm.title = ''
// this.$refs.modalForm.disableSubmit = false
},
cretegroup(record){
getAction(this.url.cretegroup, { id: record.id }).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
})
},
showkcbz(record) {
this.$router.push({
path:'/modules/SeCourseView',
@ -466,7 +479,7 @@ export default {
this.pagedOld.record = record
this.$set(record,"showButton",false)
this.$router.push({
path: '/src/views/course/AddCourse',
path: '/course/AddCourse',
})
// this.$refs.modalForm.edit(record)
// this.$refs.modalForm.title = ''
@ -476,7 +489,7 @@ export default {
},
//
TaggerRouter() {
this.$router.push({ path: '/src/views/course/AddCourse' })
this.$router.push({ path: '/course/AddCourse' })
},
getMajor2() {
this.dict = 'py_basic_info,version,id'

@ -18,7 +18,7 @@
dest-fields="know,knowid"
:field="getPopupField('know,knowid')"
:multi="false"/>
<a-button style="margin:10px" type="primary" @click="addZjKnow()">添加</a-button>
<!-- <a-button style="margin:10px" type="primary" @click="addZjKnow()">添加</a-button>-->
<a-table
ref="table"
size="middle"
@ -137,9 +137,9 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
});
console.log(111111)
console.log(this.model)
this.$nextTick(() => {
/* this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'img', 'depid', 'majorid', 'category', 'nature', 'programid', 'name', 'code', 'semester', 'credit', 'classhours', 'theoryhours', 'practicehours', 'experimenthours', 'otherhours', 'weeks', 'assessmenttype', 'assessmentway', 'advancedplacement', 'teacher', 'maker', 'writer', 'teachingandoffice', 'verifier', 'teacherway', 'teachermethod', 'assessmentrules', 'contentdistribution', 'achievement'))
})
}) */
},
close() {
this.$emit('close');

@ -170,15 +170,15 @@
dataIndex: 'code'
},
{
title:'定义',
title:'知识点来源',
align:"center",
dataIndex: 'miaoshu'
dataIndex: 'knowfrom_dictText'
},
{
/* {
title:'添加人',
align:"center",
dataIndex: 'inrealname'
},
}, */
{
title: '操作',
dataIndex: 'action',

@ -5,28 +5,32 @@
<a-row>
<a-col :span="24">
<a-form-model-item label="知识点名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input style="width: 200%" v-model="model.name" placeholder="请输入知识点名称" ></a-input>
<a-input v-model="model.name" placeholder="请输入知识点名称" ></a-input>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<a-form-model-item label="知识点代码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code">
<a-input style="width: 200%" v-model="model.code" placeholder="请输入知识点代码" ></a-input>
<a-input v-model="model.code" placeholder="请输入知识点代码" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="简介" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="info">
<a-textarea v-model="model.info" rows="4" placeholder="请输入简介" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<a-form-model-item label="定义" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="miaoshu">
<a-textarea style="max-width:none; width: 200%" v-model="model.miaoshu" rows="4" placeholder="请输入定义" />
<a-textarea v-model="model.miaoshu" rows="4" placeholder="请输入定义" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<!-- <a-col :span="24">
<a-form-model-item label="添加人真实名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inrealname">
<a-input v-model="model.inrealname" placeholder="请输入添加人真实名称" ></a-input>
</a-form-model-item>
</a-col>-->
<a-col :span="24">
<a-form-model-item label="简介" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="info">
<j-editor style="width: 200%" v-model="model.info" />
<a-form-model-item label="知识点来源" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="knowfrom">
<j-dict-select-tag type="list" v-model="model.knowfrom" dictCode="cck" placeholder="请选择知识点来源" />
</a-form-model-item>
</a-col>
</a-row>
@ -55,7 +59,7 @@
data () {
return {
model:{
},
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -66,12 +70,9 @@
},
confirmLoading: false,
validatorRules: {
name: [
{ required: true, message: '请输入知识点名称!'},
],
miaoshu: [
{ required: true, message: '请输入定义!'},
],
name: [
{ required: true, message: '请输入知识点名称!'},
],
},
url: {
add: "/konw/seKonw/add",
@ -86,7 +87,7 @@
},
},
created () {
//model
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
@ -110,7 +111,7 @@
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){

@ -19,11 +19,17 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.course.entity.SeChapter;
import org.jeecg.modules.course.entity.SeCourse;
import org.jeecg.modules.course.entity.SeCourseobjectives;
import org.jeecg.modules.course.mapper.SeChapterMapper;
import org.jeecg.modules.course.service.*;
import org.jeecg.modules.demo.know.entity.SeKonw;
import org.jeecg.modules.demo.know.service.ISeKonwService;
import org.jeecg.modules.demo.knowcourse.entity.Knowcourse;
import org.jeecg.modules.demo.knowcourse.mapper.KnowcourseMapper;
import org.jeecg.modules.demo.knowcourse.service.IKnowcourseService;
import org.jeecg.modules.demo.seknowgroup.entity.SeKnowGroup;
import org.jeecg.modules.demo.seknowgroup.service.ISeKnowGroupService;
import org.jeecg.modules.demo.sekonwrelationshipmain.entity.SeKonwRelationshipMain;
import org.jeecg.modules.demo.sekonwrelationshipmain.service.ISeKonwRelationshipMainService;
import org.jeecg.modules.ex.utils.SelectRole;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserService;
@ -48,6 +54,19 @@ import java.util.*;
@Slf4j
public class SeCourseController extends JeecgController<SeCourse, ISeCourseService> {
@Autowired
KnowcourseMapper knowcourseMapper;
@Autowired
private ISeKonwRelationshipMainService seKonwRelationshipMainService;
@Autowired
private ISeKnowGroupService seKnowGroupService;
@Autowired
private SeChapterMapper seChapterMapper;
@Autowired
private ISeCourseService seCourseService;
@Autowired
@ -312,6 +331,7 @@ public class SeCourseController extends JeecgController<SeCourse, ISeCourseServi
List<Knowcourse> knowcourses1 = knowcourseService.list(queryWrapper1);
for (Knowcourse knowcourse : knowcourses1) {
knowcourses.add(knowcourse);
System.out.println(knowcourse);
}
}
}
@ -641,6 +661,224 @@ public class SeCourseController extends JeecgController<SeCourse, ISeCourseServi
}
/****
* 根据传回的课程ID生成课程-->-->-->知识点的结构的图谱数据
* @param request
* @return 提示性信息
*/
@AutoLog(value = "用于生成图谱")
@ApiOperation(value = "生成图谱", notes = "生成图谱")
@GetMapping(value = "/cretegroup")
public Result<?> cretegroup(String id) {
//在知识图谱表填写一条数据
cretegroupinfo(id);
//将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y
updateiscreategroup(id);
//将课程抽象成知识点并存储到知识点表中
classtoknow(id);
//开始将章节抽象成知识点存储到知识点表
chaptertoknoe(id);
//开始组装前后知识点
creteprenet(id);
return Result.ok("图谱生成成功!");
}
/****
* 在知识图谱表填写一条数据
* @param request
* @return 提示性信息
*/
@AutoLog(value = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y")
@ApiOperation(value = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y", notes = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y")
public void cretegroupinfo(String id) {
//根据传回的id查询课程名称
SeCourse seCourse = seCourseService.getById(id);
SeKnowGroup seKnowGroup = new SeKnowGroup();
seKnowGroup.setCourseid(id);
seKnowGroup.setName(seCourse.getName());
seKnowGroup.setKnowPoint(seCourse.getName());
seKnowGroupService.save(seKnowGroup);
}
/****
* 将课程表中的是否已经生成图谱iscreategroup的状态改成Y
* @param request
* @return 提示性信息
*/
@AutoLog(value = "在知识图谱表填写一条数据")
@ApiOperation(value = "在知识图谱表填写一条数据", notes = "在知识图谱表填写一条数据")
public void updateiscreategroup(String id) {
SeCourse seCourse = seCourseService.getById(id);
seCourse.setIscreategroup("Y");
seCourseService.updateById(seCourse);
}
/****
* 将课程抽象成知识点并存储到知识点表中
* @param request
* @return 提示性信息
*/
@AutoLog(value = "将课程抽象成知识点并存储到知识点表中")
@ApiOperation(value = "将课程抽象成知识点并存储到知识点表中", notes = "将课程抽象成知识点并存储到知识点表中")
public void classtoknow(String id) {
SeCourse seCourse = seCourseService.getById(id);
SeKonw seKonw = new SeKonw();
seKonw.setName(seCourse.getName());
seKonw.setCode("课程:"+seCourse.getCode());
//这里的数据自数据字典cck其中1代表的是课程表
seKonw.setKnowfrom("1");
seKonw.setFromid(id);
seKonw.setCourseid(id);
seKonwService.save(seKonw);
}
/****
* 将课程抽象成知识点并存储到知识点表中
* @param request
* @return 提示性信息
*/
@AutoLog(value = "将章节抽象成知识点存储到知识点表")
@ApiOperation(value = "将章节抽象成知识点存储到知识点表", notes = "将章节抽象成知识点存储到知识点表")
public void chaptertoknoe(String id) {
SeCourse seCourse = seCourseService.getById(id);
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("courseid", id);
List<SeChapter> chapterList = seChapterMapper.selectList(queryWrapper);
for (int i=0;i<chapterList.size();i++){
SeKonw seKonw = new SeKonw();
seKonw.setName(chapterList.get(i).getName());
//这里的数据自数据字典cck其中2代表的是章节表
seKonw.setKnowfrom("2");
seKonw.setInfo("来自课程:"+seCourse.getName());
seKonw.setFromid(chapterList.get(i).getId());
seKonw.setCourseid(id);
seKonwService.save(seKonw);
}
}
/****
* 将课程抽象成知识点并存储到知识点表中
* @param request
* @return 提示性信息
*/
@AutoLog(value = "开始组装前知识点和后知识点")
@ApiOperation(value = "开始组装前知识点和后知识点", notes = "开始组装前知识点和后知识点")
public void creteprenet(String id) {
//开始组装课程-章结构知识点关系
cretechaptr(id);
//开始组装章-节知识点
cretzhangjie(id);
//开始组装节-知识点关系
cretjieknow(id);
}
//用于在创建前知识点和后知识点的过程中创建课程-章这一层的知识点关系
public void cretechaptr(String id){
//开始组装课程-章结构知识点关系
SeCourse seCourse = seCourseService.getById(id);
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("courseid", id).eq("pid","0");
List<SeChapter> chapterList = seChapterMapper.selectList(queryWrapper);
if (!chapterList.isEmpty()){
for (int i=0;i<chapterList.size();i++) {
SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain();
//这里的数据自数据字典cck其中1代表的是课程表
seKonwRelationshipMain.setPerFrom("1");
seKonwRelationshipMain.setPerName(seCourse.getName());
System.out.println(seCourse.getName());
seKonwRelationshipMain.setPerKowId(id);
seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)");
//这里的数据自数据字典cck其中2代表的是章节表
seKonwRelationshipMain.setNextFrom("2");
seKonwRelationshipMain.setNextName(chapterList.get(i).getName());
seKonwRelationshipMain.setNextKnowId(chapterList.get(i).getId());
seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)");
seKonwRelationshipMainService.save(seKonwRelationshipMain);
}
}
}
//用于在创建前知识点和后知识点的过程中创建章-节这一层的知识点关系
public void cretzhangjie(String id){
//开始组装课程-章结构知识点关系
SeCourse seCourse = seCourseService.getById(id);
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("courseid", id).eq("pid","0");
List<SeChapter> chapterListz = seChapterMapper.selectList(queryWrapper);
if (!chapterListz.isEmpty()){
for (int i=0;i<chapterListz.size();i++) {
QueryWrapper<SeChapter> queryWrapperj = new QueryWrapper<>();
queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId());
List<SeChapter> chapterListj = seChapterMapper.selectList(queryWrapperj);
if (!chapterListj.isEmpty()) {
for (int j = 0; j < chapterListj.size(); j++) {
SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain();
//这里的数据自数据字典cck其中2代表的是章节表
seKonwRelationshipMain.setPerFrom("2");
seKonwRelationshipMain.setPerName(chapterListz.get(i).getName());
seKonwRelationshipMain.setPerKowId(chapterListz.get(i).getId());
seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)");
seKonwRelationshipMain.setNextFrom("2");
seKonwRelationshipMain.setNextName(chapterListj.get(j).getName());
seKonwRelationshipMain.setNextKnowId(chapterListj.get(j).getId());
seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)");
seKonwRelationshipMainService.save(seKonwRelationshipMain);
}
}
}
}
}
//用于在创建前知识点和后知识点的过程中创建章-节这一层的知识点关系
public void cretjieknow(String id){
//开始组装课程-章结构知识点关系
SeCourse seCourse = seCourseService.getById(id);
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("courseid", id).eq("pid","0");
List<SeChapter> chapterListz = seChapterMapper.selectList(queryWrapper);
if (!chapterListz.isEmpty()){
for (int i=0;i<chapterListz.size();i++) {
QueryWrapper<SeChapter> queryWrapperj = new QueryWrapper<>();
queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId());
List<SeChapter> chapterListj = seChapterMapper.selectList(queryWrapperj);
if (!chapterListj.isEmpty()) {
for (int j = 0; j < chapterListj.size(); j++) {
QueryWrapper<Knowcourse> queryWrapperk = new QueryWrapper<>();
queryWrapperk.eq("uintid", chapterListj.get(j).getId());
List<Knowcourse> knowcourseList = knowcourseMapper.selectList(queryWrapperk);
if (!knowcourseList.isEmpty()){
for (int c=0;c<knowcourseList.size();c++){
SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain();
//这里的数据自数据字典cck其中3代表的是知识点表
seKonwRelationshipMain.setPerFrom("2");
seKonwRelationshipMain.setPerName(seChapterService.getById(knowcourseList.get(c).getUintid()).getName());
seKonwRelationshipMain.setPerKowId(knowcourseList.get(c).getUintid());
seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)");
seKonwRelationshipMain.setNextFrom("3");
seKonwRelationshipMain.setNextName(knowcourseList.get(c).getKnow());
seKonwRelationshipMain.setNextKnowId(knowcourseList.get(c).getKnowid());
seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)");
seKonwRelationshipMainService.save(seKonwRelationshipMain);
}
}
}
}
}
}
}
}

@ -208,6 +208,8 @@ public class SeCourse implements Serializable {
@Excel(name = "开课学期", width = 15)
@ApiModelProperty(value = "开课学期")
private Integer year;
@ApiModelProperty(value = "是否已经生成图谱")
private String iscreategroup;
@TableField(exist = false)
@ApiModelProperty(value = "培养方案名称")

@ -18,4 +18,7 @@ public interface SeCourseMapper extends BaseMapper<SeCourse> {
@Select("select id from se_course where name = #{a} ")
String getcourse(String a);
@Select("SELECT * FROM se_course WHERE id==#{id}")
SeCourse getByIdcou(String id);
}

@ -21,4 +21,5 @@ public interface ISeCourseService extends IService<SeCourse> {
String getcourse(String a);
SeCourse getByIdcou(String id);
}

@ -36,4 +36,9 @@ public class SeCourseServiceImpl extends ServiceImpl<SeCourseMapper, SeCourse> i
public String getcourse(String a) {
return seCourseMapper.getcourse(a);
}
@Override
public SeCourse getByIdcou(String id) {
return seCourseMapper.getByIdcou(id);
}
}

@ -31,46 +31,57 @@ import lombok.experimental.Accessors;
public class SeKonw implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**知识点名称*/
@Excel(name = "知识点名称", width = 15)
private java.lang.String sysOrgCode;
/**知识点名称*/
@Excel(name = "知识点名称", width = 15)
@ApiModelProperty(value = "知识点名称")
private String name;
/**知识点代码*/
@Excel(name = "知识点代码", width = 15)
private java.lang.String name;
/**知识点代码*/
@Excel(name = "知识点代码", width = 15)
@ApiModelProperty(value = "知识点代码")
private String code;
/**描述*/
@Excel(name = "定义", width = 15)
@ApiModelProperty(value = "定义")
private String miaoshu;
/**简介*/
@Excel(name = "简介", width = 15)
private java.lang.String code;
/**简介*/
@Excel(name = "简介", width = 15)
@ApiModelProperty(value = "简介")
private String info;
private java.lang.String info;
/**定义*/
@Excel(name = "定义", width = 15)
@ApiModelProperty(value = "定义")
private java.lang.String miaoshu;
/**添加人真实名称*/
@ApiModelProperty(value = "添加人")
private String inrealname;
@Excel(name = "添加人真实名称", width = 15)
@ApiModelProperty(value = "添加人真实名称")
private java.lang.String inrealname;
/**知识点来源*/
@Excel(name = "知识点来源", width = 15, dicCode = "cck")
@Dict(dicCode = "cck")
@ApiModelProperty(value = "知识点来源")
private java.lang.String knowfrom;
@ApiModelProperty(value = "来源表ID")
private java.lang.String fromid;
@ApiModelProperty(value = "来源表ID")
private java.lang.String courseid;
}

@ -407,6 +407,55 @@ public class KnowcourseController extends JeecgController<Knowcourse, IKnowcours
return result;
}
/*这个主要是为了获取一个课程下面的所有的章节,学时,知识点,课程目标*/
@RequestMapping("tableData")
public Result<?> tableData (SeCourseobjectives seCourseobjectives,
HttpServletRequest request) {
//获取课程ID
String courseid = request.getParameter("id");
//组装数据
/*首先根据课程ID获取Knowcourse的数据*/
List<Knowcourse> knowcourse = knowcourseService.getlist(courseid);
Double chapterusedxs =0.0;
Double utilsusedxs =0.0;
Double utilzxs = 0.0;
/*根据章节id查询需要的章并且把knowcourse这个list里面的章的id替换成章的名称
最后的kcmuzb这个字段替换成章的学时*/
for (int i = 0;i<knowcourse.size();i++){
//获取章id
String chapterid = knowcourse.get(i).getChapterid();
/*根据章的id获取章的名称*/
String chaptername = knowcourseService.getchaptername(chapterid);
/*根据章的id获取章的学时*/
Double chapterxs = knowcourseService.getchapterxs(chapterid);
/*替换数据章的名称*/
knowcourse.get(i).setChapterid(chaptername);
/*替换数据章的学时*/
knowcourse.get(i).setKcmuzb(chapterxs);
/*获取节的id*/
String untilid = knowcourse.get(i).getUintid();
/*开始将节的id替换成节的名称*/
String untilname = knowcourseService.getuntilname(untilid);
/*替换数据节的名称*/
knowcourse.get(i).setUintid(untilname);
//根据章id,汇总章下面已经分配的学时
chapterusedxs = knowcourseService.getchapterusedxs(chapterid);
//将章的已经分配的学时,赋值给中间变量temp1
knowcourse.get(i).setTemp1(chapterusedxs);
//根据节的id查询节已经分配的学时
utilsusedxs = knowcourseService.getutilsusedxs(untilid);
//将节的已经分配的学时,赋值给中间变量temp2
knowcourse.get(i).setTemp2(utilsusedxs);
//根据节id查询节的总学时
utilzxs = knowcourseService.getutilzxs(untilid);
knowcourse.get(i).setTemp3(utilzxs);
}
return Result.OK(knowcourse);
}
}

@ -35,4 +35,22 @@ public interface KnowcourseMapper extends BaseMapper<Knowcourse> {
void updatexs(Double bl, String mbid);
@Select("select name from se_chapter where id = #{chapterid}")
String getchaptername(String chapterid);
@Select("select totalclasshours from se_chapter where id = #{chapterid}")
Double getchapterxs(String chapterid);
@Select("select name from se_chapter where id = #{untilid}")
String getuntilname(String untilid);
@Select("SELECT SUM(xs) FROM knowcourse WHERE chapterid =#{chapterid}")
Double getchapterusedxs(String chapterid);
@Select("SELECT SUM(xs) FROM knowcourse WHERE uintid =#{untilid}")
Double getutilsusedxs(String untilid);
@Select("SELECT totalclasshours FROM se_chapter WHERE id =#{untilid}")
Double getutilzxs(String untilid);
}

@ -26,4 +26,14 @@ public interface IKnowcourseService extends IService<Knowcourse> {
List<Knowcourse> getlist(String courseid);
void updatexs(Double bl, String mbid);
String getchaptername(String chapterid);
Double getchapterxs(String chapterid);
String getuntilname(String untilid);
Double getchapterusedxs(String chapterid);
Double getutilsusedxs(String untilid);
Double getutilzxs(String untilid);
}

@ -50,5 +50,35 @@ public class KnowcourseServiceImpl extends ServiceImpl<KnowcourseMapper, Knowcou
KnowcourseMapper.updatexs(bl,mbid);
}
@Override
public String getchaptername(String chapterid) {
return KnowcourseMapper.getchaptername(chapterid);
}
@Override
public Double getchapterxs(String chapterid) {
return KnowcourseMapper.getchapterxs(chapterid);
}
@Override
public String getuntilname(String untilid) {
return KnowcourseMapper.getuntilname(untilid);
}
@Override
public Double getchapterusedxs(String chapterid) {
return KnowcourseMapper.getchapterusedxs(chapterid);
}
@Override
public Double getutilsusedxs(String untilid) {
return KnowcourseMapper.getutilsusedxs(untilid);
}
@Override
public Double getutilzxs(String untilid) {
return KnowcourseMapper.getutilzxs(untilid);
}
}

Loading…
Cancel
Save