From ba766029c626c2137b07178f578f4b7da990c7fa Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Tue, 30 Apr 2024 08:50:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A1=88=E4=BE=8B=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E4=BF=A1=E6=81=AF=E4=BC=A0=E5=8F=82=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stu/ExerciseExperimentalTraining.java | 14 +- .../controller/tea/TeaCaseController.java | 19 ++ .../tea/TeaResourceCenterController.java | 17 +- .../entity/SysCaseQuestion.java | 46 +++-- .../entity/SysCaseQuestionExample.java | 182 ++++++++++++------ .../entity/TeaResourceCenter.java | 11 ++ .../entity/TeaResourceCenterExample.java | 70 +++++++ .../mapper/SysCaseQuestionMapper.java | 6 + .../tea/ITeaResourceCenterService.java | 4 +- .../tea/impl/TeaObjectiveServiceImpl.java | 10 +- .../impl/TeaResourceCenterServiceImpl.java | 13 +- .../mapper/SysCaseQuestionMapper.xml | 140 +++++++++++--- .../mapper/TeaResourceCenterMapper.xml | 33 +++- 13 files changed, 452 insertions(+), 113 deletions(-) diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java index 7a8ee73..fc55b1e 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/ExerciseExperimentalTraining.java @@ -68,9 +68,19 @@ public class ExerciseExperimentalTraining { @GetMapping("getCaseStepInfo") @ApiOperation("获取案例题步骤基础信息") @AnonymousAccess - public ResultEntity> getCaseStepInfo(@RequestParam String caseId) { + public ResultEntity> getCaseStepInfo(@RequestParam String chapterId) { + //根据chapterId查询所有的caseid + SysCaseQuestionExample questionExample = new SysCaseQuestionExample(); + questionExample.createCriteria().andChapterIdEqualTo(chapterId); + List sysCaseQuestions = caseQuestionMapper.selectByExample(questionExample); + List caseIds=new ArrayList<>(); + for (int i = 0; i < sysCaseQuestions.size(); i++) { + String caseId = sysCaseQuestions.get(i).getCaseId(); + caseIds.add(caseId); + } SysCaseQuestionStepExample example = new SysCaseQuestionStepExample(); - example.createCriteria().andCaseIdEqualTo(caseId); + example.createCriteria().andCaseIdIn(caseIds); + example.setOrderByClause("sort ASC"); List stepList = caseQuestionStepMapper.selectByExample(example); for (int i = 0; i < stepList.size(); i++) { stepList.get(0).setAnswer(""); diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java index 43d767d..e33bdb7 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaCaseController.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; @@ -142,6 +143,24 @@ public class TeaCaseController { return new ResultEntity<>(HttpStatus.OK, "案例题库选择案例题内容展示成功",list); } +// //案例题库所有信息展示 +// @GetMapping("selectAllCaseBySchoolId") +// @ApiOperation("案例题库选择案例题内容展示") +// @AnonymousAccess +// public ResultEntity> selectAllCaseBySchoolId(@RequestParam String schoolId){ +// SysCaseQuestionExample example = new SysCaseQuestionExample(); +// if(Constant.BUILT_IN_SCHOOL_ID.equals(schoolId)){ +// example.createCriteria().andSchoolIdEqualTo(schoolId); +// }else { +// ArrayList schoolIds = new ArrayList<>(); +// schoolIds.add(schoolId); +// schoolIds.add(Constant.BUILT_IN_SCHOOL_ID); +// example.createCriteria().andSchoolIdIn(schoolIds); +// } +// List sysCaseQuestions = questionMapper.selectByExample(example); +// return new ResultEntity<>(HttpStatus.OK, "新增考试案例题预览展示成功",sysCaseQuestions); +// } + //新增考试案例题预览 @GetMapping("selectCaseStepDetailByCaseId") @ApiOperation("新增考试-案例题预览-步骤信息查询") diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java index 64232c2..57c658c 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaResourceCenterController.java @@ -48,8 +48,9 @@ public class TeaResourceCenterController { public ResultEntity uploadResource(@RequestParam MultipartFile file, @ApiParam("学校id") @RequestParam(required = false) String schoolId, @ApiParam("课程Id") @RequestParam String courseId, + @ApiParam("章节id") @RequestParam String chapterId, @ApiParam("上传文件类型 文件/视频") @RequestParam String type) { - Boolean flag = resourceCenterService.uploadResource(file, schoolId, courseId,type); + Boolean flag = resourceCenterService.uploadResource(file, schoolId, courseId,type,chapterId); if (flag) { return new ResultEntity<>(HttpStatus.OK, "新增成功"); } else { @@ -57,16 +58,26 @@ public class TeaResourceCenterController { } } - //查看资源文件列表 + //根据课程id查看资源文件列表 @AnonymousAccess @GetMapping("selectResource") @ApiOperation("查看资源文件列表,图片资源使用默认图片") - public ResultEntity> uploadResourceCenter(@ApiParam("学校id") @RequestParam(required = false) String schoolId, + public ResultEntity> selectResource(@ApiParam("学校id") @RequestParam(required = false) String schoolId, @ApiParam("课程Id") @RequestParam String courseId) { List list = resourceCenterService.selectResource(schoolId, courseId); return new ResultEntity(HttpStatus.OK, "查看资源文件列表,展示成功", list); } + //根据章节查看资源文件列表 + @AnonymousAccess + @GetMapping("selectResourceByChapterId") + @ApiOperation("根据章节查看资源文件列表,图片资源使用默认图片") + public ResultEntity> selectResourceByChapterId(@ApiParam("学校id") @RequestParam(required = false) String schoolId, + @ApiParam("章节Id") @RequestParam String chapterId) { + List list = resourceCenterService.selectResourceByChapterId(schoolId, chapterId); + return new ResultEntity(HttpStatus.OK, "根据章节查看资源文件列表,展示成功", list); + } + //下载资源文件 @GetMapping("downloadResource") @ApiOperation("下载资源文件") diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestion.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestion.java index db5311c..b5effe1 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestion.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestion.java @@ -14,22 +14,25 @@ public class SysCaseQuestion { @ApiModelProperty("课程ID") private String courseId; + @ApiModelProperty("课程名") + private String courseName; + @ApiModelProperty("章节ID") private String chapterId; + @ApiModelProperty("章节名") + private String chapterName; + @ApiModelProperty("题目标题") private String title; - @ApiModelProperty("题目内容") - private String content; - @ApiModelProperty("数据集地址 用 ,隔开") private String resourceData; @ApiModelProperty("输入类型 内置,新增 0为老师导入 1为内置") private String inputType; - @ApiModelProperty("题目类型 / 暂不需要") + @ApiModelProperty("题目类型 0为基础 1为应用") private String type; @ApiModelProperty("学校id") @@ -38,6 +41,9 @@ public class SysCaseQuestion { @ApiModelProperty("上下架状态") private Boolean unmountStatus; + @ApiModelProperty("题目内容") + private String content; + public String getCaseId() { return caseId; } @@ -54,6 +60,14 @@ public class SysCaseQuestion { this.courseId = courseId == null ? null : courseId.trim(); } + public String getCourseName() { + return courseName; + } + + public void setCourseName(String courseName) { + this.courseName = courseName == null ? null : courseName.trim(); + } + public String getChapterId() { return chapterId; } @@ -62,20 +76,20 @@ public class SysCaseQuestion { this.chapterId = chapterId == null ? null : chapterId.trim(); } - public String getTitle() { - return title; + public String getChapterName() { + return chapterName; } - public void setTitle(String title) { - this.title = title == null ? null : title.trim(); + public void setChapterName(String chapterName) { + this.chapterName = chapterName == null ? null : chapterName.trim(); } - public String getContent() { - return content; + public String getTitle() { + return title; } - public void setContent(String content) { - this.content = content == null ? null : content.trim(); + public void setTitle(String title) { + this.title = title == null ? null : title.trim(); } public String getResourceData() { @@ -117,4 +131,12 @@ public class SysCaseQuestion { public void setUnmountStatus(Boolean unmountStatus) { this.unmountStatus = unmountStatus; } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestionExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestionExample.java index 1ff633f..51c09ee 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestionExample.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCaseQuestionExample.java @@ -244,6 +244,76 @@ public class SysCaseQuestionExample { return (Criteria) this; } + public Criteria andCourseNameIsNull() { + addCriterion("course_name is null"); + return (Criteria) this; + } + + public Criteria andCourseNameIsNotNull() { + addCriterion("course_name is not null"); + return (Criteria) this; + } + + public Criteria andCourseNameEqualTo(String value) { + addCriterion("course_name =", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameNotEqualTo(String value) { + addCriterion("course_name <>", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameGreaterThan(String value) { + addCriterion("course_name >", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameGreaterThanOrEqualTo(String value) { + addCriterion("course_name >=", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameLessThan(String value) { + addCriterion("course_name <", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameLessThanOrEqualTo(String value) { + addCriterion("course_name <=", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameLike(String value) { + addCriterion("course_name like", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameNotLike(String value) { + addCriterion("course_name not like", value, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameIn(List values) { + addCriterion("course_name in", values, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameNotIn(List values) { + addCriterion("course_name not in", values, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameBetween(String value1, String value2) { + addCriterion("course_name between", value1, value2, "courseName"); + return (Criteria) this; + } + + public Criteria andCourseNameNotBetween(String value1, String value2) { + addCriterion("course_name not between", value1, value2, "courseName"); + return (Criteria) this; + } + public Criteria andChapterIdIsNull() { addCriterion("chapter_id is null"); return (Criteria) this; @@ -314,143 +384,143 @@ public class SysCaseQuestionExample { return (Criteria) this; } - public Criteria andTitleIsNull() { - addCriterion("title is null"); + public Criteria andChapterNameIsNull() { + addCriterion("chapter_name is null"); return (Criteria) this; } - public Criteria andTitleIsNotNull() { - addCriterion("title is not null"); + public Criteria andChapterNameIsNotNull() { + addCriterion("chapter_name is not null"); return (Criteria) this; } - public Criteria andTitleEqualTo(String value) { - addCriterion("title =", value, "title"); + public Criteria andChapterNameEqualTo(String value) { + addCriterion("chapter_name =", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleNotEqualTo(String value) { - addCriterion("title <>", value, "title"); + public Criteria andChapterNameNotEqualTo(String value) { + addCriterion("chapter_name <>", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleGreaterThan(String value) { - addCriterion("title >", value, "title"); + public Criteria andChapterNameGreaterThan(String value) { + addCriterion("chapter_name >", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleGreaterThanOrEqualTo(String value) { - addCriterion("title >=", value, "title"); + public Criteria andChapterNameGreaterThanOrEqualTo(String value) { + addCriterion("chapter_name >=", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleLessThan(String value) { - addCriterion("title <", value, "title"); + public Criteria andChapterNameLessThan(String value) { + addCriterion("chapter_name <", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleLessThanOrEqualTo(String value) { - addCriterion("title <=", value, "title"); + public Criteria andChapterNameLessThanOrEqualTo(String value) { + addCriterion("chapter_name <=", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleLike(String value) { - addCriterion("title like", value, "title"); + public Criteria andChapterNameLike(String value) { + addCriterion("chapter_name like", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleNotLike(String value) { - addCriterion("title not like", value, "title"); + public Criteria andChapterNameNotLike(String value) { + addCriterion("chapter_name not like", value, "chapterName"); return (Criteria) this; } - public Criteria andTitleIn(List values) { - addCriterion("title in", values, "title"); + public Criteria andChapterNameIn(List values) { + addCriterion("chapter_name in", values, "chapterName"); return (Criteria) this; } - public Criteria andTitleNotIn(List values) { - addCriterion("title not in", values, "title"); + public Criteria andChapterNameNotIn(List values) { + addCriterion("chapter_name not in", values, "chapterName"); return (Criteria) this; } - public Criteria andTitleBetween(String value1, String value2) { - addCriterion("title between", value1, value2, "title"); + public Criteria andChapterNameBetween(String value1, String value2) { + addCriterion("chapter_name between", value1, value2, "chapterName"); return (Criteria) this; } - public Criteria andTitleNotBetween(String value1, String value2) { - addCriterion("title not between", value1, value2, "title"); + public Criteria andChapterNameNotBetween(String value1, String value2) { + addCriterion("chapter_name not between", value1, value2, "chapterName"); return (Criteria) this; } - public Criteria andContentIsNull() { - addCriterion("content is null"); + public Criteria andTitleIsNull() { + addCriterion("title is null"); return (Criteria) this; } - public Criteria andContentIsNotNull() { - addCriterion("content is not null"); + public Criteria andTitleIsNotNull() { + addCriterion("title is not null"); return (Criteria) this; } - public Criteria andContentEqualTo(String value) { - addCriterion("content =", value, "content"); + public Criteria andTitleEqualTo(String value) { + addCriterion("title =", value, "title"); return (Criteria) this; } - public Criteria andContentNotEqualTo(String value) { - addCriterion("content <>", value, "content"); + public Criteria andTitleNotEqualTo(String value) { + addCriterion("title <>", value, "title"); return (Criteria) this; } - public Criteria andContentGreaterThan(String value) { - addCriterion("content >", value, "content"); + public Criteria andTitleGreaterThan(String value) { + addCriterion("title >", value, "title"); return (Criteria) this; } - public Criteria andContentGreaterThanOrEqualTo(String value) { - addCriterion("content >=", value, "content"); + public Criteria andTitleGreaterThanOrEqualTo(String value) { + addCriterion("title >=", value, "title"); return (Criteria) this; } - public Criteria andContentLessThan(String value) { - addCriterion("content <", value, "content"); + public Criteria andTitleLessThan(String value) { + addCriterion("title <", value, "title"); return (Criteria) this; } - public Criteria andContentLessThanOrEqualTo(String value) { - addCriterion("content <=", value, "content"); + public Criteria andTitleLessThanOrEqualTo(String value) { + addCriterion("title <=", value, "title"); return (Criteria) this; } - public Criteria andContentLike(String value) { - addCriterion("content like", value, "content"); + public Criteria andTitleLike(String value) { + addCriterion("title like", value, "title"); return (Criteria) this; } - public Criteria andContentNotLike(String value) { - addCriterion("content not like", value, "content"); + public Criteria andTitleNotLike(String value) { + addCriterion("title not like", value, "title"); return (Criteria) this; } - public Criteria andContentIn(List values) { - addCriterion("content in", values, "content"); + public Criteria andTitleIn(List values) { + addCriterion("title in", values, "title"); return (Criteria) this; } - public Criteria andContentNotIn(List values) { - addCriterion("content not in", values, "content"); + public Criteria andTitleNotIn(List values) { + addCriterion("title not in", values, "title"); return (Criteria) this; } - public Criteria andContentBetween(String value1, String value2) { - addCriterion("content between", value1, value2, "content"); + public Criteria andTitleBetween(String value1, String value2) { + addCriterion("title between", value1, value2, "title"); return (Criteria) this; } - public Criteria andContentNotBetween(String value1, String value2) { - addCriterion("content not between", value1, value2, "content"); + public Criteria andTitleNotBetween(String value1, String value2) { + addCriterion("title not between", value1, value2, "title"); return (Criteria) this; } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java index dbfed1a..4a2e90b 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java @@ -14,6 +14,9 @@ public class TeaResourceCenter { @ApiModelProperty("课程ID") private String courseId; + @ApiModelProperty("章节id") + private String chapterId; + @ApiModelProperty("资源地址") private String resourceUrl; @@ -48,6 +51,14 @@ public class TeaResourceCenter { this.courseId = courseId == null ? null : courseId.trim(); } + public String getChapterId() { + return chapterId; + } + + public void setChapterId(String chapterId) { + this.chapterId = chapterId == null ? null : chapterId.trim(); + } + public String getResourceUrl() { return resourceUrl; } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java index a5dcbfc..a6fcac4 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java @@ -244,6 +244,76 @@ public class TeaResourceCenterExample { return (Criteria) this; } + public Criteria andChapterIdIsNull() { + addCriterion("chapter_id is null"); + return (Criteria) this; + } + + public Criteria andChapterIdIsNotNull() { + addCriterion("chapter_id is not null"); + return (Criteria) this; + } + + public Criteria andChapterIdEqualTo(String value) { + addCriterion("chapter_id =", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotEqualTo(String value) { + addCriterion("chapter_id <>", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdGreaterThan(String value) { + addCriterion("chapter_id >", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdGreaterThanOrEqualTo(String value) { + addCriterion("chapter_id >=", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLessThan(String value) { + addCriterion("chapter_id <", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLessThanOrEqualTo(String value) { + addCriterion("chapter_id <=", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLike(String value) { + addCriterion("chapter_id like", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotLike(String value) { + addCriterion("chapter_id not like", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdIn(List values) { + addCriterion("chapter_id in", values, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotIn(List values) { + addCriterion("chapter_id not in", values, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdBetween(String value1, String value2) { + addCriterion("chapter_id between", value1, value2, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotBetween(String value1, String value2) { + addCriterion("chapter_id not between", value1, value2, "chapterId"); + return (Criteria) this; + } + public Criteria andResourceUrlIsNull() { addCriterion("resource_url is null"); return (Criteria) this; diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCaseQuestionMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCaseQuestionMapper.java index cb609be..13e46b5 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCaseQuestionMapper.java +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCaseQuestionMapper.java @@ -20,16 +20,22 @@ public interface SysCaseQuestionMapper { int insertSelective(SysCaseQuestion record); + List selectByExampleWithBLOBs(SysCaseQuestionExample example); + List selectByExample(SysCaseQuestionExample example); SysCaseQuestion selectByPrimaryKey(String caseId); int updateByExampleSelective(@Param("record") SysCaseQuestion record, @Param("example") SysCaseQuestionExample example); + int updateByExampleWithBLOBs(@Param("record") SysCaseQuestion record, @Param("example") SysCaseQuestionExample example); + int updateByExample(@Param("record") SysCaseQuestion record, @Param("example") SysCaseQuestionExample example); int updateByPrimaryKeySelective(SysCaseQuestion record); + int updateByPrimaryKeyWithBLOBs(SysCaseQuestion record); + int updateByPrimaryKey(SysCaseQuestion record); @Select(" SELECT course_id FROM sys_course WHERE school_id = #{schoolId} order by sequence") diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java index 2478bc2..47436ec 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/ITeaResourceCenterService.java @@ -7,8 +7,10 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; public interface ITeaResourceCenterService { - Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type); + Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type,String chapterId); List selectResource(String schoolId, String courseId); void downloadResource(String resourceId, HttpServletResponse response); + + List selectResourceByChapterId(String schoolId, String chapterId); } diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java index 1d15d3c..4a4a966 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaObjectiveServiceImpl.java @@ -117,6 +117,8 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { String type = String.valueOf(currentRow.getCell(2).getNumericCellValue()); //题目类型 String score = String.valueOf(currentRow.getCell(3).getNumericCellValue()); //分数 String content = currentRow.getCell(4).getStringCellValue(); //题目内容 + System.out.println(chapterName); + System.out.println("!!!"+content); String question_a = ""; String question_b = ""; String question_c = ""; @@ -132,12 +134,13 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { } String answer = currentRow.getCell(9).getStringCellValue(); - String analyze = currentRow.getCell(10).getStringCellValue(); + Cell cell = currentRow.getCell(10); + String analyze = (cell != null) ? cell.getStringCellValue() : ""; SysObjectiveQuestion obj = new SysObjectiveQuestion(); obj.setObjectiveId(String.valueOf(UUID.randomUUID())); - obj.setCourseId(courseMap.get(courseName)); + obj.setCourseId(courseMap.get(chapterName)); obj.setCourseName(courseName); obj.setChapterId(chapterMap.get(chapterName)); obj.setChapterName(chapterName); @@ -196,7 +199,8 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService { } String answer = currentRow.getCell(8).getStringCellValue(); - String analyze = currentRow.getCell(9).getStringCellValue(); + Cell cell = currentRow.getCell(9); + String analyze = (cell != null) ? cell.getStringCellValue() : ""; SysObjectiveQuestion obj = new SysObjectiveQuestion(); diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java index ae6c5e8..0945458 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/tea/impl/TeaResourceCenterServiceImpl.java @@ -1,5 +1,6 @@ package com.sztzjy.financial_bigdata.service.tea.impl; +import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.entity.TeaResourceCenter; import com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample; import com.sztzjy.financial_bigdata.mapper.TeaResourceCenterMapper; @@ -20,9 +21,10 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService { @Autowired TeaResourceCenterMapper resourceCenterMapper; @Override - public Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type) { + public Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type,String chapterId) { String uploadUrl = fileUtil.upload(file); TeaResourceCenter resourceCenter=new TeaResourceCenter(); + resourceCenter.setChapterId(chapterId); resourceCenter.setResourceId(String.valueOf(UUID.randomUUID())); resourceCenter.setResourceName(file.getOriginalFilename()); resourceCenter.setResourceUrl(uploadUrl); @@ -58,4 +60,13 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService { } } + @Override + public List selectResourceByChapterId(String schoolId, String chapterId) { + TeaResourceCenterExample example=new TeaResourceCenterExample(); + TeaResourceCenterExample.Criteria criteria = example.createCriteria(); + criteria.andChapterIdEqualTo(chapterId).andSchoolIdEqualTo(schoolId); + List teaResourceCenterList = resourceCenterMapper.selectByExample(example); + return teaResourceCenterList; + } + } diff --git a/src/main/resources/mapper/SysCaseQuestionMapper.xml b/src/main/resources/mapper/SysCaseQuestionMapper.xml index a0113a3..c52fa70 100644 --- a/src/main/resources/mapper/SysCaseQuestionMapper.xml +++ b/src/main/resources/mapper/SysCaseQuestionMapper.xml @@ -4,15 +4,19 @@ + + - + + + @@ -72,9 +76,28 @@ - case_id, course_id, chapter_id, title, content, resource_data, input_type, type, - school_id, unmount_status + case_id, course_id, course_name, chapter_id, chapter_name, title, resource_data, + input_type, type, school_id, unmount_status + + + content + - select + , + from sys_case_question where case_id = #{caseId,jdbcType=VARCHAR} @@ -106,14 +131,16 @@ - insert into sys_case_question (case_id, course_id, chapter_id, - title, content, resource_data, - input_type, type, school_id, - unmount_status) - values (#{caseId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, - #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{resourceData,jdbcType=VARCHAR}, - #{inputType,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, - #{unmountStatus,jdbcType=BIT}) + insert into sys_case_question (case_id, course_id, course_name, + chapter_id, chapter_name, title, + resource_data, input_type, type, + school_id, unmount_status, content + ) + values (#{caseId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR}, + #{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, + #{resourceData,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{schoolId,jdbcType=VARCHAR}, #{unmountStatus,jdbcType=BIT}, #{content,jdbcType=LONGVARCHAR} + ) insert into sys_case_question @@ -124,15 +151,18 @@ course_id, + + course_name, + chapter_id, + + chapter_name, + title, - - content, - resource_data, @@ -148,6 +178,9 @@ unmount_status, + + content, + @@ -156,15 +189,18 @@ #{courseId,jdbcType=VARCHAR}, + + #{courseName,jdbcType=VARCHAR}, + #{chapterId,jdbcType=VARCHAR}, + + #{chapterName,jdbcType=VARCHAR}, + #{title,jdbcType=VARCHAR}, - - #{content,jdbcType=VARCHAR}, - #{resourceData,jdbcType=VARCHAR}, @@ -180,6 +216,9 @@ #{unmountStatus,jdbcType=BIT}, + + #{content,jdbcType=LONGVARCHAR}, + select @@ -104,12 +105,14 @@ - insert into tea_resource_center (resource_id, course_id, resource_url, - image_url, resource_name, school_id, - type, count) - values (#{resourceId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{resourceUrl,jdbcType=VARCHAR}, - #{imageUrl,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER}) + insert into tea_resource_center (resource_id, course_id, chapter_id, + resource_url, image_url, resource_name, + school_id, type, count + ) + values (#{resourceId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, + #{resourceUrl,jdbcType=VARCHAR}, #{imageUrl,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, + #{schoolId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER} + ) insert into tea_resource_center @@ -120,6 +123,9 @@ course_id, + + chapter_id, + resource_url, @@ -146,6 +152,9 @@ #{courseId,jdbcType=VARCHAR}, + + #{chapterId,jdbcType=VARCHAR}, + #{resourceUrl,jdbcType=VARCHAR}, @@ -181,6 +190,9 @@ course_id = #{record.courseId,jdbcType=VARCHAR}, + + chapter_id = #{record.chapterId,jdbcType=VARCHAR}, + resource_url = #{record.resourceUrl,jdbcType=VARCHAR}, @@ -208,6 +220,7 @@ update tea_resource_center set resource_id = #{record.resourceId,jdbcType=VARCHAR}, course_id = #{record.courseId,jdbcType=VARCHAR}, + chapter_id = #{record.chapterId,jdbcType=VARCHAR}, resource_url = #{record.resourceUrl,jdbcType=VARCHAR}, image_url = #{record.imageUrl,jdbcType=VARCHAR}, resource_name = #{record.resourceName,jdbcType=VARCHAR}, @@ -224,6 +237,9 @@ course_id = #{courseId,jdbcType=VARCHAR}, + + chapter_id = #{chapterId,jdbcType=VARCHAR}, + resource_url = #{resourceUrl,jdbcType=VARCHAR}, @@ -248,6 +264,7 @@ update tea_resource_center set course_id = #{courseId,jdbcType=VARCHAR}, + chapter_id = #{chapterId,jdbcType=VARCHAR}, resource_url = #{resourceUrl,jdbcType=VARCHAR}, image_url = #{imageUrl,jdbcType=VARCHAR}, resource_name = #{resourceName,jdbcType=VARCHAR},