From 1675fbe6f40c3d24d5b72b69cc120e694f7c39c2 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Wed, 3 Jul 2024 16:39:10 +0800 Subject: [PATCH] 1 --- .../controller/CourseConfigController.java | 9 +- .../controller/CourseManageController.java | 4 +- .../controller/TopicResourceController.java | 10 +- .../resource_center/entity/SysResource.java | 40 ++- .../entity/SysResourceExample.java | 266 ++++++++++++++++-- .../entity/dto/SysResourceDto.java | 1 - .../mapper/SysResourceMapper.java | 8 +- src/main/resources/generatorConfig.xml | 8 +- .../mapper/SysObjectiveQuestionsMapper.xml | 18 +- .../resources/mapper/SysResourceMapper.xml | 99 ++++--- 10 files changed, 367 insertions(+), 96 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/CourseConfigController.java b/src/main/java/com/sztzjy/resource_center/controller/CourseConfigController.java index 6af353c..8c890e3 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/CourseConfigController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/CourseConfigController.java @@ -45,7 +45,7 @@ public class CourseConfigController { @AnonymousAccess @ApiOperation("本地上传资源") @PostMapping("uploadLocal") - public ResultEntity uploadLocal(@ApiParam("") @RequestBody SysResourceDto dto) { + public ResultEntity uploadLocal(@ModelAttribute SysResourceDto dto) { if (dto.getFile() == null) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请上传文件!"); } @@ -67,7 +67,7 @@ public class CourseConfigController { || extension.equals(".xlsx") || extension.equals(".xls") || extension.equals(".doc") || extension.equals(".docx")) { sysResource.setResourceType("课件"); - } else if (extension.equals(".mp4") || extension.equals(".wmv") || extension.equals(".wmv")) { + } else if (extension.equals(".mp4") || extension.equals(".wmv") || extension.equals(".avi")) { sysResource.setResourceType("视频"); } else { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "文件类型不支持!"); @@ -76,9 +76,12 @@ public class CourseConfigController { String uuid = IdUtil.randomUUID(); sysResource.setResourceId(uuid); sysResource.setPictureUrl(pictureName); - sysResource.setOntTag(dto.getOneId()); + sysResource.setOneTag(dto.getOneId()); + sysResource.setOneName(dto.getOneName()); sysResource.setTwoTag(dto.getTwoId()); + sysResource.setTwoName(dto.getTwoName()); sysResource.setThreeTag(dto.getThreeId()); + sysResource.setThreeName(dto.getThreeName()); sysResource.setUrl(url); sysResource.setSource(dto.getSource()); //管理员或者 xx学校 sysResource.setResourceName(dto.getResourceName()); diff --git a/src/main/java/com/sztzjy/resource_center/controller/CourseManageController.java b/src/main/java/com/sztzjy/resource_center/controller/CourseManageController.java index c9944fc..aee75a1 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/CourseManageController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/CourseManageController.java @@ -84,14 +84,13 @@ public class CourseManageController { } - @AnonymousAccess @ApiOperation("删除课程") @PostMapping("deleteOneCatalog") public ResultEntity deleteOneCatalog(@RequestParam String oneId) { sysOneCatalogMapper.deleteByPrimaryKey(oneId); //删除课程资源的绑定关系 - SysResourceAndCourseExample example =new SysResourceAndCourseExample(); + SysResourceAndCourseExample example = new SysResourceAndCourseExample(); example.createCriteria().andOneIdEqualTo(oneId); sysResourceAndCourseMapper.deleteByExample(example); return new ResultEntity<>(HttpStatus.OK, "删除成功"); @@ -125,4 +124,5 @@ public class CourseManageController { PageInfo pageInfo = new PageInfo(sysOneCatalogs); return new ResultEntity>(pageInfo); } + } diff --git a/src/main/java/com/sztzjy/resource_center/controller/TopicResourceController.java b/src/main/java/com/sztzjy/resource_center/controller/TopicResourceController.java index 99bccd4..ae25de4 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/TopicResourceController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/TopicResourceController.java @@ -3,6 +3,7 @@ package com.sztzjy.resource_center.controller; import cn.hutool.core.util.IdUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.sztzjy.resource_center.annotation.AnonymousAccess; import com.sztzjy.resource_center.entity.SysObjectiveQuestions; import com.sztzjy.resource_center.entity.SysObjectiveQuestionsExample; import com.sztzjy.resource_center.entity.SysTopicAndCourse; @@ -122,14 +123,15 @@ public class TopicResourceController { return new ResultEntity<>(HttpStatus.OK, "添加成功!"); } + @AnonymousAccess @ApiOperation("条件查询") @PostMapping("selectTopicByConditions") //todo 关于老师删除的题库如何查询 private ResultEntity> selectTopicByConditions(@RequestParam Integer index, @RequestParam Integer size, - @RequestParam String oneID, - @RequestParam String twoID, - @RequestParam String threeID, - @ApiParam("题干") @RequestParam String content) { + @RequestParam(required = false) String oneID, + @RequestParam (required = false)String twoID, + @RequestParam (required = false)String threeID, + @ApiParam("题干") @RequestParam (required = false)String content) { PageHelper.startPage(index, size); List list = sysObjectiveQuestionMapper.selectTopicByConditions(oneID, twoID, threeID, content); PageInfo pageInfo = new PageInfo(list); diff --git a/src/main/java/com/sztzjy/resource_center/entity/SysResource.java b/src/main/java/com/sztzjy/resource_center/entity/SysResource.java index 6f88192..a55b0e9 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/SysResource.java +++ b/src/main/java/com/sztzjy/resource_center/entity/SysResource.java @@ -29,14 +29,20 @@ public class SysResource { private String source; @ApiModelProperty("一级目录标签") - private String ontTag; + private String oneTag; + + private String oneName; @ApiModelProperty("二级目录标签") private String twoTag; + private String twoName; + @ApiModelProperty("三级目录标签") private String threeTag; + private String threeName; + @ApiModelProperty("启用状态 1已启用 0未启用") private Integer status; @@ -91,12 +97,20 @@ public class SysResource { this.source = source == null ? null : source.trim(); } - public String getOntTag() { - return ontTag; + public String getOneTag() { + return oneTag; + } + + public void setOneTag(String oneTag) { + this.oneTag = oneTag == null ? null : oneTag.trim(); + } + + public String getOneName() { + return oneName; } - public void setOntTag(String ontTag) { - this.ontTag = ontTag == null ? null : ontTag.trim(); + public void setOneName(String oneName) { + this.oneName = oneName == null ? null : oneName.trim(); } public String getTwoTag() { @@ -107,6 +121,14 @@ public class SysResource { this.twoTag = twoTag == null ? null : twoTag.trim(); } + public String getTwoName() { + return twoName; + } + + public void setTwoName(String twoName) { + this.twoName = twoName == null ? null : twoName.trim(); + } + public String getThreeTag() { return threeTag; } @@ -115,6 +137,14 @@ public class SysResource { this.threeTag = threeTag == null ? null : threeTag.trim(); } + public String getThreeName() { + return threeName; + } + + public void setThreeName(String threeName) { + this.threeName = threeName == null ? null : threeName.trim(); + } + public Integer getStatus() { return status; } diff --git a/src/main/java/com/sztzjy/resource_center/entity/SysResourceExample.java b/src/main/java/com/sztzjy/resource_center/entity/SysResourceExample.java index 849740e..27c29e3 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/SysResourceExample.java +++ b/src/main/java/com/sztzjy/resource_center/entity/SysResourceExample.java @@ -525,73 +525,143 @@ public class SysResourceExample { return (Criteria) this; } - public Criteria andOntTagIsNull() { - addCriterion("ont_tag is null"); + public Criteria andOneTagIsNull() { + addCriterion("one_tag is null"); return (Criteria) this; } - public Criteria andOntTagIsNotNull() { - addCriterion("ont_tag is not null"); + public Criteria andOneTagIsNotNull() { + addCriterion("one_tag is not null"); return (Criteria) this; } - public Criteria andOntTagEqualTo(String value) { - addCriterion("ont_tag =", value, "ontTag"); + public Criteria andOneTagEqualTo(String value) { + addCriterion("one_tag =", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagNotEqualTo(String value) { - addCriterion("ont_tag <>", value, "ontTag"); + public Criteria andOneTagNotEqualTo(String value) { + addCriterion("one_tag <>", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagGreaterThan(String value) { - addCriterion("ont_tag >", value, "ontTag"); + public Criteria andOneTagGreaterThan(String value) { + addCriterion("one_tag >", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagGreaterThanOrEqualTo(String value) { - addCriterion("ont_tag >=", value, "ontTag"); + public Criteria andOneTagGreaterThanOrEqualTo(String value) { + addCriterion("one_tag >=", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagLessThan(String value) { - addCriterion("ont_tag <", value, "ontTag"); + public Criteria andOneTagLessThan(String value) { + addCriterion("one_tag <", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagLessThanOrEqualTo(String value) { - addCriterion("ont_tag <=", value, "ontTag"); + public Criteria andOneTagLessThanOrEqualTo(String value) { + addCriterion("one_tag <=", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagLike(String value) { - addCriterion("ont_tag like", value, "ontTag"); + public Criteria andOneTagLike(String value) { + addCriterion("one_tag like", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagNotLike(String value) { - addCriterion("ont_tag not like", value, "ontTag"); + public Criteria andOneTagNotLike(String value) { + addCriterion("one_tag not like", value, "oneTag"); return (Criteria) this; } - public Criteria andOntTagIn(List values) { - addCriterion("ont_tag in", values, "ontTag"); + public Criteria andOneTagIn(List values) { + addCriterion("one_tag in", values, "oneTag"); return (Criteria) this; } - public Criteria andOntTagNotIn(List values) { - addCriterion("ont_tag not in", values, "ontTag"); + public Criteria andOneTagNotIn(List values) { + addCriterion("one_tag not in", values, "oneTag"); return (Criteria) this; } - public Criteria andOntTagBetween(String value1, String value2) { - addCriterion("ont_tag between", value1, value2, "ontTag"); + public Criteria andOneTagBetween(String value1, String value2) { + addCriterion("one_tag between", value1, value2, "oneTag"); return (Criteria) this; } - public Criteria andOntTagNotBetween(String value1, String value2) { - addCriterion("ont_tag not between", value1, value2, "ontTag"); + public Criteria andOneTagNotBetween(String value1, String value2) { + addCriterion("one_tag not between", value1, value2, "oneTag"); + return (Criteria) this; + } + + public Criteria andOneNameIsNull() { + addCriterion("one_name is null"); + return (Criteria) this; + } + + public Criteria andOneNameIsNotNull() { + addCriterion("one_name is not null"); + return (Criteria) this; + } + + public Criteria andOneNameEqualTo(String value) { + addCriterion("one_name =", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameNotEqualTo(String value) { + addCriterion("one_name <>", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameGreaterThan(String value) { + addCriterion("one_name >", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameGreaterThanOrEqualTo(String value) { + addCriterion("one_name >=", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameLessThan(String value) { + addCriterion("one_name <", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameLessThanOrEqualTo(String value) { + addCriterion("one_name <=", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameLike(String value) { + addCriterion("one_name like", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameNotLike(String value) { + addCriterion("one_name not like", value, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameIn(List values) { + addCriterion("one_name in", values, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameNotIn(List values) { + addCriterion("one_name not in", values, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameBetween(String value1, String value2) { + addCriterion("one_name between", value1, value2, "oneName"); + return (Criteria) this; + } + + public Criteria andOneNameNotBetween(String value1, String value2) { + addCriterion("one_name not between", value1, value2, "oneName"); return (Criteria) this; } @@ -665,6 +735,76 @@ public class SysResourceExample { return (Criteria) this; } + public Criteria andTwoNameIsNull() { + addCriterion("two_name is null"); + return (Criteria) this; + } + + public Criteria andTwoNameIsNotNull() { + addCriterion("two_name is not null"); + return (Criteria) this; + } + + public Criteria andTwoNameEqualTo(String value) { + addCriterion("two_name =", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameNotEqualTo(String value) { + addCriterion("two_name <>", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameGreaterThan(String value) { + addCriterion("two_name >", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameGreaterThanOrEqualTo(String value) { + addCriterion("two_name >=", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameLessThan(String value) { + addCriterion("two_name <", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameLessThanOrEqualTo(String value) { + addCriterion("two_name <=", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameLike(String value) { + addCriterion("two_name like", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameNotLike(String value) { + addCriterion("two_name not like", value, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameIn(List values) { + addCriterion("two_name in", values, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameNotIn(List values) { + addCriterion("two_name not in", values, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameBetween(String value1, String value2) { + addCriterion("two_name between", value1, value2, "twoName"); + return (Criteria) this; + } + + public Criteria andTwoNameNotBetween(String value1, String value2) { + addCriterion("two_name not between", value1, value2, "twoName"); + return (Criteria) this; + } + public Criteria andThreeTagIsNull() { addCriterion("three_tag is null"); return (Criteria) this; @@ -735,6 +875,76 @@ public class SysResourceExample { return (Criteria) this; } + public Criteria andThreeNameIsNull() { + addCriterion("three_name is null"); + return (Criteria) this; + } + + public Criteria andThreeNameIsNotNull() { + addCriterion("three_name is not null"); + return (Criteria) this; + } + + public Criteria andThreeNameEqualTo(String value) { + addCriterion("three_name =", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameNotEqualTo(String value) { + addCriterion("three_name <>", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameGreaterThan(String value) { + addCriterion("three_name >", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameGreaterThanOrEqualTo(String value) { + addCriterion("three_name >=", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameLessThan(String value) { + addCriterion("three_name <", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameLessThanOrEqualTo(String value) { + addCriterion("three_name <=", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameLike(String value) { + addCriterion("three_name like", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameNotLike(String value) { + addCriterion("three_name not like", value, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameIn(List values) { + addCriterion("three_name in", values, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameNotIn(List values) { + addCriterion("three_name not in", values, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameBetween(String value1, String value2) { + addCriterion("three_name between", value1, value2, "threeName"); + return (Criteria) this; + } + + public Criteria andThreeNameNotBetween(String value1, String value2) { + addCriterion("three_name not between", value1, value2, "threeName"); + return (Criteria) this; + } + public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; diff --git a/src/main/java/com/sztzjy/resource_center/entity/dto/SysResourceDto.java b/src/main/java/com/sztzjy/resource_center/entity/dto/SysResourceDto.java index cd0e450..2974f4d 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/dto/SysResourceDto.java +++ b/src/main/java/com/sztzjy/resource_center/entity/dto/SysResourceDto.java @@ -57,7 +57,6 @@ public class SysResourceDto { @ApiModelProperty("资源文件") private MultipartFile file; - @ApiModelProperty("封面图片") private MultipartFile pictureUrl; } diff --git a/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java index 853aa18..1103cb7 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java @@ -4,7 +4,6 @@ import com.sztzjy.resource_center.entity.SysResource; import com.sztzjy.resource_center.entity.SysResourceExample; import java.util.List; -import com.sztzjy.resource_center.entity.dto.SysResourceDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @Mapper @@ -31,8 +30,9 @@ public interface SysResourceMapper { int updateByPrimaryKey(SysResource record); + List selectResource(@Param("oneId") String oneId, - @Param("twoId") String twoId, - @Param("threeId") String threeId, - @Param("resourceName") String resourceName); + @Param("twoId") String twoId, + @Param("threeId") String threeId, + @Param("resourceName") String resourceName); } \ No newline at end of file diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index abe71aa..560192a 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -45,14 +45,14 @@ - - + +
-
+ -
+ diff --git a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml index fa00dce..4cb7954 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml @@ -396,19 +396,19 @@ JOIN sys_topic_and_course st on sb.objective_id = st.topic_id - - one_id = #{oneID} + + sb.one_id = #{oneID} - - and two_id = #{twoID} + + and sb.two_id = #{twoID} - - and three_id = #{threeId} + + and sb.three_id = #{threeID} - and content = #{content} + and sb.content = #{content} - > - order by create_time + + order by sb.create_time \ No newline at end of file diff --git a/src/main/resources/mapper/SysResourceMapper.xml b/src/main/resources/mapper/SysResourceMapper.xml index cc52597..dcf15e2 100644 --- a/src/main/resources/mapper/SysResourceMapper.xml +++ b/src/main/resources/mapper/SysResourceMapper.xml @@ -8,9 +8,12 @@ - + + + + @@ -73,8 +76,8 @@ - resource_id, resource_name, url, picture_url, resource_type, source, ont_tag, two_tag, - three_tag, status, create_time + resource_id, resource_name, url, picture_url, resource_type, source, one_tag, one_name, + two_tag, two_name, three_tag, three_name, status, create_time SELECT * FROM sys_resource + join ont_tag = #{oneId}