From e00c752662319a638a732fb901d8204a131c581d Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Tue, 12 Mar 2024 18:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=AD=E5=BF=83=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tea/TeaResourceCenterController.java | 70 +- .../financial_bigdata/entity/SysCourse.java | 22 + .../entity/SysCourseExample.java | 140 ++++ .../entity/TeaResourceCenter.java | 77 --- .../entity/TeaResourceCenterExample.java | 620 ------------------ .../mapper/SysCourseMapper.java | 7 +- .../mapper/TeaResourceCenterMapper.java | 33 - .../tea/ITeaResourceCenterService.java | 2 + .../impl/TeaResourceCenterServiceImpl.java | 23 +- src/main/resources/generatorConfig.xml | 32 +- .../mapper/SysCourseChapterMapper.xml | 66 ++ src/main/resources/mapper/SysCourseMapper.xml | 121 +++- .../mapper/TeaResourceCenterMapper.xml | 229 ------- 13 files changed, 449 insertions(+), 993 deletions(-) delete mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java delete mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java delete mode 100644 src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java delete mode 100644 src/main/resources/mapper/TeaResourceCenterMapper.xml 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 e4912f1..a305a62 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 @@ -8,10 +8,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.List; //资源中心 @@ -30,7 +37,7 @@ public class TeaResourceCenterController { @ApiOperation("上传资源文件") public ResultEntity uploadResource(@RequestParam MultipartFile file, @ApiParam("学校id") @RequestParam(required = false) String schoolId, - @ApiParam("章节Id") String chapterId){ + @ApiParam("章节Id") @RequestParam String chapterId){ Boolean flag=resourceCenterService.uploadResource(file,schoolId,chapterId); if (flag){ return new ResultEntity<>(HttpStatus.OK,"新增成功"); @@ -41,11 +48,66 @@ public class TeaResourceCenterController { //查看资源文件 @GetMapping("selectResource") - @ApiOperation("查看资源文件") - public ResultEntity uploadResourceCenter(@ApiParam("学校id") @RequestParam(required = false) String schoolId, - @ApiParam("章节Id") String chapterId){ + @ApiOperation("查看资源文件,图片资源使用默认图片") + public ResultEntity> uploadResourceCenter(@ApiParam("学校id") @RequestParam(required = false) String schoolId, + @ApiParam("章节Id") @RequestParam String chapterId){ List list=resourceCenterService.selectResource(schoolId,chapterId); return new ResultEntity(HttpStatus.OK, "相对估值法-PS市盈率法,展示成功", list); } + //下载资源文件 + @GetMapping("downloadResource") + @ApiOperation("下载资源文件") + public void downloadResource(@ApiParam("资源ID") @RequestParam String resourceId ,HttpServletResponse response){ + resourceCenterService.downloadResource(resourceId,response); + } + + //查看资源文件 + @GetMapping("/getResource") + @ApiOperation("获取视频流") + public ResponseEntity streamVideo(@RequestParam String module, @RequestParam String name, HttpServletResponse response) { + return null; +// +// +// StuResourcesExample example = new StuResourcesExample(); +// example.createCriteria().andModuleEqualTo(module).andResourcesNameEqualTo(name); +// List stuResources = stuResourcesMapper.selectByExample(example); +// if (stuResources.size() > 0) { +// StuResources stuResources1 = stuResources.get(0); +// String url = stuResources1.getResourcesUrl(); +// String videoPath = filePath + url; +// File videoFile = new File(videoPath); +// if ("mp4".equals(stuResources1.getResourcesType())) { +// +// +// if (videoFile.exists()) { +// Path path = Paths.get(videoPath); +// FileSystemResource fileSystemResource = new FileSystemResource(videoFile); +// return ResponseEntity.ok() +// .contentType(MediaType.parseMediaType("video/mp4")) +// .body(fileSystemResource); +// } else { +// return ResponseEntity.notFound().build(); +// } +// } else if ("pdf".equals(stuResources1.getResourcesType())) { +// +//// fileUtil.getPdf(response,name,url); +// if (videoFile.exists()) { +// Path path = Paths.get(videoPath); +// FileSystemResource fileSystemResource = new FileSystemResource(videoFile); +// return ResponseEntity.ok() +// .contentType(MediaType.parseMediaType("application/pdf")) +// .body(fileSystemResource); +// +// } else { +// return ResponseEntity.notFound().build(); +// } +// +// } +// +// } +// return ResponseEntity.notFound().build(); + + } + } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourse.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourse.java index a141948..d449cce 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourse.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourse.java @@ -17,6 +17,12 @@ public class SysCourse { @ApiModelProperty("排序") private Integer sequence; + @ApiModelProperty("学校ID") + private String schoolId; + + @ApiModelProperty("0为老师导入 1为内置") + private String inputType; + public String getCourseId() { return courseId; } @@ -40,4 +46,20 @@ public class SysCourse { public void setSequence(Integer sequence) { this.sequence = sequence; } + + public String getSchoolId() { + return schoolId; + } + + public void setSchoolId(String schoolId) { + this.schoolId = schoolId == null ? null : schoolId.trim(); + } + + public String getInputType() { + return inputType; + } + + public void setInputType(String inputType) { + this.inputType = inputType == null ? null : inputType.trim(); + } } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourseExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourseExample.java index d861809..e460c98 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourseExample.java +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysCourseExample.java @@ -303,6 +303,146 @@ public class SysCourseExample { addCriterion("sequence not between", value1, value2, "sequence"); return (Criteria) this; } + + public Criteria andSchoolIdIsNull() { + addCriterion("school_id is null"); + return (Criteria) this; + } + + public Criteria andSchoolIdIsNotNull() { + addCriterion("school_id is not null"); + return (Criteria) this; + } + + public Criteria andSchoolIdEqualTo(String value) { + addCriterion("school_id =", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotEqualTo(String value) { + addCriterion("school_id <>", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdGreaterThan(String value) { + addCriterion("school_id >", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdGreaterThanOrEqualTo(String value) { + addCriterion("school_id >=", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLessThan(String value) { + addCriterion("school_id <", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLessThanOrEqualTo(String value) { + addCriterion("school_id <=", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLike(String value) { + addCriterion("school_id like", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotLike(String value) { + addCriterion("school_id not like", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdIn(List values) { + addCriterion("school_id in", values, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotIn(List values) { + addCriterion("school_id not in", values, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdBetween(String value1, String value2) { + addCriterion("school_id between", value1, value2, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotBetween(String value1, String value2) { + addCriterion("school_id not between", value1, value2, "schoolId"); + return (Criteria) this; + } + + public Criteria andInputTypeIsNull() { + addCriterion("input_type is null"); + return (Criteria) this; + } + + public Criteria andInputTypeIsNotNull() { + addCriterion("input_type is not null"); + return (Criteria) this; + } + + public Criteria andInputTypeEqualTo(String value) { + addCriterion("input_type =", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeNotEqualTo(String value) { + addCriterion("input_type <>", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeGreaterThan(String value) { + addCriterion("input_type >", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeGreaterThanOrEqualTo(String value) { + addCriterion("input_type >=", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeLessThan(String value) { + addCriterion("input_type <", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeLessThanOrEqualTo(String value) { + addCriterion("input_type <=", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeLike(String value) { + addCriterion("input_type like", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeNotLike(String value) { + addCriterion("input_type not like", value, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeIn(List values) { + addCriterion("input_type in", values, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeNotIn(List values) { + addCriterion("input_type not in", values, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeBetween(String value1, String value2) { + addCriterion("input_type between", value1, value2, "inputType"); + return (Criteria) this; + } + + public Criteria andInputTypeNotBetween(String value1, String value2) { + addCriterion("input_type not between", value1, value2, "inputType"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java deleted file mode 100644 index 119471b..0000000 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.sztzjy.financial_bigdata.entity; - -import io.swagger.annotations.ApiModelProperty; -/** - * 资源中心表 - * - * @author xcj - * tea_resource_center - */ -public class TeaResourceCenter { - @ApiModelProperty("资源ID") - private String resourceId; - - - @ApiModelProperty("章节ID") - private String chapterId; - - @ApiModelProperty("资源地址") - private String resourceUrl; - - @ApiModelProperty("图片地址") - private String imageUrl; - - @ApiModelProperty("资源名称") - private String resourceName; - - @ApiModelProperty("学校ID") - private String schoolId; - - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId == null ? null : resourceId.trim(); - } - - public String getChapterId() { - return chapterId; - } - - public void setChapterId(String chapterId) { - this.chapterId = chapterId == null ? null : chapterId.trim(); - } - - public String getResourceUrl() { - return resourceUrl; - } - - public void setResourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl == null ? null : resourceUrl.trim(); - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl == null ? null : imageUrl.trim(); - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName == null ? null : resourceName.trim(); - } - - public String getSchoolId() { - return schoolId; - } - - public void setSchoolId(String schoolId) { - this.schoolId = schoolId == null ? null : schoolId.trim(); - } -} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java deleted file mode 100644 index 82d658d..0000000 --- a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java +++ /dev/null @@ -1,620 +0,0 @@ -package com.sztzjy.financial_bigdata.entity; - -import java.util.ArrayList; -import java.util.List; - -public class TeaResourceCenterExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - - public TeaResourceCenterExample() { - oredCriteria = new ArrayList<>(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andResourceIdIsNull() { - addCriterion("resource_id is null"); - return (Criteria) this; - } - - public Criteria andResourceIdIsNotNull() { - addCriterion("resource_id is not null"); - return (Criteria) this; - } - - public Criteria andResourceIdEqualTo(String value) { - addCriterion("resource_id =", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdNotEqualTo(String value) { - addCriterion("resource_id <>", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdGreaterThan(String value) { - addCriterion("resource_id >", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdGreaterThanOrEqualTo(String value) { - addCriterion("resource_id >=", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdLessThan(String value) { - addCriterion("resource_id <", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdLessThanOrEqualTo(String value) { - addCriterion("resource_id <=", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdLike(String value) { - addCriterion("resource_id like", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdNotLike(String value) { - addCriterion("resource_id not like", value, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdIn(List values) { - addCriterion("resource_id in", values, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdNotIn(List values) { - addCriterion("resource_id not in", values, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdBetween(String value1, String value2) { - addCriterion("resource_id between", value1, value2, "resourceId"); - return (Criteria) this; - } - - public Criteria andResourceIdNotBetween(String value1, String value2) { - addCriterion("resource_id not between", value1, value2, "resourceId"); - 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; - } - - public Criteria andResourceUrlIsNotNull() { - addCriterion("resource_url is not null"); - return (Criteria) this; - } - - public Criteria andResourceUrlEqualTo(String value) { - addCriterion("resource_url =", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlNotEqualTo(String value) { - addCriterion("resource_url <>", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlGreaterThan(String value) { - addCriterion("resource_url >", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlGreaterThanOrEqualTo(String value) { - addCriterion("resource_url >=", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlLessThan(String value) { - addCriterion("resource_url <", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlLessThanOrEqualTo(String value) { - addCriterion("resource_url <=", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlLike(String value) { - addCriterion("resource_url like", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlNotLike(String value) { - addCriterion("resource_url not like", value, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlIn(List values) { - addCriterion("resource_url in", values, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlNotIn(List values) { - addCriterion("resource_url not in", values, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlBetween(String value1, String value2) { - addCriterion("resource_url between", value1, value2, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andResourceUrlNotBetween(String value1, String value2) { - addCriterion("resource_url not between", value1, value2, "resourceUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlIsNull() { - addCriterion("image_url is null"); - return (Criteria) this; - } - - public Criteria andImageUrlIsNotNull() { - addCriterion("image_url is not null"); - return (Criteria) this; - } - - public Criteria andImageUrlEqualTo(String value) { - addCriterion("image_url =", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlNotEqualTo(String value) { - addCriterion("image_url <>", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlGreaterThan(String value) { - addCriterion("image_url >", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlGreaterThanOrEqualTo(String value) { - addCriterion("image_url >=", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlLessThan(String value) { - addCriterion("image_url <", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlLessThanOrEqualTo(String value) { - addCriterion("image_url <=", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlLike(String value) { - addCriterion("image_url like", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlNotLike(String value) { - addCriterion("image_url not like", value, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlIn(List values) { - addCriterion("image_url in", values, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlNotIn(List values) { - addCriterion("image_url not in", values, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlBetween(String value1, String value2) { - addCriterion("image_url between", value1, value2, "imageUrl"); - return (Criteria) this; - } - - public Criteria andImageUrlNotBetween(String value1, String value2) { - addCriterion("image_url not between", value1, value2, "imageUrl"); - return (Criteria) this; - } - - public Criteria andResourceNameIsNull() { - addCriterion("resource_name is null"); - return (Criteria) this; - } - - public Criteria andResourceNameIsNotNull() { - addCriterion("resource_name is not null"); - return (Criteria) this; - } - - public Criteria andResourceNameEqualTo(String value) { - addCriterion("resource_name =", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameNotEqualTo(String value) { - addCriterion("resource_name <>", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameGreaterThan(String value) { - addCriterion("resource_name >", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameGreaterThanOrEqualTo(String value) { - addCriterion("resource_name >=", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameLessThan(String value) { - addCriterion("resource_name <", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameLessThanOrEqualTo(String value) { - addCriterion("resource_name <=", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameLike(String value) { - addCriterion("resource_name like", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameNotLike(String value) { - addCriterion("resource_name not like", value, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameIn(List values) { - addCriterion("resource_name in", values, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameNotIn(List values) { - addCriterion("resource_name not in", values, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameBetween(String value1, String value2) { - addCriterion("resource_name between", value1, value2, "resourceName"); - return (Criteria) this; - } - - public Criteria andResourceNameNotBetween(String value1, String value2) { - addCriterion("resource_name not between", value1, value2, "resourceName"); - return (Criteria) this; - } - - public Criteria andSchoolIdIsNull() { - addCriterion("school_id is null"); - return (Criteria) this; - } - - public Criteria andSchoolIdIsNotNull() { - addCriterion("school_id is not null"); - return (Criteria) this; - } - - public Criteria andSchoolIdEqualTo(String value) { - addCriterion("school_id =", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdNotEqualTo(String value) { - addCriterion("school_id <>", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdGreaterThan(String value) { - addCriterion("school_id >", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdGreaterThanOrEqualTo(String value) { - addCriterion("school_id >=", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdLessThan(String value) { - addCriterion("school_id <", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdLessThanOrEqualTo(String value) { - addCriterion("school_id <=", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdLike(String value) { - addCriterion("school_id like", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdNotLike(String value) { - addCriterion("school_id not like", value, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdIn(List values) { - addCriterion("school_id in", values, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdNotIn(List values) { - addCriterion("school_id not in", values, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdBetween(String value1, String value2) { - addCriterion("school_id between", value1, value2, "schoolId"); - return (Criteria) this; - } - - public Criteria andSchoolIdNotBetween(String value1, String value2) { - addCriterion("school_id not between", value1, value2, "schoolId"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCourseMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCourseMapper.java index a987a31..c7bde87 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCourseMapper.java +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysCourseMapper.java @@ -3,8 +3,10 @@ package com.sztzjy.financial_bigdata.mapper; import com.sztzjy.financial_bigdata.entity.SysCourse; import com.sztzjy.financial_bigdata.entity.SysCourseExample; import java.util.List; -import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper public interface SysCourseMapper { long countByExample(SysCourseExample example); @@ -27,4 +29,7 @@ public interface SysCourseMapper { int updateByPrimaryKeySelective(SysCourse record); int updateByPrimaryKey(SysCourse record); + + List selectCourse(@Param("schoolId") String schoolId); + } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java deleted file mode 100644 index 966ce23..0000000 --- a/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sztzjy.financial_bigdata.mapper; - -import com.sztzjy.financial_bigdata.entity.TeaResourceCenter; -import com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample; -import java.util.List; - -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -@Mapper -public interface TeaResourceCenterMapper { - long countByExample(TeaResourceCenterExample example); - - - int deleteByExample(TeaResourceCenterExample example); - - int deleteByPrimaryKey(String resourceId); - - int insert(TeaResourceCenter record); - - int insertSelective(TeaResourceCenter record); - - List selectByExample(TeaResourceCenterExample example); - - TeaResourceCenter selectByPrimaryKey(String resourceId); - - int updateByExampleSelective(@Param("record") TeaResourceCenter record, @Param("example") TeaResourceCenterExample example); - - int updateByExample(@Param("record") TeaResourceCenter record, @Param("example") TeaResourceCenterExample example); - - int updateByPrimaryKeySelective(TeaResourceCenter record); - - int updateByPrimaryKey(TeaResourceCenter record); -} \ No newline at end of file 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 6066fdf..316ee5c 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 @@ -3,10 +3,12 @@ package com.sztzjy.financial_bigdata.service.tea; import com.sztzjy.financial_bigdata.entity.TeaResourceCenter; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.util.List; public interface ITeaResourceCenterService { Boolean uploadResource(MultipartFile file, String schoolId,String chapterId); List selectResource(String schoolId, String chapterId); + void downloadResource(String resourceId, HttpServletResponse response); } 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 c627528..67a6cd1 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 @@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.UUID; @@ -27,21 +28,31 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService { resourceCenter.setResourceUrl(uploadUrl); resourceCenter.setChapterId(chapterId); resourceCenter.setSchoolId(schoolId); + resourceCenter.setImageUrl(null); int insert = resourceCenterMapper.insert(resourceCenter); if(insert!=0){ return true; }else { return false; } - } @Override public List selectResource(String schoolId, String chapterId) { -// TeaResourceCenterExample example=new TeaResourceCenterExample(); -// TeaResourceCenterExample.Criteria criteria = example.createCriteria(); -// criteria.andChapterIdEqualTo(chapterId).andSc -// resourceCenterMapper.selectByExample() - return null; + TeaResourceCenterExample example=new TeaResourceCenterExample(); + TeaResourceCenterExample.Criteria criteria = example.createCriteria(); + TeaResourceCenterExample.Criteria criteria2 = example.createCriteria(); + criteria.andChapterIdEqualTo(chapterId).andSchoolIdEqualTo(schoolId); + criteria2.andChapterIdEqualTo(chapterId).andSchoolIdEqualTo(null); + example.or(criteria2); + List teaResourceCenterList = resourceCenterMapper.selectByExample(example); + return teaResourceCenterList; } + + @Override + public void downloadResource(String resourceId, HttpServletResponse response) { + TeaResourceCenter resourceCenter = resourceCenterMapper.selectByPrimaryKey(resourceId); + fileUtil.download(response, resourceCenter.getResourceName(), resourceCenter.getResourceUrl()); + } + } diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 2034346..145a513 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -39,23 +39,23 @@ - -
-
-
-
-
-
-
-
-
-
-
-
-
-
+ + + + + + + + + + + + + + +
-
+ diff --git a/src/main/resources/mapper/SysCourseChapterMapper.xml b/src/main/resources/mapper/SysCourseChapterMapper.xml index 7b657b7..7d9f7ba 100644 --- a/src/main/resources/mapper/SysCourseChapterMapper.xml +++ b/src/main/resources/mapper/SysCourseChapterMapper.xml @@ -193,4 +193,70 @@ sequence = #{sequence,jdbcType=INTEGER} where chapter_id = #{chapterId,jdbcType=VARCHAR} + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysCourseMapper.xml b/src/main/resources/mapper/SysCourseMapper.xml index 0cc29b7..2e15510 100644 --- a/src/main/resources/mapper/SysCourseMapper.xml +++ b/src/main/resources/mapper/SysCourseMapper.xml @@ -5,6 +5,8 @@ + + @@ -65,7 +67,7 @@ - course_id, course_name, sequence + course_id, course_name, sequence, school_id, input_type @@ -146,6 +160,12 @@ sequence = #{record.sequence,jdbcType=INTEGER}, + + school_id = #{record.schoolId,jdbcType=VARCHAR}, + + + input_type = #{record.inputType,jdbcType=VARCHAR}, + @@ -155,7 +175,9 @@ update sys_course set course_id = #{record.courseId,jdbcType=VARCHAR}, course_name = #{record.courseName,jdbcType=VARCHAR}, - sequence = #{record.sequence,jdbcType=INTEGER} + sequence = #{record.sequence,jdbcType=INTEGER}, + school_id = #{record.schoolId,jdbcType=VARCHAR}, + input_type = #{record.inputType,jdbcType=VARCHAR} @@ -169,13 +191,98 @@ sequence = #{sequence,jdbcType=INTEGER}, + + school_id = #{schoolId,jdbcType=VARCHAR}, + + + input_type = #{inputType,jdbcType=VARCHAR}, + where course_id = #{courseId,jdbcType=VARCHAR} update sys_course set course_name = #{courseName,jdbcType=VARCHAR}, - sequence = #{sequence,jdbcType=INTEGER} + sequence = #{sequence,jdbcType=INTEGER}, + school_id = #{schoolId,jdbcType=VARCHAR}, + input_type = #{inputType,jdbcType=VARCHAR} where course_id = #{courseId,jdbcType=VARCHAR} + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TeaResourceCenterMapper.xml b/src/main/resources/mapper/TeaResourceCenterMapper.xml deleted file mode 100644 index 84ed23c..0000000 --- a/src/main/resources/mapper/TeaResourceCenterMapper.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - resource_id, chapter_id, resource_url, image_url, resource_name, school_id - - - - - delete from tea_resource_center - where resource_id = #{resourceId,jdbcType=VARCHAR} - - - delete from tea_resource_center - - - - - - insert into tea_resource_center (resource_id, chapter_id, resource_url, - image_url, resource_name, school_id - ) - values (#{resourceId,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, #{resourceUrl,jdbcType=VARCHAR}, - #{imageUrl,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR} - ) - - - insert into tea_resource_center - - - resource_id, - - - chapter_id, - - - resource_url, - - - image_url, - - - resource_name, - - - school_id, - - - - - #{resourceId,jdbcType=VARCHAR}, - - - #{chapterId,jdbcType=VARCHAR}, - - - #{resourceUrl,jdbcType=VARCHAR}, - - - #{imageUrl,jdbcType=VARCHAR}, - - - #{resourceName,jdbcType=VARCHAR}, - - - #{schoolId,jdbcType=VARCHAR}, - - - - - - update tea_resource_center - - - resource_id = #{record.resourceId,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}, - - - school_id = #{record.schoolId,jdbcType=VARCHAR}, - - - - - - - - update tea_resource_center - set resource_id = #{record.resourceId,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}, - school_id = #{record.schoolId,jdbcType=VARCHAR} - - - - - - update tea_resource_center - - - chapter_id = #{chapterId,jdbcType=VARCHAR}, - - - resource_url = #{resourceUrl,jdbcType=VARCHAR}, - - - image_url = #{imageUrl,jdbcType=VARCHAR}, - - - resource_name = #{resourceName,jdbcType=VARCHAR}, - - - school_id = #{schoolId,jdbcType=VARCHAR}, - - - where resource_id = #{resourceId,jdbcType=VARCHAR} - - - update tea_resource_center - set chapter_id = #{chapterId,jdbcType=VARCHAR}, - resource_url = #{resourceUrl,jdbcType=VARCHAR}, - image_url = #{imageUrl,jdbcType=VARCHAR}, - resource_name = #{resourceName,jdbcType=VARCHAR}, - school_id = #{schoolId,jdbcType=VARCHAR} - where resource_id = #{resourceId,jdbcType=VARCHAR} - - \ No newline at end of file