parent
05897862fa
commit
4c819cbc71
17 changed files with 729 additions and 143 deletions
@ -0,0 +1,79 @@ |
|||||||
|
package com.teaching.backend.controller.chapter; |
||||||
|
|
||||||
|
import com.teaching.backend.common.BaseResponse; |
||||||
|
import com.teaching.backend.common.ResultUtils; |
||||||
|
import com.teaching.backend.model.entity.chapter.Chapter; |
||||||
|
import com.teaching.backend.model.vo.chapter.ChapterVo; |
||||||
|
import com.teaching.backend.service.chapter.IChapterService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.LinkedList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Api(tags = "课程章节管理接口") |
||||||
|
@RestController |
||||||
|
@RequestMapping("/chapter") |
||||||
|
public class ChapterController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IChapterService chapterService; |
||||||
|
@ApiOperation("查看所有章节") |
||||||
|
@GetMapping("/list") |
||||||
|
public BaseResponse<List<Chapter>> AllList(){ |
||||||
|
List<Chapter> list = chapterService.list(); |
||||||
|
return ResultUtils.success(list); |
||||||
|
} |
||||||
|
@ApiOperation("添加章节") |
||||||
|
@PostMapping("/add") |
||||||
|
public BaseResponse<Boolean> addChapter(@RequestBody Chapter chapter){ |
||||||
|
chapter.setNumshow(chapterService.updateNumShow(chapter)); |
||||||
|
System.out.println("-=-=--=-000"+chapter.getNumshow()); |
||||||
|
boolean save = chapterService.save(chapter); |
||||||
|
return ResultUtils.success(save); |
||||||
|
} |
||||||
|
@ApiOperation("删除章节信息") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public BaseResponse<Boolean> delete(@PathVariable String id){ |
||||||
|
Boolean chapter = chapterService.deleteAfterUpdate(id); |
||||||
|
return ResultUtils.success(chapter); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("更新章节") |
||||||
|
@PutMapping |
||||||
|
public BaseResponse<Boolean> updateChapter(@RequestBody Chapter chapter){ |
||||||
|
System.out.println(chapter); |
||||||
|
boolean b = chapterService.updateById(chapter); |
||||||
|
return ResultUtils.success(b); |
||||||
|
} |
||||||
|
@ApiOperation("查看所有章节linkedlist") |
||||||
|
@GetMapping("/listall/{courseid}") |
||||||
|
public BaseResponse<LinkedList<Chapter>> getAll(@PathVariable String courseid){ |
||||||
|
LinkedList<Chapter> list =chapterService.getCourseChapter(courseid); |
||||||
|
System.out.println(list); |
||||||
|
return ResultUtils.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("章节顺序linkedlist") |
||||||
|
@GetMapping("/aaa/{courseid}") |
||||||
|
public BaseResponse<LinkedList<ChapterVo>> get(@PathVariable String courseid){ |
||||||
|
LinkedList<ChapterVo> list =chapterService.getChapterSection(courseid); |
||||||
|
System.out.println(list); |
||||||
|
return ResultUtils.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("计算章的个数") |
||||||
|
@GetMapping("/count/{courseid}") |
||||||
|
public BaseResponse<Long> getChapterCount(@PathVariable String courseid){ |
||||||
|
LinkedList<Chapter> list =chapterService.getCourseChapter(courseid); |
||||||
|
Long count=list.stream() |
||||||
|
.filter( str -> !str.getNumshow().contains("-")) |
||||||
|
.count(); |
||||||
|
return ResultUtils.success(count); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.teaching.backend.controller.know; |
||||||
|
|
||||||
|
|
||||||
|
import com.teaching.backend.common.BaseResponse; |
||||||
|
import com.teaching.backend.common.ResultUtils; |
||||||
|
import com.teaching.backend.model.entity.know.Know; |
||||||
|
import com.teaching.backend.model.entity.know.KnowRelationship; |
||||||
|
import com.teaching.backend.service.know.IKnowRelationshipService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author author |
||||||
|
* @since 2024-06-20 |
||||||
|
*/ |
||||||
|
@Api(tags = "知识点章节关系") |
||||||
|
@RestController |
||||||
|
@RequestMapping("/know-relationship") |
||||||
|
public class KnowRelationshipController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IKnowRelationshipService knowRelationshipService; |
||||||
|
@ApiOperation("添加课程知识点关系") |
||||||
|
@PostMapping() |
||||||
|
public BaseResponse<Boolean> add(@RequestBody KnowRelationship knowRelationship){ |
||||||
|
boolean save = knowRelationshipService.save(knowRelationship); |
||||||
|
return ResultUtils.success(save); |
||||||
|
} |
||||||
|
@GetMapping() |
||||||
|
public BaseResponse<List<KnowRelationship>> getAll(){ |
||||||
|
List<KnowRelationship> list = knowRelationshipService.list(); |
||||||
|
return ResultUtils.success(list); |
||||||
|
} |
||||||
|
} |
@ -1,117 +0,0 @@ |
|||||||
package com.teaching.backend.entity; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField; |
|
||||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||||
import com.baomidou.mybatisplus.annotation.IdType; |
|
||||||
import java.time.LocalDateTime; |
|
||||||
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; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author author |
|
||||||
* @since 2024-06-07 |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@EqualsAndHashCode(callSuper = false) |
|
||||||
@Accessors(chain = true) |
|
||||||
@TableName("chapter") |
|
||||||
@ApiModel(value="Chapter对象", description="") |
|
||||||
public class Chapter implements Serializable { |
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键") |
|
||||||
@TableId(value = "id", type = IdType.AUTO) |
|
||||||
private String id; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建人") |
|
||||||
@TableField("create_by") |
|
||||||
private String createBy; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建日期") |
|
||||||
@TableField("create_time") |
|
||||||
private LocalDateTime createTime; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "更新人") |
|
||||||
@TableField("update_by") |
|
||||||
private String updateBy; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "更新日期") |
|
||||||
@TableField("update_time") |
|
||||||
private LocalDateTime updateTime; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属部门") |
|
||||||
@TableField("sys_org_code") |
|
||||||
private String sysOrgCode; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "序号") |
|
||||||
@TableField("num") |
|
||||||
private Integer num; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称") |
|
||||||
@TableField("name") |
|
||||||
private String name; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "简介") |
|
||||||
@TableField("content") |
|
||||||
private String content; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "父级节点") |
|
||||||
@TableField("pid") |
|
||||||
private String pid; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否有子节点") |
|
||||||
@TableField("has_child") |
|
||||||
private String hasChild; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "课程") |
|
||||||
@TableField("courseid") |
|
||||||
private String courseid; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "课程目标") |
|
||||||
@TableField("courseobjectivesid") |
|
||||||
private String courseobjectivesid; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "总学时") |
|
||||||
@TableField("totalclasshours") |
|
||||||
private String totalclasshours; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "要求") |
|
||||||
@TableField("requirement") |
|
||||||
private String requirement; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "线上学时") |
|
||||||
@TableField("onlinclasshours") |
|
||||||
private String onlinclasshours; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "知识点") |
|
||||||
@TableField("knowid") |
|
||||||
private String knowid; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "周次") |
|
||||||
@TableField("zc") |
|
||||||
private String zc; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "资源") |
|
||||||
@TableField("ziyuan") |
|
||||||
private String ziyuan; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "知识点") |
|
||||||
@TableField("know") |
|
||||||
private String know; |
|
||||||
|
|
||||||
@ApiModelProperty(value = "内部序号显示") |
|
||||||
@TableField("numshow") |
|
||||||
private String numshow; |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.teaching.backend.mapper.ChapterMapper"> |
|
||||||
|
|
||||||
</mapper> |
|
@ -0,0 +1,18 @@ |
|||||||
|
package com.teaching.backend.mapper.know; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.teaching.backend.model.entity.know.KnowRelationship; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author author |
||||||
|
* @since 2024-06-20 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface KnowRelationshipMapper extends BaseMapper<KnowRelationship> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.teaching.backend.model.entity.know; |
||||||
|
|
||||||
|
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.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author author |
||||||
|
* @since 2024-06-20 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("know_relationship") |
||||||
|
@ApiModel(value="KnowRelationship对象", description="") |
||||||
|
public class KnowRelationship implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "章节id") |
||||||
|
@TableField("chapterId") |
||||||
|
private String chapterId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "课程id") |
||||||
|
@TableField("courseId") |
||||||
|
private String courseId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "知识点id") |
||||||
|
@TableField("knowId") |
||||||
|
private int knowId; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
package com.teaching.backend.model.vo.chapter; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.teaching.backend.model.entity.chapter.Chapter; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class ChapterVo { |
||||||
|
private String id; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称") |
||||||
|
@TableField("name") |
||||||
|
private String name; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "简介") |
||||||
|
@TableField("content") |
||||||
|
private String content; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "父级节点") |
||||||
|
@TableField("pid") |
||||||
|
private String pid; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "课程") |
||||||
|
@TableField("courseid") |
||||||
|
private String courseid; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "课程目标") |
||||||
|
@TableField("courseobjectivesid") |
||||||
|
private String courseobjectivesid; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "总学时") |
||||||
|
@TableField("totalclasshours") |
||||||
|
private String totalclasshours; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "线上学时") |
||||||
|
@TableField("onlinclasshours") |
||||||
|
private String onlinclasshours; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "知识点id") |
||||||
|
@TableField("knowid") |
||||||
|
private String knowid; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "周次") |
||||||
|
@TableField("zc") |
||||||
|
private String zc; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "内部序号显示") |
||||||
|
@TableField("numshow") |
||||||
|
private String numshow; |
||||||
|
|
||||||
|
private List<Chapter> chapterSection; |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.teaching.backend.service.impl.know; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.teaching.backend.mapper.know.KnowRelationshipMapper; |
||||||
|
import com.teaching.backend.model.entity.know.KnowRelationship; |
||||||
|
import com.teaching.backend.service.know.IKnowRelationshipService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author author |
||||||
|
* @since 2024-06-20 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class KnowRelationshipServiceImpl extends ServiceImpl<KnowRelationshipMapper, KnowRelationship> implements IKnowRelationshipService { |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue