Merge remote-tracking branch 'origin/在线访问lhj' into 在线访问lhj

在线访问lhj
李宏杰 8 months ago
commit 46c38e66d3

@ -2,45 +2,40 @@ package com.tamguo.modules.tiku.model;
import java.io.Serializable; import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField; // 用于 JSON 序列化时的注解
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature; // JSON 序列化特性
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField; // 与数据库表字段相关的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName; // 表名注解
import com.tamguo.config.dao.SuperEntity; import com.tamguo.config.dao.SuperEntity; // 父类实体
import com.tamguo.modules.tiku.model.enums.ChapterStatusEnum; import com.tamguo.modules.tiku.model.enums.ChapterStatusEnum; // 章节状态枚举
import lombok.Data; import lombok.Data; // Lombok 的数据注解
import java.util.List;
/** /**
* The persistent class for the t_chapter database table. * t_chapter
*
*/ */
@TableName(value="t_chapter") @TableName(value = "t_chapter") // 指定表名为 t_chapter
@Data @Data // Lombok 的数据注解,自动生成 getter 和 setter 等方法
public class ChapterEntity extends SuperEntity<ChapterEntity> implements Serializable { public class ChapterEntity extends SuperEntity<ChapterEntity> implements Serializable { // 继承父类实体,实现序列化接口
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L; // 序列化版本号
private String courseId; // 课程 ID
private String bookId; // 书籍 ID
private String name; // 章节名称
private String parentCode; // 父章节代码
private String parentCodes; // 父章节代码列表
private Integer questionNum; // 问题数量
private Integer pointNum; // 知识点数量
private Integer orders; // 排序序号
private Boolean treeLeaf; // 是否为叶子节点
private Integer treeLevel; // 树的层级
private String seoTitle; // SEO 标题
private String seoKeywords; // SEO 关键字
private String seoDescription; // SEO 描述
private String courseId; @TableField(exist = false) // 表示该字段在数据库中不存在
private String bookId; private List<ChapterEntity> childChapterList; // 子章节列表
private String name;
private String parentCode;
private String parentCodes;
private Integer questionNum;
private Integer pointNum;
private Integer orders;
private Boolean treeLeaf;
private Integer treeLevel;
private String seoTitle;
private String seoKeywords;
private String seoDescription;
@TableField(exist=false)
private List<ChapterEntity> childChapterList;
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
private ChapterStatusEnum status;
@JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString) // 指定 JSON 序列化枚举时的特性
private ChapterStatusEnum status; // 章节状态枚举
} }

@ -1,43 +1,42 @@
package com.tamguo.modules.tiku.model; package com.tamguo.modules.tiku.model;
import java.util.Date; import java.util.Date; // 日期类
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.tamguo.modules.tiku.model.enums.CourseStatusEnum;
import lombok.Data;
@Data import com.alibaba.fastjson.annotation.JSONField; // 用于 JSON 序列化时的注解
@TableName(value="t_course") import com.alibaba.fastjson.serializer.SerializerFeature; // JSON 序列化特性
import com.baomidou.mybatisplus.annotations.TableField; // 与数据库表字段相关的注解
import com.baomidou.mybatisplus.annotations.TableId; // 表主键注解
import com.baomidou.mybatisplus.annotations.TableName; // 表名注解
import com.baomidou.mybatisplus.enums.FieldFill; // 字段填充策略枚举
import com.tamguo.modules.tiku.model.enums.CourseStatusEnum; // 课程状态枚举
import lombok.Data; // Lombok 的数据注解
@Data // Lombok 的数据注解,自动生成 getter 和 setter 等方法
@TableName(value = "t_course") // 指定表名为 t_course
public class CourseEntity { public class CourseEntity {
@TableId // 标识为主键
@TableId private String id; // 课程 ID
private String id; private String subjectId; // 科目 ID
private String subjectId; private String name; // 课程名称
private String name; private Integer sort; // 排序号
private Integer sort; private Integer questionNum; // 问题数量
private Integer questionNum; private Integer pointNum; // 知识点数量
private Integer pointNum; private String remarks; // 备注
private String remarks; private String icon; // 图标
private String icon;
private String seoTitle; // SEO 标题
private String seoTitle; private String seoKeywords; // SEO 关键字
private String seoKeywords; private String seoDescription; // SEO 描述
private String seoDescription;
@TableField(fill = FieldFill.INSERT_UPDATE) // 字段填充策略,在插入和更新时填充
@TableField(fill = FieldFill.INSERT_UPDATE) private String createBy; // 创建人
private String createBy; @TableField(fill = FieldFill.INSERT_UPDATE) // 字段填充策略,在插入和更新时填充
@TableField(fill = FieldFill.INSERT_UPDATE) private String updateBy; // 更新人
private String updateBy; @TableField(fill = FieldFill.INSERT_UPDATE) // 字段填充策略,在插入和更新时填充
@TableField(fill = FieldFill.INSERT_UPDATE) private Date createDate; // 创建日期
private Date createDate; @TableField(fill = FieldFill.INSERT_UPDATE) // 字段填充策略,在插入和更新时填充
@TableField(fill = FieldFill.INSERT_UPDATE) private Date updateDate; // 更新日期
private Date updateDate;
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
private CourseStatusEnum status;
} @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString) // 指定 JSON 序列化枚举时的特性
private CourseStatusEnum status; // 课程状态枚举
}

@ -1,54 +1,103 @@
package com.tamguo.modules.tiku.model.enums; package com.tamguo.modules.tiku.model.enums;
import java.io.Serializable;
/** /**
* (1.2.; 3.) *
* * (1. 2. 3. 4. 5. )
* @author tamguo
* *
* @author tamguo
*/ */
public enum QuestionTypeEnum { public enum QuestionTypeEnum {
/**
*
* @param value
* @param desc
*/
DANXUANTI("1", "单选题"), DANXUANTI("1", "单选题"),
/**
*
* @param value
* @param desc
*/
DUOXUANTI("2", "多选题"), DUOXUANTI("2", "多选题"),
/**
*
* @param value
* @param desc
*/
TIANKONGTI("3", "填空题"), TIANKONGTI("3", "填空题"),
/**
*
* @param value
* @param desc
*/
PANDUANTI("4", "判断题"), PANDUANTI("4", "判断题"),
/**
*
* @param value
* @param desc
*/
WENDATI("5", "问答题"); WENDATI("5", "问答题");
private String value; private String value; // 枚举值
private String desc; private String desc; // 描述
QuestionTypeEnum(final String value, final String desc) { /**
this.value = value; *
this.desc = desc; * @param value
} * @param desc
*/
public static QuestionTypeEnum getQuestionType(String value) { QuestionTypeEnum(final String value, final String desc) {
if("1".equals(value)) { this.value = value;
return DANXUANTI; this.desc = desc;
}else if("2".equals(value)) { }
return DUOXUANTI;
}else if("3".equals(value)) { /**
return TIANKONGTI; * value
}else if("4".equals(value)) { * @param value value
return PANDUANTI; * @return WENDATI
}else if("5".equals(value)) { */
return WENDATI; public static QuestionTypeEnum getQuestionType(String value) {
} if ("1".equals(value)) {
return WENDATI; return DANXUANTI;
} } else if ("2".equals(value)) {
return DUOXUANTI;
public Serializable getValue() { } else if ("3".equals(value)) {
return this.value; return TIANKONGTI;
} } else if ("4".equals(value)) {
return PANDUANTI;
public String getDesc(){ } else if ("5".equals(value)) {
return this.desc; return WENDATI;
} }
return WENDATI;
@Override }
public String toString() {
return this.value; /**
} *
* @return
} */
public Serializable getValue() {
return this.value;
}
/**
*
* @return
*/
public String getDesc() {
return this.desc;
}
/**
*
* @return
*/
@Override
public String toString() {
return this.value;
}
}

@ -1,79 +1,93 @@
package com.tamguo.modules.tiku.service.impl; package com.tamguo.modules.tiku.service.impl;
import java.util.ArrayList; import java.util.ArrayList; // 导入 ArrayList 类,用于存储章节列表
import java.util.List; import java.util.List; // 导入 List 接口,用于存储章节实体列表
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils; // 导入StringUtils 类,用于字符串操作
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 注解,用于依赖注入
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service; // 导入 Service 注解,标识为服务层实现类
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 注解,用于事务管理
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray; // 导入 JSONArray 类,用于处理 JSON 数组
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject; // 导入 JSONObject 类,用于处理 JSON 对象
import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.mapper.Condition; // 导入 Condition 类,用于构建查询条件
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page; // 导入 Page 类,用于分页查询
import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; // 导入 ServiceImpl 类,作为服务层实现类的父类
import com.tamguo.common.utils.SystemConstant; import com.tamguo.common.utils.SystemConstant; // 导入 SystemConstant 类,用于定义系统常量
import com.tamguo.modules.tiku.dao.KnowPointMapper; import com.tamguo.modules.tiku.dao.KnowPointMapper; // 导入 KnowPointMapper 接口,用于知识关键点的数据访问
import com.tamguo.modules.tiku.dao.ChapterMapper; import com.tamguo.modules.tiku.dao.ChapterMapper; // 导入 ChapterMapper 接口,用于章节的数据访问
import com.tamguo.modules.tiku.dao.CourseMapper; import com.tamguo.modules.tiku.dao.CourseMapper; // 导入 CourseMapper 接口,用于课程的数据访问
import com.tamguo.modules.tiku.model.KnowPointEntity; import com.tamguo.modules.tiku.model.KnowPointEntity; // 导入 KnowPointEntity 类,代表知识关键点实体
import com.tamguo.modules.tiku.model.ChapterEntity; import com.tamguo.modules.tiku.model.ChapterEntity; // 导入 ChapterEntity 类,代表章节实体
import com.tamguo.modules.tiku.model.condition.ChapterCondition; import com.tamguo.modules.tiku.model.condition.ChapterCondition; // 导入 ChapterCondition 类,代表章节查询条件
import com.tamguo.modules.tiku.model.enums.ChapterStatusEnum; import com.tamguo.modules.tiku.model.enums.ChapterStatusEnum; // 导入 ChapterStatusEnum 枚举,代表章节状态
import com.tamguo.modules.tiku.service.IChapterService; import com.tamguo.modules.tiku.service.IChapterService; // 导入 IChapterService 接口,定义章节服务的接口
@Service @Service // 标识为服务层实现类
public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity> implements IChapterService{ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity> implements IChapterService {
@Autowired @Autowired // 自动注入 ChapterMapper 实例
ChapterMapper chapterMapper; private ChapterMapper chapterMapper;
@Autowired
CourseMapper courseMapper; @Autowired // 自动注入 CourseMapper 实例
@Autowired private CourseMapper courseMapper;
KnowPointMapper bookMapper;
@Autowired // 自动注入 KnowPointMapper 实例
@Transactional(readOnly=false) private KnowPointMapper bookMapper;
@SuppressWarnings("unchecked")
/**
*
*
* @param bookId ID
* @return
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@SuppressWarnings("unchecked") // 抑制unchecked 警告
@Override @Override
public List<ChapterEntity> findChapterTree(String bookId) { public List<ChapterEntity> findChapterTree(String bookId) {
// 根据书籍 ID 查询章节列表
List<ChapterEntity> chapterList = baseMapper.selectList(Condition.create().eq("book_id", bookId)); List<ChapterEntity> chapterList = baseMapper.selectList(Condition.create().eq("book_id", bookId));
// 获取根chapter UID // 获取根章节 UID
String rootUid = StringUtils.EMPTY; String rootUid = StringUtils.EMPTY;
for(int i=0 ; i<chapterList.size() ; i++){ for (int i = 0; i < chapterList.size(); i++) {
ChapterEntity chapter = chapterList.get(i); ChapterEntity chapter = chapterList.get(i);
if(chapter.getParentCode().equals(SystemConstant.CHAPTER_DEFAULT_ROOT_UID)){ if (chapter.getParentCode().equals(SystemConstant.CHAPTER_DEFAULT_ROOT_UID)) {
rootUid = chapter.getId(); rootUid = chapter.getId();
} }
} }
// 获取第一层结构 // 获取第一层结构
List<ChapterEntity> entitys = new ArrayList<>(); List<ChapterEntity> entitys = new ArrayList<>();
for(int i=0 ; i<chapterList.size() ; i++){ for (int i = 0; i < chapterList.size(); i++) {
ChapterEntity chapter = chapterList.get(i); ChapterEntity chapter = chapterList.get(i);
if(rootUid.equals(chapter.getParentCode())){ if (rootUid.equals(chapter.getParentCode())) {
entitys.add(chapter); entitys.add(chapter);
} }
} }
for(int i=0 ; i<entitys.size() ; i++){
for (int i = 0; i < entitys.size(); i++) {
ChapterEntity entity = entitys.get(i); ChapterEntity entity = entitys.get(i);
// 获取子章节列表
List<ChapterEntity> childs = new ArrayList<>(); List<ChapterEntity> childs = new ArrayList<>();
for(int k=0 ; k<chapterList.size() ; k++){ for (int k = 0; k < chapterList.size(); k++) {
ChapterEntity chapter = chapterList.get(k); ChapterEntity chapter = chapterList.get(k);
if(entity.getId().equals(chapter.getParentCode())){ if (entity.getId().equals(chapter.getParentCode())) {
childs.add(chapter); childs.add(chapter);
} }
} }
entity.setChildChapterList(childs); entity.setChildChapterList(childs);
} }
for(int i=0 ; i<entitys.size() ; i++){
for (int i = 0; i < entitys.size(); i++) {
List<ChapterEntity> childs = entitys.get(i).getChildChapterList(); List<ChapterEntity> childs = entitys.get(i).getChildChapterList();
for(int k=0 ; k<childs.size() ; k++){ for (int k = 0; k < childs.size(); k++) {
ChapterEntity child = childs.get(k); ChapterEntity child = childs.get(k);
// 获取子子章节列表
List<ChapterEntity> tmpChilds = new ArrayList<>(); List<ChapterEntity> tmpChilds = new ArrayList<>();
for(int n=0 ; n<chapterList.size() ; n++){ for (int n = 0; n < chapterList.size(); n++) {
ChapterEntity chapter = chapterList.get(n); ChapterEntity chapter = chapterList.get(n);
if(child.getId().equals(chapter.getParentCode())){ if (child.getId().equals(chapter.getParentCode())) {
tmpChilds.add(chapter); tmpChilds.add(chapter);
} }
} }
@ -83,83 +97,98 @@ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity
return entitys; return entitys;
} }
@SuppressWarnings("unchecked") /**
*
*
* @param condition
* @return
*/
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Override @Override
public List<ChapterEntity> listData(ChapterCondition condition) { public List<ChapterEntity> listData(ChapterCondition condition) {
Condition query = Condition.create(); Condition query = Condition.create(); // 创建查询条件对象
if(!StringUtils.isEmpty(condition.getParentCode())) { if (!StringUtils.isEmpty(condition.getParentCode())) {
query.eq("parent_code", condition.getParentCode()); query.eq("parent_code", condition.getParentCode()); // 添加父章节代码条件
}else { } else {
query.eq("tree_level", "0"); query.eq("tree_level", "0"); // 添加树级别为 0 的条件(即根章节)
} }
if(!StringUtils.isEmpty(condition.getId())) { if (!StringUtils.isEmpty(condition.getId())) {
query.eq("id", condition.getId()); query.eq("id", condition.getId()); // 添加章节 ID 条件
} }
if(!StringUtils.isEmpty(condition.getName())) { if (!StringUtils.isEmpty(condition.getName())) {
query.like("name", condition.getName()); query.like("name", condition.getName()); // 添加章节名称模糊匹配条件
} }
if(!StringUtils.isEmpty(condition.getBookId())) { if (!StringUtils.isEmpty(condition.getBookId())) {
query.andNew().eq("course_id", condition.getBookId()).or().eq("book_id", condition.getBookId()).or().eq("subject_id", condition.getBookId());; query.andNew().eq("course_id", condition.getBookId()).or().eq("book_id", condition.getBookId()).or().eq("subject_id", condition.getBookId()); // 添加课程 ID、书籍 ID 或科目 ID 条件
} }
return chapterMapper.selectList(query); return chapterMapper.selectList(query); // 执行查询并返回结果
} }
@SuppressWarnings("unchecked") /**
@Override * ZTree JSON
public JSONArray treeData(String courseId, String excludeId) { *
List<ChapterEntity> chapterList = null; * @param chapterList
if(StringUtils.isEmpty(excludeId)) { * @return ZTree JSON
chapterList = chapterMapper.selectList(Condition.EMPTY); */
} else {
chapterList = chapterMapper.selectList(Condition.create().notLike("parent_codes", excludeId).eq("id", excludeId));
}
return turnZTreeData(chapterList);
}
private JSONArray turnZTreeData(List<ChapterEntity> chapterList) { private JSONArray turnZTreeData(List<ChapterEntity> chapterList) {
if(chapterList != null) { if (chapterList!= null) {
JSONArray nodes = new JSONArray(); JSONArray nodes = new JSONArray(); // 创建 JSON 数组对象
for(int i=0 ; i<chapterList.size() ; i++) { for (int i = 0; i < chapterList.size(); i++) {
JSONObject node = new JSONObject(); JSONObject node = new JSONObject(); // 创建 JSON 对象
ChapterEntity office = chapterList.get(i); ChapterEntity office = chapterList.get(i); // 获取章节实体
node.put("name", office.getName()); node.put("name", office.getName()); // 设置节点名称
node.put("id", office.getId()); node.put("id", office.getId()); // 设置节点 ID
node.put("pId", office.getParentCode()); node.put("pId", office.getParentCode()); // 设置父节点 ID
node.put("title", office.getName()); node.put("title", office.getName()); // 设置节点标题
nodes.add(node);
nodes.add(node); // 将节点添加到 JSON 数组中
} }
return nodes; return nodes; // 返回 JSON 数组
} }
return null; return null; // 如果章节列表为空,则返回 null
} }
@Transactional(readOnly=false) /**
*
*
* @param chapter
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void save(ChapterEntity chapter) { public void save(ChapterEntity chapter) {
// 更新父章节的叶子节点状态为 false
ChapterEntity parentChapter = chapterMapper.selectById(chapter.getParentCode()); ChapterEntity parentChapter = chapterMapper.selectById(chapter.getParentCode());
parentChapter.setTreeLeaf(false); parentChapter.setTreeLeaf(false);
chapterMapper.updateById(parentChapter); chapterMapper.updateById(parentChapter);
chapter.setStatus(ChapterStatusEnum.NORMAL); chapter.setStatus(ChapterStatusEnum.NORMAL); // 设置章节状态为正常
chapter.setTreeLeaf(true); chapter.setTreeLeaf(true); // 设置章节为叶子节点
chapter.setTreeLevel(parentChapter.getTreeLevel() + 1); chapter.setTreeLevel(parentChapter.getTreeLevel() + 1); // 设置章节树级别
chapter.setBookId(parentChapter.getBookId()); chapter.setBookId(parentChapter.getBookId()); // 设置章节所属书籍 ID
chapterMapper.insert(chapter); chapterMapper.insert(chapter); // 插入章节记录
// 更新章节的父章节代码列表
chapter.setParentCodes(parentChapter.getParentCodes() + chapter.getId() + ","); chapter.setParentCodes(parentChapter.getParentCodes() + chapter.getId() + ",");
chapterMapper.updateById(chapter); chapterMapper.updateById(chapter);
} }
@SuppressWarnings("unchecked") /**
@Transactional(readOnly=false) *
*
* @param chapter
*/
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void update(ChapterEntity chapter) { public void update(ChapterEntity chapter) {
ChapterEntity entity = chapterMapper.selectById(chapter.getId()); // 更新父章节的叶子节点状态为 false
ChapterEntity parentChapter = chapterMapper.selectById(chapter.getParentCode()); ChapterEntity parentChapter = chapterMapper.selectById(chapter.getParentCode());
parentChapter.setTreeLeaf(false); parentChapter.setTreeLeaf(false);
chapterMapper.updateById(parentChapter); chapterMapper.updateById(parentChapter);
// 更新章节信息
ChapterEntity entity = chapterMapper.selectById(chapter.getId());
entity.setName(chapter.getName()); entity.setName(chapter.getName());
entity.setParentCode(chapter.getParentCode()); entity.setParentCode(chapter.getParentCode());
entity.setParentCodes(parentChapter.getParentCodes() + entity.getId() + ","); entity.setParentCodes(parentChapter.getParentCodes() + entity.getId() + ",");
@ -167,12 +196,12 @@ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity
entity.setPointNum(chapter.getPointNum()); entity.setPointNum(chapter.getPointNum());
entity.setOrders(chapter.getOrders()); entity.setOrders(chapter.getOrders());
entity.setTreeLevel(entity.getParentCodes().split(",").length - 1); entity.setTreeLevel(entity.getParentCodes().split(",").length - 1);
// 更新子集章节 // 更新子集章节的父章节代码列表和树级别
List<ChapterEntity> chapterList = chapterMapper.selectList(Condition.create().like("parent_codes", entity.getId())); List<ChapterEntity> chapterList = chapterMapper.selectList(Condition.create().like("parent_codes", entity.getId()));
for(int i=0 ; i<chapterList.size() ; i++) { for (int i = 0; i < chapterList.size(); i++) {
ChapterEntity child = chapterList.get(i); ChapterEntity child = chapterList.get(i);
String subParentCodes = child.getParentCodes().substring(child.getParentCodes().indexOf(entity.getId()) + entity.getId().length() + 1); String subParentCodes = child.getParentCodes().substring(child.getParentCodes().indexOf(entity.getId()) + entity.getId().length() + 1);
child.setParentCodes(entity.getParentCodes() + subParentCodes); child.setParentCodes(entity.getParentCodes() + subParentCodes);
child.setTreeLevel(child.getParentCodes().split(",").length - 1); child.setTreeLevel(child.getParentCodes().split(",").length - 1);
@ -181,40 +210,64 @@ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity
chapterMapper.updateById(entity); chapterMapper.updateById(entity);
} }
@Transactional(readOnly=false) /**
@SuppressWarnings("unchecked") *
*
* @param id ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Override @Override
public void delete(String id) { public void delete(String id) {
// 更新章节状态为已删除
ChapterEntity chapter = chapterMapper.selectById(id); ChapterEntity chapter = chapterMapper.selectById(id);
chapter.setStatus(ChapterStatusEnum.DELETE); chapter.setStatus(ChapterStatusEnum.DELETE);
chapterMapper.updateById(chapter); chapterMapper.updateById(chapter);
// 删除子章节 // 删除子章节
List<ChapterEntity> childs = chapterMapper.selectList(Condition.create().like("parent_codes", id)); List<ChapterEntity> childs = chapterMapper.selectList(Condition.create().like("parent_codes", id));
for(int i=0 ; i<childs.size() ; i++) { for (int i = 0; i < childs.size(); i++) {
ChapterEntity child = childs.get(i); ChapterEntity child = childs.get(i);
child.setStatus(ChapterStatusEnum.DELETE); child.setStatus(ChapterStatusEnum.DELETE);
chapterMapper.updateById(child); chapterMapper.updateById(child);
} }
} }
@Transactional(readOnly=true) /**
@SuppressWarnings("unchecked") * ID
*
* @param courseId ID
* @return
*/
@Transactional(readOnly = true) // 开启事务,设置只读为 true
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Override @Override
public List<ChapterEntity> findCourseChapter(String courseId) { public List<ChapterEntity> findCourseChapter(String courseId) {
// 根据课程 ID 查询知识关键点列表
List<KnowPointEntity> bookList = bookMapper.selectList(Condition.create().eq("course_id", courseId)); List<KnowPointEntity> bookList = bookMapper.selectList(Condition.create().eq("course_id", courseId));
if(bookList.size() == 0) { if (bookList.size() == 0) {
return null; return null; // 如果没有找到知识关键点,则返回 null
} }
Condition condition = Condition.create();
condition.eq("tree_level", 1); Condition condition = Condition.create(); // 创建查询条件对象
condition.eq("book_id", bookList.get(0).getId()); condition.eq("tree_level", 1); // 设置树级别为 1
condition.eq("book_id", bookList.get(0).getId()); // 设置书籍 ID
// 根据条件查询章节列表
List<ChapterEntity> list = chapterMapper.selectPage(new Page<>(1, 5), condition); List<ChapterEntity> list = chapterMapper.selectPage(new Page<>(1, 5), condition);
return list; return list; // 返回章节列表
} }
@Transactional(readOnly=true) /**
* ID
*
* @param parentCode
* @param id ID
* @return
*/
@Transactional(readOnly = true) // 开启事务,设置只读为 true
@Override @Override
public ChapterEntity selectNextChapter(String parentCode , String id) { public ChapterEntity selectNextChapter(String parentCode, String id) {
return chapterMapper.selectNextChapter(parentCode , id); return chapterMapper.selectNextChapter(parentCode, id); // 查询下一个章节
} }
} }

@ -1,125 +1,185 @@
package com.tamguo.modules.tiku.service.impl; package com.tamguo.modules.tiku.service.impl;
import java.util.Arrays; import java.util.Arrays; // 导入 Arrays 类,用于操作数组
import java.util.List; import java.util.List; // 导入 List 接口,用于存储科目和课程实体列表
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 注解,用于依赖注入
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service; // 导入 Service 注解,标识为服务层实现类
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 注解,用于事务管理
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils; // 导入 StringUtils 类,用于字符串操作
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray; // 导入 JSONArray 类,用于处理 JSON 数组
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject; // 导入 JSONObject 类,用于处理 JSON 对象
import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.mapper.Condition; // 导入 Condition 类,用于构建查询条件
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page; // 导入 Page 类,用于分页查询
import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; // 导入 ServiceImpl 类,作为服务层实现类的父类
import com.tamguo.modules.tiku.dao.CourseMapper; import com.tamguo.modules.tiku.dao.CourseMapper; // 导入 CourseMapper 接口,用于课程的数据访问
import com.tamguo.modules.tiku.dao.SubjectMapper; import com.tamguo.modules.tiku.dao.SubjectMapper; // 导入 SubjectMapper 接口,用于科目的数据访问
import com.tamguo.modules.tiku.model.CourseEntity; import com.tamguo.modules.tiku.model.CourseEntity; // 导入 CourseEntity 类,代表课程实体
import com.tamguo.modules.tiku.model.SubjectEntity; import com.tamguo.modules.tiku.model.SubjectEntity; // 导入 SubjectEntity 类,代表科目实体
import com.tamguo.modules.tiku.model.condition.CourseCondition; import com.tamguo.modules.tiku.model.condition.CourseCondition; // 导入 CourseCondition 类,代表课程查询条件
import com.tamguo.modules.tiku.model.enums.CourseStatusEnum; import com.tamguo.modules.tiku.model.enums.CourseStatusEnum; // 导入 CourseStatusEnum 枚举,代表课程状态
import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; // 导入 SubjectStatusEnum 枚举,代表科目状态
import com.tamguo.modules.tiku.service.ICourseService; import com.tamguo.modules.tiku.service.ICourseService; // 导入 ICourseService 接口,定义课程服务的接口
@Service @Service // 标识为服务层实现类
public class CourseServiceImpl extends ServiceImpl<CourseMapper, CourseEntity> implements ICourseService{ public class CourseServiceImpl extends ServiceImpl<CourseMapper, CourseEntity> implements ICourseService {
@Autowired @Autowired // 自动注入 CourseMapper 实例
public CourseMapper courseMapper; private CourseMapper courseMapper;
@Autowired
public SubjectMapper subjectMapper; @Autowired // 自动注入 SubjectMapper 实例
private SubjectMapper subjectMapper;
@SuppressWarnings("unchecked")
@Transactional(readOnly=true) /**
*
*
* @param condition
* @return
*/
@SuppressWarnings("unchecked") // 抑制unchecked 警告
@Transactional(readOnly = true) // 开启事务,设置只读为 true
@Override @Override
public Page<CourseEntity> listData(CourseCondition condition) { public Page<CourseEntity> listData(CourseCondition condition) {
Page<CourseEntity> page = new Page<>(condition.getPageNo() , condition.getPageSize()); Page<CourseEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize()); // 创建分页对象
Condition query = Condition.create();
if(!StringUtils.isEmpty(condition.getId())) { Condition query = Condition.create(); // 创建查询条件对象
query.eq("id", condition.getId()); if (!StringUtils.isEmpty(condition.getId())) {
query.eq("id", condition.getId()); // 添加课程 ID 条件
} }
if(!StringUtils.isEmpty(condition.getName())) { if (!StringUtils.isEmpty(condition.getName())) {
query.like("name", condition.getName()); query.like("name", condition.getName()); // 添加课程名称模糊匹配条件
} }
if(!StringUtils.isEmpty(condition.getSubjectId())) { if (!StringUtils.isEmpty(condition.getSubjectId())) {
query.eq("subject_id", condition.getSubjectId()); query.eq("subject_id", condition.getSubjectId()); // 添加科目 ID 条件
} }
if(!StringUtils.isEmpty(condition.getStatus())) { if (!StringUtils.isEmpty(condition.getStatus())) {
query.eq("status", condition.getStatus()); query.eq("status", condition.getStatus()); // 添加课程状态条件
} }
query.orderAsc(Arrays.asList("sort")); query.orderAsc(Arrays.asList("sort")); // 根据排序字段升序排序
return page.setRecords(courseMapper.selectPage(page , query));
return page.setRecords(courseMapper.selectPage(page, query)); // 执行查询并设置分页结果
} }
@Transactional(readOnly=false) /**
*
*
* @param course
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void save(CourseEntity course) { public void save(CourseEntity course) {
course.setStatus(CourseStatusEnum.NORMAL); course.setStatus(CourseStatusEnum.NORMAL); // 设置课程状态为正常
courseMapper.insert(course); courseMapper.insert(course); // 插入课程记录
} }
@Transactional(readOnly=false) /**
*
*
* @param course
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void update(CourseEntity course) { public void update(CourseEntity course) {
CourseEntity entity = courseMapper.selectById(course.getId()); CourseEntity entity = courseMapper.selectById(course.getId()); // 获取要更新的课程实体
entity.setName(course.getName());
entity.setSubjectId(course.getSubjectId()); entity.setName(course.getName()); // 更新课程名称
entity.setSort(course.getSort()); entity.setSubjectId(course.getSubjectId()); // 更新科目 ID
entity.setRemarks(course.getRemarks()); entity.setSort(course.getSort()); // 更新排序号
courseMapper.updateById(entity); entity.setRemarks(course.getRemarks()); // 更新备注
courseMapper.updateById(entity); // 更新课程记录
} }
@Transactional(readOnly=false) /**
*
*
* @param uid ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void delete(String uid) { public void delete(String uid) {
CourseEntity entity = courseMapper.selectById(uid); CourseEntity entity = courseMapper.selectById(uid); // 获取要删除的课程实体
entity.setStatus(CourseStatusEnum.DELETE);
courseMapper.updateById(entity); entity.setStatus(CourseStatusEnum.DELETE); // 设置课程状态为已删除
courseMapper.updateById(entity); // 更新课程记录
} }
@Transactional(readOnly=false) /**
*
*
* @param uid ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void enable(String uid) { public void enable(String uid) {
CourseEntity entity = courseMapper.selectById(uid); CourseEntity entity = courseMapper.selectById(uid); // 获取要启用的课程实体
entity.setStatus(CourseStatusEnum.NORMAL);
courseMapper.updateById(entity); entity.setStatus(CourseStatusEnum.NORMAL); // 设置课程状态为正常
courseMapper.updateById(entity); // 更新课程记录
} }
@Transactional(readOnly=false) /**
*
*
* @param uid ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void disabled(String uid) { public void disabled(String uid) {
CourseEntity entity = courseMapper.selectById(uid); CourseEntity entity = courseMapper.selectById(uid); // 获取要禁用的课程实体
entity.setStatus(CourseStatusEnum.DISABLED);
courseMapper.updateById(entity); entity.setStatus(CourseStatusEnum.DISABLED); // 设置课程状态为禁用
courseMapper.updateById(entity); // 更新课程记录
} }
@SuppressWarnings("unchecked") /**
* ZTree JSON
*
* @return ZTree JSON
*/
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public JSONArray treeData() { public JSONArray treeData() {
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.create().eq("status", SubjectStatusEnum.NORMAL.getValue())); List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.create().eq("status", SubjectStatusEnum.NORMAL.getValue())); // 查询正常状态的科目列表
List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("status", CourseStatusEnum.NORMAL.getValue())); List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("status", CourseStatusEnum.NORMAL.getValue())); // 查询正常状态的课程列表
return transform(subjectList, courseList);
return transform(subjectList, courseList); // 转换科目和课程数据为 JSON 数组
} }
private JSONArray transform(List<SubjectEntity> subjectList , List<CourseEntity> courseList) { /**
JSONArray entitys = new JSONArray(); * ZTree JSON
for(int i=0 ; i<subjectList.size() ; i++) { *
JSONObject entity = new JSONObject(); * @param subjectList
entity.put("id", subjectList.get(i).getId()); * @param courseList
entity.put("name", subjectList.get(i).getName()); * @return ZTree JSON
entity.put("pId", "0"); */
entitys.add(entity); private JSONArray transform(List<SubjectEntity> subjectList, List<CourseEntity> courseList) {
} JSONArray entitys = new JSONArray(); // 创建 JSON 数组对象
for(int i=0 ; i<courseList.size() ; i++) {
JSONObject entity = new JSONObject(); for (int i = 0; i < subjectList.size(); i++) {
entity.put("id", courseList.get(i).getId()); JSONObject entity = new JSONObject(); // 创建 JSON 对象
entity.put("name", courseList.get(i).getName());
entity.put("pId", courseList.get(i).getSubjectId()); SubjectEntity subject = subjectList.get(i); // 获取科目实体
entitys.add(entity); entity.put("id", subject.getId()); // 设置科目 ID
entity.put("name", subject.getName()); // 设置科目名称
entity.put("pId", "0"); // 设置父节点 ID 为 0
entitys.add(entity); // 将科目对象添加到 JSON 数组中
} }
return entitys;
}
for (int i = 0; i < courseList.size(); i++) {
JSONObject entity = new JSONObject(); // 创建 JSON 对象
CourseEntity course = courseList.get(i); // 获取课程实体
entity.put("id", course.getId()); // 设置课程 ID
entity.put("name", course.getName()); // 设置课程名称
entity.put("pId", course.getSubjectId()); // 设置父节点 ID 为课程所属科目 ID
} entitys.add(entity); // 将课程对象添加到 JSON 数组中
}
return entitys; // 返回转换后的 JSON 数组
}
}

@ -1,129 +1,192 @@
package com.tamguo.modules.tiku.service.impl; package com.tamguo.modules.tiku.service.impl;
import java.util.List; import java.util.List; // 导入 List 接口,用于存储科目、课程和知识点实体列表
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired; // 导入 Autowired 注解,用于依赖注入
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service; // 导入 Service 注解,标识为服务层实现类
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional; // 导入 Transactional 注解,用于事务管理
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray; // 导入 JSONArray 类,用于处理 JSON 数组
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject; // 导入 JSONObject 类,用于处理 JSON 对象
import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.mapper.Condition; // 导入 Condition 类,用于构建查询条件
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page; // 导入 Page 类,用于分页查询
import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; // 导入 ServiceImpl 类,作为服务层实现类的父类
import com.tamguo.modules.tiku.dao.KnowPointMapper; import com.tamguo.modules.tiku.dao.KnowPointMapper; // 导入 KnowPointMapper 接口,用于知识点的数据访问
import com.tamguo.modules.tiku.dao.CourseMapper; import com.tamguo.modules.tiku.dao.CourseMapper; // 导入 CourseMapper 接口,用于课程的数据访问
import com.tamguo.modules.tiku.dao.SubjectMapper; import com.tamguo.modules.tiku.dao.SubjectMapper; // 导入 SubjectMapper 接口,用于科目的数据访问
import com.tamguo.modules.tiku.model.KnowPointEntity; import com.tamguo.modules.tiku.model.KnowPointEntity; // 导入 KnowPointEntity 类,代表知识点实体
import com.tamguo.modules.tiku.model.CourseEntity; import com.tamguo.modules.tiku.model.CourseEntity; // 导入 CourseEntity 类,代表课程实体
import com.tamguo.modules.tiku.model.SubjectEntity; import com.tamguo.modules.tiku.model.SubjectEntity; // 导入 SubjectEntity 类,代表科目实体
import com.tamguo.modules.tiku.model.condition.BookCondition; import com.tamguo.modules.tiku.model.condition.BookCondition; // 导入 BookCondition 类,代表知识点查询条件
import com.tamguo.modules.tiku.model.enums.BookStatusEnum; import com.tamguo.modules.tiku.model.enums.BookStatusEnum; // 导入 BookStatusEnum 枚举,代表知识点状态
import com.tamguo.modules.tiku.model.enums.CourseStatusEnum; import com.tamguo.modules.tiku.model.enums.CourseStatusEnum; // 导入 CourseStatusEnum 枚举,代表课程状态
import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; // 导入 SubjectStatusEnum 枚举,代表科目状态
import com.tamguo.modules.tiku.service.IKnowPointService; import com.tamguo.modules.tiku.service.IKnowPointService; // 导入 IKnowPointService 接口,定义知识点服务的接口
@Service @Service // 标识为服务层实现类
public class KnowPointServiceImpl extends ServiceImpl<KnowPointMapper, KnowPointEntity> implements IKnowPointService{ public class KnowPointServiceImpl extends ServiceImpl<KnowPointMapper, KnowPointEntity> implements IKnowPointService {
@Autowired @Autowired // 自动注入 KnowPointMapper 实例
KnowPointMapper knowPointMapper; private KnowPointMapper knowPointMapper;
@Autowired
CourseMapper courseMapper; @Autowired // 自动注入 CourseMapper 实例
@Autowired private CourseMapper courseMapper;
SubjectMapper subjectMapper;
@Autowired // 自动注入 SubjectMapper 实例
@Transactional(readOnly=false) private SubjectMapper subjectMapper;
/**
*
*
* @param condition
* @return
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public Page<KnowPointEntity> listData(BookCondition condition) { public Page<KnowPointEntity> listData(BookCondition condition) {
Page<KnowPointEntity> page = new Page<>(condition.getPageNo() , condition.getPageSize()); Page<KnowPointEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize()); // 创建分页对象
return page.setRecords(knowPointMapper.listData(page, condition)); return page.setRecords(knowPointMapper.listData(page, condition)); // 执行查询并设置分页结果
} }
@Transactional(readOnly=false) /**
*
*
* @param book
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void save(KnowPointEntity book) { public void save(KnowPointEntity book) {
CourseEntity course = courseMapper.selectById(book.getCourseId()); CourseEntity course = courseMapper.selectById(book.getCourseId()); // 获取课程实体
book.setStatus(BookStatusEnum.NORMAL); book.setStatus(BookStatusEnum.NORMAL); // 设置知识点状态为正常
book.setSubjectId(course.getSubjectId()); book.setSubjectId(course.getSubjectId()); // 设置知识点所属科目 ID
knowPointMapper.insert(book); knowPointMapper.insert(book); // 插入知识点记录
} }
@Transactional(readOnly=false) /**
*
*
* @param book
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void update(KnowPointEntity book) { public void update(KnowPointEntity book) {
CourseEntity course = courseMapper.selectById(book.getCourseId()); CourseEntity course = courseMapper.selectById(book.getCourseId()); // 获取课程实体
KnowPointEntity entity = knowPointMapper.selectById(book.getId()); KnowPointEntity entity = knowPointMapper.selectById(book.getId()); // 获取要更新的知识点实体
entity.setName(book.getName()); entity.setName(book.getName()); // 更新知识点名称
entity.setPointNum(book.getPointNum()); entity.setPointNum(book.getPointNum()); // 更新知识点数量
entity.setQuestionNum(book.getQuestionNum()); entity.setQuestionNum(book.getQuestionNum()); // 更新问题数量
entity.setRemarks(book.getRemarks()); entity.setRemarks(book.getRemarks()); // 更新备注
entity.setPublishingHouse(book.getPublishingHouse()); entity.setPublishingHouse(book.getPublishingHouse()); // 更新出版社
entity.setSort(book.getSort()); entity.setSort(book.getSort()); // 更新排序号
entity.setCourseId(course.getId()); entity.setCourseId(course.getId()); // 更新课程 ID
knowPointMapper.updateById(entity); knowPointMapper.updateById(entity); // 更新知识点记录
} }
@Transactional(readOnly=false) /**
*
*
* @param id ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void delete(String id) { public void delete(String id) {
KnowPointEntity book = knowPointMapper.selectById(id); KnowPointEntity book = knowPointMapper.selectById(id); // 获取要删除的知识点实体
book.setStatus(BookStatusEnum.DELETE);
knowPointMapper.updateById(book); book.setStatus(BookStatusEnum.DELETE); // 设置知识点状态为已删除
knowPointMapper.updateById(book); // 更新知识点记录
} }
@Transactional(readOnly=false) /**
*
*
* @param id ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void enable(String id) { public void enable(String id) {
KnowPointEntity book = knowPointMapper.selectById(id); KnowPointEntity book = knowPointMapper.selectById(id); // 获取要启用的知识点实体
book.setStatus(BookStatusEnum.NORMAL);
knowPointMapper.updateById(book); book.setStatus(BookStatusEnum.NORMAL); // 设置知识点状态为正常
knowPointMapper.updateById(book); // 更新知识点记录
} }
@Transactional(readOnly=false) /**
*
*
* @param id ID
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@Override @Override
public void disabled(String id) { public void disabled(String id) {
KnowPointEntity book = knowPointMapper.selectById(id); KnowPointEntity book = knowPointMapper.selectById(id); // 获取要禁用的知识点实体
book.setStatus(BookStatusEnum.DISABLED);
knowPointMapper.updateById(book); book.setStatus(BookStatusEnum.DISABLED); // 设置知识点状态为禁用
knowPointMapper.updateById(book); // 更新知识点记录
} }
@Transactional(readOnly=false) /**
@SuppressWarnings("unchecked") * ZTree JSON
*
* @return ZTree JSON
*/
@Transactional(readOnly = false) // 开启事务,设置只读为 false
@SuppressWarnings("unchecked") // 抑制 unchecked 警告
@Override @Override
public JSONArray treeData() { public JSONArray treeData() {
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.create().eq("status", SubjectStatusEnum.NORMAL.getValue())); List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.create().eq("status", SubjectStatusEnum.NORMAL.getValue())); // 查询正常状态的科目列表
List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("status", CourseStatusEnum.NORMAL.getValue())); List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("status", CourseStatusEnum.NORMAL.getValue())); // 查询正常状态的课程列表
List<KnowPointEntity> bookList = knowPointMapper.selectList(Condition.create().eq("status", BookStatusEnum.NORMAL.getValue())); List<KnowPointEntity> bookList = knowPointMapper.selectList(Condition.create().eq("status", BookStatusEnum.NORMAL.getValue())); // 查询正常状态的知识点列表
return transform(subjectList, courseList , bookList);
return transform(subjectList, courseList, bookList); // 转换科目、课程和知识点数据为 JSON 数组
} }
private JSONArray transform(List<SubjectEntity> subjectList , List<CourseEntity> courseList , List<KnowPointEntity> bookList) { /**
JSONArray entitys = new JSONArray(); * ZTree JSON
for(int i=0 ; i<subjectList.size() ; i++) { *
JSONObject entity = new JSONObject(); * @param subjectList
entity.put("id", subjectList.get(i).getId()); * @param courseList
entity.put("name", subjectList.get(i).getName()); * @param bookList
entity.put("pId", "0"); * @return ZTree JSON
entitys.add(entity); */
private JSONArray transform(List<SubjectEntity> subjectList, List<CourseEntity> courseList, List<KnowPointEntity> bookList) {
JSONArray entitys = new JSONArray(); // 创建 JSON 数组对象
for (int i = 0; i < subjectList.size(); i++) {
JSONObject entity = new JSONObject(); // 创建 JSON 对象
SubjectEntity subject = subjectList.get(i); // 获取科目实体
entity.put("id", subject.getId()); // 设置科目 ID
entity.put("name", subject.getName()); // 设置科目名称
entity.put("pId", "0"); // 设置父节点 ID 为 0
entitys.add(entity); // 将科目对象添加到 JSON 数组中
} }
for(int i=0 ; i<courseList.size() ; i++) {
JSONObject entity = new JSONObject(); for (int i = 0; i < courseList.size(); i++) {
entity.put("id", courseList.get(i).getId()); JSONObject entity = new JSONObject(); // 创建 JSON 对象
entity.put("name", courseList.get(i).getName());
entity.put("pId", courseList.get(i).getSubjectId()); CourseEntity course = courseList.get(i); // 获取课程实体
entitys.add(entity); entity.put("id", course.getId()); // 设置课程 ID
entity.put("name", course.getName()); // 设置课程名称
entity.put("pId", course.getSubjectId()); // 设置父节点 ID 为课程所属科目 ID
entitys.add(entity); // 将课程对象添加到 JSON 数组中
} }
for(int i=0 ; i<bookList.size() ; i++) {
JSONObject entity = new JSONObject(); for (int i = 0; i < bookList.size(); i++) {
entity.put("id", bookList.get(i).getId()); JSONObject entity = new JSONObject(); // 创建 JSON 对象
entity.put("name", bookList.get(i).getName());
entity.put("pId", bookList.get(i).getCourseId()); KnowPointEntity book = bookList.get(i); // 获取知识点实体
entitys.add(entity); entity.put("id", book.getId()); // 设置知识点 ID
entity.put("name", book.getName()); // 设置知识点名称
entity.put("pId", book.getCourseId()); // 设置父节点 ID 为知识点所属课程 ID
entitys.add(entity); // 将知识点对象添加到 JSON 数组中
} }
return entitys;
return entitys; // 返回转换后的 JSON 数组
} }
} }

@ -2,6 +2,7 @@ package com.tamguo.modules.tiku.service.impl;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -13,100 +14,136 @@ import com.tamguo.modules.tiku.dao.MenuMapper;
import com.tamguo.modules.tiku.model.MenuEntity; import com.tamguo.modules.tiku.model.MenuEntity;
import com.tamguo.modules.tiku.service.IMenuService; import com.tamguo.modules.tiku.service.IMenuService;
/**
* MenuServiceImpl IMenuService
*/
@Service @Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuEntity> implements IMenuService{ public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuEntity> implements IMenuService {
/**
* MenuMapper
*/
@Autowired @Autowired
private MenuMapper menuMapper; private MenuMapper menuMapper;
/**
*
*/
@Autowired @Autowired
private CacheService cacheService; private CacheService cacheService;
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> findMenus() { public List<MenuEntity> findMenus() {
List<MenuEntity> menuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.INDEX_MENU)); List<MenuEntity> menuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.INDEX_MENU));
if (menuList == null) { if (menuList == null) {
menuList = menuMapper.selectList(Condition.create().eq("parent_id", 1).eq("is_show", 1).orderDesc(Arrays.asList("orders"))); menuList = menuMapper.selectList(Condition.create().eq("parent_id", 1).eq("is_show", 1).orderDesc(Arrays.asList("orders")));
for(MenuEntity menu : menuList){ for (MenuEntity menu : menuList) {
List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders"))); List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders")));
menu.setChildSubjects(childSubjects); menu.setChildSubjects(childSubjects);
} }
cacheService.setObject(SystemConstant.INDEX_MENU, menuList , 2 * 60 * 60); cacheService.setObject(SystemConstant.INDEX_MENU, menuList, 2 * 60 * 60);
} }
return menuList; return menuList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> findAllMenus() { public List<MenuEntity> findAllMenus() {
List<MenuEntity> allMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.ALL_INDEX_MENU)); List<MenuEntity> allMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.ALL_INDEX_MENU));
if(allMenuList == null){ if (allMenuList == null) {
allMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 1).orderDesc(Arrays.asList("orders"))); allMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 1).orderDesc(Arrays.asList("orders")));
for(MenuEntity menu : allMenuList){ for (MenuEntity menu : allMenuList) {
List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders"))); List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders")));
menu.setChildSubjects(childSubjects); menu.setChildSubjects(childSubjects);
} }
cacheService.setObject(SystemConstant.ALL_INDEX_MENU, allMenuList , 2 * 60 * 60); cacheService.setObject(SystemConstant.ALL_INDEX_MENU, allMenuList, 2 * 60 * 60);
} }
return allMenuList; return allMenuList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> findLeftMenus() { public List<MenuEntity> findLeftMenus() {
List<MenuEntity> leftMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.LEFT_INDEX_MENU)); List<MenuEntity> leftMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.LEFT_INDEX_MENU));
if(leftMenuList == null){ if (leftMenuList == null) {
leftMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 2).orderDesc(Arrays.asList("orders"))); leftMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 2).orderDesc(Arrays.asList("orders")));
for(MenuEntity menu : leftMenuList){ for (MenuEntity menu : leftMenuList) {
List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders"))); List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders")));
menu.setChildSubjects(childSubjects); menu.setChildSubjects(childSubjects);
} }
cacheService.setObject(SystemConstant.LEFT_INDEX_MENU, leftMenuList , 2 * 60 * 60); cacheService.setObject(SystemConstant.LEFT_INDEX_MENU, leftMenuList, 2 * 60 * 60);
} }
return leftMenuList; return leftMenuList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> findChapterMenus() { public List<MenuEntity> findChapterMenus() {
List<MenuEntity> chapterMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.CHAPTER_INDEX_MENU)); List<MenuEntity> chapterMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.CHAPTER_INDEX_MENU));
if(chapterMenuList == null){ if (chapterMenuList == null) {
chapterMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 4).orderAsc(Arrays.asList("orders"))); chapterMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 4).orderAsc(Arrays.asList("orders")));
for(MenuEntity menu : chapterMenuList){ for (MenuEntity menu : chapterMenuList) {
List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders"))); List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders")));
menu.setChildSubjects(childSubjects); menu.setChildSubjects(childSubjects);
} }
cacheService.setObject(SystemConstant.CHAPTER_INDEX_MENU, chapterMenuList , 2 * 60 * 60); cacheService.setObject(SystemConstant.CHAPTER_INDEX_MENU, chapterMenuList, 2 * 60 * 60);
} }
return chapterMenuList; return chapterMenuList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> findFooterMenus() { public List<MenuEntity> findFooterMenus() {
List<MenuEntity> footerMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.FOOTER_INDEX_MENU)); List<MenuEntity> footerMenuList = ((List<MenuEntity>) cacheService.getObject(SystemConstant.FOOTER_INDEX_MENU));
if(footerMenuList == null){ if (footerMenuList == null) {
footerMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 3).orderDesc(Arrays.asList("orders"))); footerMenuList = menuMapper.selectList(Condition.create().eq("parent_id", 3).orderDesc(Arrays.asList("orders")));
for(MenuEntity menu : footerMenuList){ for (MenuEntity menu : footerMenuList) {
List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders"))); List<MenuEntity> childSubjects = menuMapper.selectList(Condition.create().eq("parent_id", menu.getId()).orderDesc(Arrays.asList("orders")));
menu.setChildSubjects(childSubjects); menu.setChildSubjects(childSubjects);
} }
cacheService.setObject(SystemConstant.FOOTER_INDEX_MENU, footerMenuList , 2 * 60 * 60); cacheService.setObject(SystemConstant.FOOTER_INDEX_MENU, footerMenuList, 2 * 60 * 60);
} }
return footerMenuList; return footerMenuList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<MenuEntity> getMenuTree() { public List<MenuEntity> getMenuTree() {
return menuMapper.selectList(Condition.EMPTY); return menuMapper.selectList(Condition.EMPTY);
} }
/**
* ID
* @param uid ID
* @return
*/
@Override @Override
public MenuEntity findById(String uid) { public MenuEntity findById(String uid) {
return menuMapper.selectById(uid); return menuMapper.selectById(uid);
} }
}
}

@ -27,84 +27,134 @@ import com.tamguo.modules.tiku.service.ICourseService;
import com.tamguo.modules.tiku.service.IPaperService; import com.tamguo.modules.tiku.service.IPaperService;
import com.tamguo.modules.tiku.service.ISubjectService; import com.tamguo.modules.tiku.service.ISubjectService;
/**
* PaperServiceImpl IPaperService
*/
@Service @Service
public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> implements IPaperService{ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> implements IPaperService {
/**
* ISubjectService
*/
@Autowired @Autowired
private ISubjectService iSubjectService; private ISubjectService iSubjectService;
/**
* ICourseService
*/
@Autowired @Autowired
private ICourseService iCourseService; private ICourseService iCourseService;
/**
* ISysAreaService
*/
@Autowired @Autowired
private ISysAreaService iSysAreaService; private ISysAreaService iSysAreaService;
/**
* PaperMapper
*/
@Autowired @Autowired
private PaperMapper paperMapper; private PaperMapper paperMapper;
/**
* CacheService
*/
@Autowired @Autowired
private CacheService cacheService; private CacheService cacheService;
/**
* QuestionMapper
*/
@Autowired @Autowired
private QuestionMapper questionMapper; private QuestionMapper questionMapper;
/**
* QuestionOptionsMapper
*/
@Autowired @Autowired
private QuestionOptionsMapper questionOptionsMapper; private QuestionOptionsMapper questionOptionsMapper;
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<PaperEntity> findHistoryPaper() { public List<PaperEntity> findHistoryPaper() {
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HISTORY_PAPER); List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HISTORY_PAPER);
if(paperList == null){ if (paperList == null) {
Page<PaperEntity> page = new Page<>(1 , 6); Page<PaperEntity> page = new Page<>(1, 6);
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.ZHENGTI_PAPER_ID).orderDesc(Arrays.asList("id"))); paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.ZHENGTI_PAPER_ID).orderDesc(Arrays.asList("id")));
for(int i=0 ; i<paperList.size() ; i++) { for (int i = 0; i < paperList.size(); i++) {
PaperEntity paper = paperList.get(i); PaperEntity paper = paperList.get(i);
paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName()); paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName());
paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName()); paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName());
paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName()); paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName());
} }
cacheService.setObject(SystemConstant.HISTORY_PAPER, paperList , 2 * 60 * 60); cacheService.setObject(SystemConstant.HISTORY_PAPER, paperList, 2 * 60 * 60);
} }
return paperList; return paperList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<PaperEntity> findSimulationPaper() { public List<PaperEntity> findSimulationPaper() {
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.SIMULATION_PAPER); List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.SIMULATION_PAPER);
if(paperList == null){ if (paperList == null) {
Page<PaperEntity> page = new Page<>(1 , 6); Page<PaperEntity> page = new Page<>(1, 6);
paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.MONI_PAPER_ID).orderDesc(Arrays.asList("id"))); paperList = paperMapper.selectPage(page, Condition.create().eq("type", SystemConstant.MONI_PAPER_ID).orderDesc(Arrays.asList("id")));
for(int i=0 ; i<paperList.size() ; i++) { for (int i = 0; i < paperList.size(); i++) {
PaperEntity paper = paperList.get(i); PaperEntity paper = paperList.get(i);
paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName()); paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName());
paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName()); paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName());
paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName()); paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName());
} }
cacheService.setObject(SystemConstant.SIMULATION_PAPER, paperList , 2 * 60 * 60); cacheService.setObject(SystemConstant.SIMULATION_PAPER, paperList, 2 * 60 * 60);
} }
return paperList; return paperList;
} }
/**
*
* @param areaId ID
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<PaperEntity> findHotPaper(String areaId) { public List<PaperEntity> findHotPaper(String areaId) {
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HOT_PAPER); List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(SystemConstant.HOT_PAPER);
if(paperList == null){ if (paperList == null) {
Page<PaperEntity> page = new Page<>(1 , 10); Page<PaperEntity> page = new Page<>(1, 10);
paperList = paperMapper.selectPage(page, Condition.create().orderDesc(Arrays.asList("id"))); paperList = paperMapper.selectPage(page, Condition.create().orderDesc(Arrays.asList("id")));
for(int i=0 ; i<paperList.size() ; i++) { for (int i = 0; i < paperList.size(); i++) {
PaperEntity paper = paperList.get(i); PaperEntity paper = paperList.get(i);
paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName()); paper.setSubjectName(iSubjectService.selectById(paper.getSubjectId()).getName());
paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName()); paper.setCourseName(iCourseService.selectById(paper.getCourseId()).getName());
paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName()); paper.setAreaName(iSysAreaService.selectById(paper.getAreaId()).getAreaName());
} }
cacheService.setObject(SystemConstant.HOT_PAPER, paperList , 2 * 60 * 60); cacheService.setObject(SystemConstant.HOT_PAPER, paperList, 2 * 60 * 60);
} }
return paperList; return paperList;
} }
@Transactional(readOnly=false) /**
*
* @param paperId ID
* @param title
* @param name
* @param type
*/
@Transactional(readOnly = false)
@Override @Override
public void addPaperQuestionInfo(String paperId, String title, String name, String type) { public void addPaperQuestionInfo(String paperId, String title, String name, String type) {
PaperEntity paper = paperMapper.selectById(paperId); PaperEntity paper = paperMapper.selectById(paperId);
String questionInfo = paper.getQuestionInfo(); String questionInfo = paper.getQuestionInfo();
JSONArray qList = JSONArray.parseArray(questionInfo); JSONArray qList = JSONArray.parseArray(questionInfo);
JSONObject entity = new JSONObject(); JSONObject entity = new JSONObject();
entity.put("name", name); entity.put("name", name);
@ -112,53 +162,74 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
entity.put("type", type); entity.put("type", type);
entity.put("id", UUID.randomUUID().toString()); entity.put("id", UUID.randomUUID().toString());
qList.add(entity); qList.add(entity);
paper.setQuestionInfo(qList.toString()); paper.setQuestionInfo(qList.toString());
paperMapper.updateById(paper); paperMapper.updateById(paper);
} }
@Transactional(readOnly=false) /**
*
* @param paperId ID
* @param title
* @param name
* @param type
* @param uid ID
*/
@Transactional(readOnly = false)
@Override @Override
public void updatePaperQuestionInfo(String paperId, String title, String name, String type, String uid) { public void updatePaperQuestionInfo(String paperId, String title, String name, String type, String uid) {
PaperEntity paper = paperMapper.selectById(paperId); PaperEntity paper = paperMapper.selectById(paperId);
JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo()); JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo());
for(int i =0 ; i<qList.size() ; i++){ for (int i = 0; i < qList.size(); i++) {
JSONObject q = qList.getJSONObject(i); JSONObject q = qList.getJSONObject(i);
if(q.getString("id").equals(uid)){ if (q.getString("id").equals(uid)) {
q.put("name", name); q.put("name", name);
q.put("title", title); q.put("title", title);
q.put("type", type); q.put("type", type);
} }
} }
paper.setQuestionInfo(qList.toString()); paper.setQuestionInfo(qList.toString());
paperMapper.updateById(paper); paperMapper.updateById(paper);
} }
/**
*
* @param currMemberId ID
* @param paperId ID
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Result deletePaper(String currMemberId , String paperId) { public Result deletePaper(String CurrMemberId, String paperId) {
PaperEntity paper = paperMapper.selectById(paperId); PaperEntity paper = paperMapper.selectById(paperId);
if(!currMemberId.equals(paper.getCreaterId())) { if (!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null , "不能删除其他人的试卷!"); return Result.result(501, null, "不能删除其他人的试卷!");
} }
paperMapper.deleteById(paperId); paperMapper.deleteById(paperId);
// 删除试题 // 删除试题
questionMapper.delete(Condition.create().eq("paper_id", paperId)); questionMapper.delete(Condition.create().eq("paper_id", paperId));
return Result.result(Result.SUCCESS_CODE, null , "删除成功!"); return Result.result(Result.SUCCESS_CODE, null, "删除成功!");
} }
@Transactional(readOnly=false) /**
*
* @param CurrMemberId ID
* @param paperId ID
* @param cuid ID
* @return
*/
@Transactional(readOnly = false)
@Override @Override
public Result deletePaperQuestionInfoBtn(String currMemberId , String paperId, String cuid) { public Result deletePaperQuestionInfoBtn(String CurrMemberId, String paperId, String cuid) {
PaperEntity paper = paperMapper.selectById(paperId); PaperEntity paper = paperMapper.selectById(paperId);
if(!paper.getCreaterId().equals(currMemberId)) { if (!paper.getCreaterId().equals(currMemberId)) {
return Result.failResult("试卷属于当前用户,不能修改!"); return Result.failResult("试卷属于当前用户,不能修改!");
} }
JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo()); JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo());
for(int i =0 ; i<qList.size() ; i++){ for (int i = 0; i < qList.size(); i++) {
JSONObject q = qList.getJSONObject(i); JSONObject q = qList.getJSONObject(i);
if(q.getString("uid").equals(cuid)){ if (q.getString("uid").equals(cuid)) {
qList.remove(i); qList.remove(i);
} }
} }
@ -167,24 +238,34 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
return Result.result(Result.SUCCESS_CODE, null, "删除子卷成功"); return Result.result(Result.SUCCESS_CODE, null, "删除子卷成功");
} }
@Transactional(readOnly=false) /**
*
* @param paper
*/
@Transactional(readOnly = false)
@Override @Override
public void addPaper(PaperEntity paper) { public void addPaper(PaperEntity paper) {
paper.setDownHits(0); paper.setDownHits(0);
paper.setOpenHits(0); paper.setOpenHits(0);
paper.setQuestionInfo("[]"); paper.setQuestionInfo("[]");
// 写入seo信息 // 写入 seo 信息
paper.setSeoTitle(paper.getName()); paper.setSeoTitle(paper.getName());
paper.setSeoKeywords(paper.getName()); paper.setSeoKeywords(paper.getName());
paper.setSeoDescription(paper.getName()); paper.setSeoDescription(paper.getName());
paperMapper.insert(paper); paperMapper.insert(paper);
} }
/**
*
* @param paper
* @param currMemberId ID
* @return
*/
@Override @Override
public Result updatePaper(PaperEntity paper ,String currMemberId) { public Result updatePaper(PaperEntity paper, String CurrMemberId) {
PaperEntity entity = paperMapper.selectById(paper.getId()); PaperEntity entity = paperMapper.selectById(paper.getId());
if(!entity.getCreaterId().equals(currMemberId)) { if (!entity.getCreaterId().equals(currMemberId)) {
return Result.failResult("试卷属于当前用户,不能修改!"); return Result.failResult("试卷属于当前用户,不能修改!");
} }
paper.setCreaterId(currMemberId); paper.setCreaterId(currMemberId);
@ -192,15 +273,19 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
return Result.result(Result.SUCCESS_CODE, paper, "修改成功"); return Result.result(Result.SUCCESS_CODE, paper, "修改成功");
} }
/**
*
* @param paperId ID
* @return
*/
@Override @Override
public List<QuestionEntity> findQuestionList(String paperId) { public List<QuestionEntity> findQuestionList(String paperId) {
// 查询选项信息 // 查询选项信息
List<QuestionEntity> questionList = questionMapper.selectList(Condition.create().eq("paper_id", paperId)); List<QuestionEntity> questionList = questionMapper.selectList(Condition.create().eq("paper_id", paperId));
questionList.forEach(question -> { questionList.forEach(question -> {
List<QuestionOptionsEntity> questionOptions = questionOptionsMapper.selectList(Condition.create().eq("question_id" , question.getId())); List<QuestionOptionsEntity> questionOptions = questionOptionsMapper.selectList(Condition.create().eq("question_id", question.getId()));
question.setQuestionOptions(questionOptions); question.setQuestionOptions(questionOptions);
}); });
return questionList; return questionList;
} }
}
}

@ -15,67 +15,136 @@ import com.tamguo.modules.tiku.model.PaperEntity;
import com.tamguo.modules.tiku.model.QuestionEntity; import com.tamguo.modules.tiku.model.QuestionEntity;
import com.tamguo.modules.tiku.service.IQuestionService; import com.tamguo.modules.tiku.service.IQuestionService;
// 标识这是一个Spring的服务层组件类用于实现IQuestionService接口中定义的与题目Question相关的业务逻辑方法
// 它继承自ServicePlus框架提供的ServiceImpl类借助其提供的通用数据库操作能力结合自身的业务逻辑实现对题目数据的添加、查询、更新和删除等操作并且通过依赖注入获取相关的Mapper对象来与数据库进行交互。
@Service @Service
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEntity> implements IQuestionService{ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEntity> implements IQuestionService {
// 自动注入PaperMapper用于操作试卷Paper相关的数据比如通过试卷ID查询试卷信息等操作在题目相关业务逻辑中可能需要获取试卷的创建者等信息来进行权限判断等操作依赖该Mapper与数据库的试卷表进行交互。
@Autowired @Autowired
private PaperMapper paperMapper; private PaperMapper paperMapper;
// 自动注入QuestionMapper用于操作题目Question相关的数据比如插入题目、根据条件查询题目、更新题目以及删除题目等数据库操作是实现题目业务逻辑中与数据库进行交互的核心依赖对象直接对应数据库中的题目表。
@Autowired @Autowired
private QuestionMapper questionMapper; private QuestionMapper questionMapper;
/**
*
* ID
* ID
*
* @param question ID
* @param currMemberId IDID
* @return Result0501
*/
@Override @Override
public Result addQuestion(QuestionEntity question , String currMemberId) { public Result addQuestion(QuestionEntity question, String currMemberId) {
// 根据题目实体对象中携带的试卷ID通过PaperMapper从数据库中查询对应的试卷实体信息用于后续判断当前用户对该试卷是否有操作权限即是否为试卷创建者
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString()); PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) { // 判断当前登录会员的ID与查询到的试卷创建者的ID是否相等如果不相等表示当前用户无权操作该试卷下的题目返回包含相应错误提示信息和状态码501的Result对象给调用者。
if (!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!"); return Result.result(501, null, "改试卷不属于您!");
} }
// 如果当前用户有权限添加题目将从试卷实体对象中获取的课程ID设置到题目实体对象中保证题目与试卷在课程维度上的关联关系正确便于后续按课程等维度进行题目相关的查询、统计等业务操作。
question.setCourseId(paper.getCourseId()); question.setCourseId(paper.getCourseId());
// 通过QuestionMapper将题目实体对象插入到数据库的题目表中完成题目添加的数据库操作若插入成功则数据库中会新增一条对应的题目记录。
questionMapper.insert(question); questionMapper.insert(question);
// 返回包含添加成功提示信息和状态码0表示成功的Result对象给调用者告知题目添加操作已成功完成。
return Result.result(0, null, "添加成功!"); return Result.result(0, null, "添加成功!");
} }
/**
*
* IDIDID
* IDID
* MyBatis Plus
*
* @param questionType
* @param id IDIDID便ID
* @param content LIKE
* @param paperId IDIDIDID
* @param currMemberId IDID访
* @param p 便
* @return Page<QuestionEntity>p.setRecords(null)
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Page<QuestionEntity> queryQuestionList(String questionType, String id, String content, String paperId, String currMemberId , public Page<QuestionEntity> queryQuestionList(String questionType, String id, String content, String paperId, String currMemberId,
Page<QuestionEntity> p) { Page<QuestionEntity> p) {
if(!currMemberId.equals(paperMapper.selectById(paperId).getCreaterId())) { // 根据传入的试卷ID从数据库中查询对应的试卷实体信息然后判断当前登录会员的ID与查询到的试卷创建者的ID是否相等如果不相等表示当前用户无权查询该试卷下的题目直接返回传入的分页对象并将其记录列表设置为空表示无权获取题目数据。
if (!currMemberId.equals(paperMapper.selectById(paperId).getCreaterId())) {
return p.setRecords(null); return p.setRecords(null);
} }
// 创建一个MyBatis Plus的查询条件对象用于构建后续查询题目时的各种条件通过该对象可以方便地添加等于、大于、小于、模糊匹配等各种条件来精确筛选题目数据符合MyBatis Plus的条件查询规范。
Condition condition = new Condition(); Condition condition = new Condition();
if(!StringUtils.isEmpty(questionType)) { // 判断题目类型是否不为空字符串如果不为空则添加一个等于eq条件到查询条件对象中使得查询时只会获取指定题目类型的题目与数据库题目表中的题目类型字段进行精确匹配查询。
if (!StringUtils.isEmpty(questionType)) {
condition.eq("question_type", questionType); condition.eq("question_type", questionType);
} }
if(!StringUtils.isEmpty(id)) { // 判断题目ID是否不为空字符串如果不为空则添加一个等于eq条件到查询条件对象中使得查询时只会获取指定ID的题目与数据库题目表中的题目ID字段进行精确匹配查询用于精确查找特定题目。
if (!StringUtils.isEmpty(id)) {
condition.eq("id", id); condition.eq("id", id);
} }
if(!StringUtils.isEmpty(content)) { // 判断题目内容是否不为空字符串如果不为空则添加一个模糊匹配like条件到查询条件对象中使得查询时会获取题目内容包含指定关键字的题目通过数据库的模糊查询LIKE操作符与题目表中的题目内容字段进行匹配查询用于根据部分内容查找相关题目。
if (!StringUtils.isEmpty(content)) {
condition.like("content", content); condition.like("content", content);
} }
// 添加一个等于eq条件到查询条件对象中指定要查询的题目所属的试卷ID与数据库题目表中的所属试卷ID字段进行精确匹配查询确保获取的题目都是属于指定试卷的。
condition.eq("paper_id", paperId); condition.eq("paper_id", paperId);
// 通过QuestionMapper结合分页对象和构建好的查询条件对象进行分页查询从数据库中获取符合条件的题目列表数据并将查询结果设置到传入的分页对象的记录列表中最后返回该分页对象供前端进行分页展示等操作。
return p.setRecords(questionMapper.selectPage(p, condition)); return p.setRecords(questionMapper.selectPage(p, condition));
} }
@Transactional(readOnly=false) /**
*
* ID
* QuestionMapperID
* 使
*
* @param question ID
* @param currMemberId IDID
* @return Result0501
*/
@Transactional(readOnly = false)
@Override @Override
public Result updateQuestion(QuestionEntity question , String currMemberId) { public Result updateQuestion(QuestionEntity question, String currMemberId) {
// 根据题目实体对象中携带的试卷ID通过PaperMapper从数据库中查询对应的试卷实体信息用于后续判断当前用户对该试卷是否有操作权限即是否为试卷创建者
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString()); PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) { // 判断当前登录会员的ID与查询到的试卷创建者的ID是否相等如果不相等表示当前用户无权操作该试卷下的题目返回包含相应错误提示信息和状态码501的Result对象给调用者。
if (!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!"); return Result.result(501, null, "改试卷不属于您!");
} }
// 如果当前用户有权限更新题目通过QuestionMapper根据题目实体对象的ID更新数据库中对应的题目记录将传入的题目实体对象中的属性值覆盖原有记录中的相应属性值完成题目信息的更新操作。
questionMapper.updateById(question); questionMapper.updateById(question);
// 返回包含更新成功提示信息和状态码0表示成功的Result对象给调用者告知题目更新操作已成功完成。
return Result.result(0, null, "修改成功!"); return Result.result(0, null, "修改成功!");
} }
@Transactional(readOnly=false) /**
*
* IDID
* QuestionMapperID
* 使
*
* @param uid IDID
* @param currMemberId IDID
* @return Result0501
*/
@Transactional(readOnly = false)
@Override @Override
public Result delete(String uid , String currMemberId) { public Result delete(String uid, String currMemberId) {
// 根据传入的题目ID通过QuestionMapper从数据库中查询对应的题目实体信息用于获取该题目所属试卷的ID以便后续判断当前用户对该试卷是否有操作权限即是否为试卷创建者
QuestionEntity question = questionMapper.selectById(uid); QuestionEntity question = questionMapper.selectById(uid);
// 根据题目所属试卷的ID通过PaperMapper从数据库中查询对应的试卷实体信息用于后续判断当前用户对该试卷是否有操作权限即是否为试卷创建者
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString()); PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) { // 判断当前登录会员的ID与查询到的试卷创建者的ID是否相等如果不相等表示当前用户无权操作该试卷下的题目返回包含相应错误提示信息和状态码501的Result对象给调用者。
if (!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!"); return Result.result(501, null, "改试卷不属于您!");
} }
// 如果当前用户有权限删除题目通过QuestionMapper根据题目ID删除数据库中对应的题目记录完成题目删除的数据库操作从数据库表中移除该题目对应的行数据。
questionMapper.deleteById(uid); questionMapper.deleteById(uid);
// 返回包含删除成功提示信息和状态码0表示成功的Result对象给调用者告知题目删除操作已成功完成。
return Result.result(0, null, "删除成功!"); return Result.result(0, null, "删除成功!");
} }
} }

@ -19,51 +19,78 @@ import com.tamguo.modules.tiku.model.PaperEntity;
import com.tamguo.modules.tiku.model.SchoolEntity; import com.tamguo.modules.tiku.model.SchoolEntity;
import com.tamguo.modules.tiku.service.ISchoolService; import com.tamguo.modules.tiku.service.ISchoolService;
/**
* SchoolServiceImpl ISchoolService
*/
@Service @Service
public class SchoolService extends ServiceImpl<SchoolMapper, SchoolEntity> implements ISchoolService { public class SchoolServiceImpl extends ServiceImpl<SchoolMapper, SchoolEntity> implements ISchoolService {
/**
* SchoolMapper
*/
@Autowired @Autowired
private SchoolMapper schoolMapper; private SchoolMapper schoolMapper;
/**
* PaperMapper
*/
@Autowired @Autowired
private PaperMapper paperMapper; private PaperMapper paperMapper;
/**
* CacheService
*/
@Autowired @Autowired
private CacheService cacheService; private CacheService cacheService;
/**
*
* @param shcoolId ID
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<SchoolEntity> findEliteSchoolPaper(String shcoolId) { public List<SchoolEntity> findEliteSchoolPaper(String shcoolId) {
List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(SystemConstant.ELITE_SCHOOL_PAPER); List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(SystemConstant.ELITE_SCHOOL_PAPER);
// 获取名校试卷 // 获取名校试卷
if(schoolList == null){ if (schoolList == null) {
Page<SchoolEntity> page = new Page<>(1 , 3); Page<SchoolEntity> page = new Page<>(1, 3);
schoolList = schoolMapper.selectPage(page, Condition.create().eq("id", shcoolId)); schoolList = schoolMapper.selectPage(page, Condition.create().eq("id", shcoolId));
for(SchoolEntity school : schoolList){ for (SchoolEntity school : schoolList) {
Page<PaperEntity> p = new Page<>(1 , 3); Page<PaperEntity> p = new Page<>(1, 3);
List<PaperEntity> paperList = paperMapper.selectPage(p, Condition.create().eq("school_id", school.getId())); List<PaperEntity> paperList = paperMapper.selectPage(p, Condition.create().eq("school_id", school.getId()));
school.setPaperList(paperList); school.setPaperList(paperList);
} }
cacheService.setObject(SystemConstant.ELITE_SCHOOL_PAPER, schoolList , 2 * 60 * 60); cacheService.setObject(SystemConstant.ELITE_SCHOOL_PAPER, schoolList, 2 * 60 * 60);
} }
return schoolList; return schoolList;
} }
/**
*
* @return
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<SchoolEntity> findEliteSchool() { public List<SchoolEntity> findEliteSchool() {
List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(SystemConstant.ELITE_PAPER); List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(SystemConstant.ELITE_PAPER);
if(schoolList == null){ if (schoolList == null) {
RowBounds row = new RowBounds(1 , 6); RowBounds row = new RowBounds(1, 6);
schoolList = schoolMapper.selectPage(row, Condition.EMPTY); schoolList = schoolMapper.selectPage(row, Condition.EMPTY);
cacheService.setObject(SystemConstant.ELITE_PAPER, schoolList , 2 * 60 * 60); cacheService.setObject(SystemConstant.ELITE_PAPER, schoolList, 2 * 60 * 60);
} }
return schoolList; return schoolList;
} }
@Transactional(readOnly=true) /**
* ID
* @param areaId ID
* @return
*/
@Transactional(readOnly = true)
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<SchoolEntity> findSchoolByAreaId(String areaId) { public List<SchoolEntity> findSchoolByAreaId(String areaId) {
return schoolMapper.selectList(Condition.create().in("area_id", Arrays.asList(areaId.split(",")))); return schoolMapper.selectList(Condition.create().in("area_id", Arrays.asList(areaId.split(","))));
} }
}
}

@ -19,39 +19,62 @@ import com.tamguo.modules.tiku.model.condition.SubjectCondition;
import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum; import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum;
import com.tamguo.modules.tiku.service.ISubjectService; import com.tamguo.modules.tiku.service.ISubjectService;
/**
* SubjectServiceImpl ISubjectService
*/
@Service @Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity> implements ISubjectService{ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity> implements ISubjectService {
/**
* SubjectMapper
*/
@Autowired @Autowired
private SubjectMapper subjectMapper; private SubjectMapper subjectMapper;
/**
* CourseMapper
*/
@Autowired @Autowired
private CourseMapper courseMapper; private CourseMapper courseMapper;
@Transactional(readOnly=false) /**
*
* @param condition
* @return
*/
@Transactional(readOnly = false)
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Page<SubjectEntity> listData(SubjectCondition condition) { public Page<SubjectEntity> listData(SubjectCondition condition) {
Page<SubjectEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize()); Page<SubjectEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize());
Condition query = Condition.create(); Condition query = Condition.create();
if(!StringUtils.isEmpty(condition.getUid())) { if (!StringUtils.isEmpty(condition.getUid())) {
query.eq("uid", condition.getUid()); query.eq("uid", condition.getUid());
}else if(!StringUtils.isEmpty(condition.getName())) { } else if (!StringUtils.isEmpty(condition.getName())) {
query.eq("name", condition.getName()); query.eq("name", condition.getName());
}else if(!StringUtils.isEmpty(condition.getStatus())) { } else if (!StringUtils.isEmpty(condition.getStatus())) {
query.eq("status", condition.getStatus()); query.eq("status", condition.getStatus());
} }
query.ne("status", SubjectStatusEnum.DELETE.getValue()); query.ne("status", SubjectStatusEnum.DELETE.getValue());
return page.setRecords(subjectMapper.selectPage(page, query)); return page.setRecords(subjectMapper.selectPage(page, query));
} }
@Transactional(readOnly=false) /**
*
* @param subject
*/
@Transactional(readOnly = false)
@Override @Override
public void save(SubjectEntity subject) { public void save(SubjectEntity subject) {
subject.setStatus(SubjectStatusEnum.NORMAL); subject.setStatus(SubjectStatusEnum.NORMAL);
subjectMapper.insert(subject); subjectMapper.insert(subject);
} }
@Transactional(readOnly=false) /**
*
* @param subject
*/
@Transactional(readOnly = false)
@Override @Override
public void update(SubjectEntity subject) { public void update(SubjectEntity subject) {
SubjectEntity entity = subjectMapper.selectById(subject.getId()); SubjectEntity entity = subjectMapper.selectById(subject.getId());
@ -64,7 +87,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
subjectMapper.updateById(entity); subjectMapper.updateById(entity);
} }
@Transactional(readOnly=false) /**
*
* @param uid
*/
@Transactional(readOnly = false)
@Override @Override
public void enable(String uid) { public void enable(String uid) {
SubjectEntity entity = subjectMapper.selectById(uid); SubjectEntity entity = subjectMapper.selectById(uid);
@ -72,7 +99,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
subjectMapper.updateById(entity); subjectMapper.updateById(entity);
} }
@Transactional(readOnly=false) /**
*
* @param uid
*/
@Transactional(readOnly = false)
@Override @Override
public void disabled(String uid) { public void disabled(String uid) {
SubjectEntity entity = subjectMapper.selectById(uid); SubjectEntity entity = subjectMapper.selectById(uid);
@ -80,7 +111,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
subjectMapper.updateById(entity); subjectMapper.updateById(entity);
} }
@Transactional(readOnly=false) /**
*
* @param uid
*/
@Transactional(readOnly = false)
@Override @Override
public void delete(String uid) { public void delete(String uid) {
SubjectEntity entity = subjectMapper.selectById(uid); SubjectEntity entity = subjectMapper.selectById(uid);
@ -88,22 +123,26 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
subjectMapper.updateById(entity); subjectMapper.updateById(entity);
} }
/**
*
* @return JSON
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public JSONArray getCourseCascaderTree() { public JSONArray getCourseCascaderTree() {
JSONArray courseTree = new JSONArray(); JSONArray courseTree = new JSONArray();
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY); List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY);
for(int i=0 ; i<subjectList.size() ; i++){ for (int i = 0; i < subjectList.size(); i++) {
SubjectEntity subject = subjectList.get(i); SubjectEntity subject = subjectList.get(i);
JSONObject node = new JSONObject(); JSONObject node = new JSONObject();
node.put("value", subject.getId()); node.put("value", subject.getId());
node.put("label", subject.getName()); node.put("label", subject.getName());
JSONArray children = new JSONArray(); JSONArray children = new JSONArray();
List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("subject_id", subject.getId())); List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("subject_id", subject.getId()));
for(int k=0 ; k<courseList.size() ; k++){ for (int k = 0; k < courseList.size(); k++) {
CourseEntity course = courseList.get(k); CourseEntity course = courseList.get(k);
JSONObject no = new JSONObject(); JSONObject no = new JSONObject();
no.put("value", course.getId()); no.put("value", course.getId());
no.put("label", course.getName()); no.put("label", course.getName());
@ -115,13 +154,17 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
return courseTree; return courseTree;
} }
@Transactional(readOnly=true) /**
*
* @return JSON
*/
@Transactional(readOnly = true)
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public JSONArray getSubjectTree() { public JSONArray getSubjectTree() {
JSONArray courseTree = new JSONArray(); JSONArray courseTree = new JSONArray();
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY); List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY);
for(int i=0 ; i<subjectList.size() ; i++){ for (int i = 0; i < subjectList.size(); i++) {
SubjectEntity subject = subjectList.get(i); SubjectEntity subject = subjectList.get(i);
JSONObject node = new JSONObject(); JSONObject node = new JSONObject();
node.put("value", subject.getId()); node.put("value", subject.getId());
@ -130,5 +173,4 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
} }
return courseTree; return courseTree;
} }
}
}
Loading…
Cancel
Save