Merge remote-tracking branch 'origin/master'

master
chenjinghao 8 months ago
commit 0791a43e64
  1. 34
      pom.xml
  2. 239
      sql/teaching2.0.sql
  3. 322
      sql/teaching_db.sql
  4. 5
      src/main/java/com/teaching/TeachingBackendApplication.java
  5. 34
      src/main/java/com/teaching/backend/common/BaseResponse.java
  6. 46
      src/main/java/com/teaching/backend/common/ErrorCode.java
  7. 32
      src/main/java/com/teaching/backend/common/PageRequest.java
  8. 52
      src/main/java/com/teaching/backend/common/ResultUtils.java
  9. 9
      src/main/java/com/teaching/backend/common/test1.java
  10. 29
      src/main/java/com/teaching/backend/config/MyBatisPlusConfig.java
  11. 18
      src/main/java/com/teaching/backend/constant/CommonConstant.java
  12. 20
      src/main/java/com/teaching/backend/controller/ChapterController.java
  13. 151
      src/main/java/com/teaching/backend/controller/CommonController.java
  14. 21
      src/main/java/com/teaching/backend/controller/UserController.java
  15. 66
      src/main/java/com/teaching/backend/controller/WordController.java
  16. 28
      src/main/java/com/teaching/backend/controller/chapter/ChapterController.java
  17. 78
      src/main/java/com/teaching/backend/controller/courses/CourseObjectivesController.java
  18. 97
      src/main/java/com/teaching/backend/controller/courses/CoursesController.java
  19. 50
      src/main/java/com/teaching/backend/controller/courses/ObjectiveContentsController.java
  20. 69
      src/main/java/com/teaching/backend/controller/courses/ObjectivesTypeController.java
  21. 138
      src/main/java/com/teaching/backend/controller/favour/SeCourseFavourController.java
  22. 50
      src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java
  23. 51
      src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java
  24. 87
      src/main/java/com/teaching/backend/controller/thumb/SeCourseThumbController.java
  25. 49
      src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java
  26. 49
      src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java
  27. 37
      src/main/java/com/teaching/backend/exception/BusinessException.java
  28. 45
      src/main/java/com/teaching/backend/exception/GlobalExceptionHandler.java
  29. 9
      src/main/java/com/teaching/backend/exception/test1.java
  30. 16
      src/main/java/com/teaching/backend/mapper/ChapterMapper.java
  31. 18
      src/main/java/com/teaching/backend/mapper/FileTableMapper.java
  32. 18
      src/main/java/com/teaching/backend/mapper/UserMapper.java
  33. 17
      src/main/java/com/teaching/backend/mapper/chapter/ChapterMapper.java
  34. 5
      src/main/java/com/teaching/backend/mapper/chapter/ChapterMapper.xml
  35. 20
      src/main/java/com/teaching/backend/mapper/courses/CourseObjectivesMapper.java
  36. 24
      src/main/java/com/teaching/backend/mapper/courses/CoursesMapper.java
  37. 16
      src/main/java/com/teaching/backend/mapper/courses/ObjectiveContentsMapper.java
  38. 17
      src/main/java/com/teaching/backend/mapper/courses/ObjectivesTypeMapper.java
  39. 15
      src/main/java/com/teaching/backend/mapper/favour/SeCourseFavourMapper.java
  40. 16
      src/main/java/com/teaching/backend/mapper/favour/SeKnowFavourMapper.java
  41. 17
      src/main/java/com/teaching/backend/mapper/favour/SeResourceFavourMapper.java
  42. 9
      src/main/java/com/teaching/backend/mapper/test1.java
  43. 15
      src/main/java/com/teaching/backend/mapper/thumb/SeCourseThumbMapper.java
  44. 16
      src/main/java/com/teaching/backend/mapper/thumb/SeKnowThumbMapper.java
  45. 17
      src/main/java/com/teaching/backend/mapper/thumb/SeResourceThumbMapper.java
  46. 41
      src/main/java/com/teaching/backend/model/dto/courses/CourseObjectivesDTO.java
  47. 100
      src/main/java/com/teaching/backend/model/dto/courses/CoursesDTO.java
  48. 60
      src/main/java/com/teaching/backend/model/dto/courses/PageDTO.java
  49. 24
      src/main/java/com/teaching/backend/model/dto/favour/courseFavour/CourseFavourAddRequest.java
  50. 20
      src/main/java/com/teaching/backend/model/dto/favour/courseFavour/CourseFavourAllRequest.java
  51. 20
      src/main/java/com/teaching/backend/model/dto/favour/courseFavour/CourseFavourListRequest.java
  52. 22
      src/main/java/com/teaching/backend/model/dto/favour/courseFavour/CourseFavourQueryRequest.java
  53. 29
      src/main/java/com/teaching/backend/model/dto/favour/knowFavour/KnowFavourAddRequest.java
  54. 29
      src/main/java/com/teaching/backend/model/dto/favour/resourceFavour/ResourceFavourAddRequest.java
  55. 9
      src/main/java/com/teaching/backend/model/dto/test1.java
  56. 24
      src/main/java/com/teaching/backend/model/dto/thumb/coursethumb/CourseThumbAddRequest.java
  57. 20
      src/main/java/com/teaching/backend/model/dto/thumb/coursethumb/CourseThumbAllRequest.java
  58. 29
      src/main/java/com/teaching/backend/model/dto/thumb/knowthumb/KnowThumbAddRequest.java
  59. 29
      src/main/java/com/teaching/backend/model/dto/thumb/resourcethumb/ResourceThumbAddRequest.java
  60. 32
      src/main/java/com/teaching/backend/model/entity/FileTable.java
  61. 26
      src/main/java/com/teaching/backend/model/entity/User.java
  62. 118
      src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java
  63. 66
      src/main/java/com/teaching/backend/model/entity/courses/CourseObjectives.java
  64. 143
      src/main/java/com/teaching/backend/model/entity/courses/Courses.java
  65. 40
      src/main/java/com/teaching/backend/model/entity/courses/ObjectiveContents.java
  66. 38
      src/main/java/com/teaching/backend/model/entity/courses/ObjectivesType.java
  67. 35
      src/main/java/com/teaching/backend/model/entity/favour/SeCourseFavour.java
  68. 40
      src/main/java/com/teaching/backend/model/entity/favour/SeKnowFavour.java
  69. 40
      src/main/java/com/teaching/backend/model/entity/favour/SeResourceFavour.java
  70. 9
      src/main/java/com/teaching/backend/model/entity/test1.java
  71. 36
      src/main/java/com/teaching/backend/model/entity/thumb/SeCourseThumb.java
  72. 40
      src/main/java/com/teaching/backend/model/entity/thumb/SeKnowThumb.java
  73. 40
      src/main/java/com/teaching/backend/model/entity/thumb/SeResourceThumb.java
  74. 14
      src/main/java/com/teaching/backend/model/query/CourseQuery.java
  75. 44
      src/main/java/com/teaching/backend/model/query/PageQuery.java
  76. 9
      src/main/java/com/teaching/backend/model/test1.java
  77. 26
      src/main/java/com/teaching/backend/model/vo/CourseObjectivesTreeVO.java
  78. 60
      src/main/java/com/teaching/backend/model/vo/CoursesVO.java
  79. 72
      src/main/java/com/teaching/backend/model/vo/favour/CourseFavourDetailVO.java
  80. 25
      src/main/java/com/teaching/backend/service/FileTableService.java
  81. 16
      src/main/java/com/teaching/backend/service/IChapterService.java
  82. 16
      src/main/java/com/teaching/backend/service/UserService.java
  83. 13
      src/main/java/com/teaching/backend/service/chapter/IChapterService.java
  84. 40
      src/main/java/com/teaching/backend/service/courses/ICourseObjectivesService.java
  85. 34
      src/main/java/com/teaching/backend/service/courses/ICoursesService.java
  86. 18
      src/main/java/com/teaching/backend/service/courses/IObjectiveContentsService.java
  87. 16
      src/main/java/com/teaching/backend/service/courses/IObjectivesTypeService.java
  88. 69
      src/main/java/com/teaching/backend/service/favour/SeCourseFavourService.java
  89. 22
      src/main/java/com/teaching/backend/service/favour/SeKnowFavourService.java
  90. 22
      src/main/java/com/teaching/backend/service/favour/SeResourceFavourService.java
  91. 20
      src/main/java/com/teaching/backend/service/impl/ChapterServiceImpl.java
  92. 106
      src/main/java/com/teaching/backend/service/impl/FileTableServiceImpl.java
  93. 24
      src/main/java/com/teaching/backend/service/impl/UserServiceImpl.java
  94. 17
      src/main/java/com/teaching/backend/service/impl/chapter/ChapterServiceImpl.java
  95. 182
      src/main/java/com/teaching/backend/service/impl/courses/CourseObjectivesServiceImpl.java
  96. 176
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  97. 21
      src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentsServiceImpl.java
  98. 20
      src/main/java/com/teaching/backend/service/impl/courses/ObjectivesTypeServiceImpl.java
  99. 162
      src/main/java/com/teaching/backend/service/impl/favour/SeCourseFavourServiceImpl.java
  100. 64
      src/main/java/com/teaching/backend/service/impl/favour/SeKnowFavourServiceImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -29,6 +29,13 @@
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<!-- freemarker jar -->
<dependency>
<groupId>org.freemarker</groupId>
@ -41,6 +48,7 @@
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
<dependency>
<groupId>com.baomidou</groupId>
@ -48,6 +56,13 @@
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.15.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
@ -63,6 +78,25 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://doc.xiaominfo.com/docs/quick-start#openapi2 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.11</version>
</dependency>
</dependencies>

@ -0,0 +1,239 @@
/*
SQLyog Ultimate v12.09 (64 bit)
MySQL - 8.0.12 : Database - teaching_db
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`teaching_db` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `teaching_db`;
/*Table structure for table `course_objectives` */
DROP TABLE IF EXISTS `course_objectives`;
CREATE TABLE `course_objectives` (
`id` varchar(36) NOT NULL COMMENT '内部编号',
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_time` datetime DEFAULT NULL COMMENT '更新日期',
`pid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '父级节点 默认0没有',
`has_child` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '是否有子节点 添加子节点变1,默认0没有',
`name` varchar(200) DEFAULT NULL COMMENT '目标名称',
`type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '目标类型',
`course_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程id',
`requireid` varchar(32) DEFAULT NULL COMMENT '毕业要求id',
`temp` text COMMENT '毕业要求',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `course_objectives` */
insert into `course_objectives`(`id`,`create_time`,`update_time`,`pid`,`has_child`,`name`,`type`,`course_id`,`requireid`,`temp`) values ('3e42492c201d2a9378be5af2edc92b47','2024-06-06 16:17:39',NULL,'0','0','近代史纲要课程总体目标',NULL,'d8d7bb93f100164659cac44ef2c4f55a',NULL,NULL),('43f2c4b4a10a47784e50e772b9d10457','2024-05-31 17:39:13',NULL,'0','0','测试课程课程总体目标',NULL,'6f5de6dd8c8d5d9d02a63c8444b9d5bb',NULL,NULL),('503dc084653ffd003cb404b62266dc7c','2024-06-06 15:58:43',NULL,'da6e7283befa8965dae0f0f39ea7f24e','0','知识目标','c126ef1a66733ab7a4ba12aba0eb7f82',NULL,NULL,NULL),('53b27c94fe8af02ac8b23d9be9a2e329','2024-06-03 11:32:19',NULL,'da6e7283befa8965dae0f0f39ea7f24e','0','思政目标','71f73bd999f678bcbbdb101e23277feb',NULL,NULL,NULL),('7a302cd72d653647778840b42f4e076a','2024-06-03 10:43:13',NULL,'0','0','软件构造课程总体目标',NULL,'ee2447b4463a5ad3f47e1744d912a824',NULL,NULL),('aa839ff1345a04f95b4efcca02494cab','2024-06-06 16:45:22',NULL,'0','0','毛概课程总体目标',NULL,'72e1ad71bb855ba328f8c17964697354',NULL,NULL),('b41fa8332f39cca11d35635bd9fac720','2024-05-31 11:24:33',NULL,'0','0','计算机导论课程总体目标',NULL,'2fa0fd63262230639d2c45a3acd9045c',NULL,NULL),('c84dc451086f7938c28a4f757957f415','2024-06-06 15:58:19',NULL,'da6e7283befa8965dae0f0f39ea7f24e','0','价值目标','410fc58cd757cd248941af1bea6888e5',NULL,NULL,NULL),('d452f583115465d067a1719458690b95','2024-05-31 11:16:37',NULL,'0','0','计算机组成原理总体目标',NULL,'36c34a4225526dd20ee3840da61d3701',NULL,NULL),('da6e7283befa8965dae0f0f39ea7f24e','2024-05-31 20:49:52','2024-06-06 15:58:43','0','1','离散数学及其应用课程总体目标',NULL,'de3100cad98f76be3176dd39aa748a9e',NULL,NULL);
/*Table structure for table `courses` */
DROP TABLE IF EXISTS `courses`;
CREATE TABLE `courses` (
`id` varchar(36) NOT NULL COMMENT '内部编号',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`img` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程封面',
`category` varchar(50) DEFAULT NULL COMMENT '课程类别',
`nature` varchar(50) DEFAULT NULL COMMENT '课程性质',
`name` varchar(100) DEFAULT NULL COMMENT '课程名称',
`code` varchar(50) DEFAULT NULL COMMENT '课程编码',
`semester` varchar(50) DEFAULT NULL COMMENT '开课学期',
`credit` decimal(5,2) DEFAULT NULL COMMENT '课程学分',
`classhours` int(11) DEFAULT NULL COMMENT '课程学时',
`theoryhours` int(11) DEFAULT NULL COMMENT '理论学时',
`practicehours` int(11) DEFAULT NULL COMMENT '实践学时',
`experimenthours` int(11) DEFAULT NULL COMMENT '实验学时',
`otherhours` int(11) DEFAULT NULL COMMENT '其他学时',
`weeks` int(11) DEFAULT NULL COMMENT '上课周数',
`assessmenttype` varchar(32) DEFAULT NULL COMMENT '考核类型',
`assessmentway` varchar(32) DEFAULT NULL COMMENT '考核方式',
`teacher` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '负责教师',
`teachermethod` text COMMENT '教学方法',
`teacherway` text COMMENT '教学方式',
`description` text COMMENT '课程简介',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `courses` */
insert into `courses`(`id`,`create_time`,`update_time`,`img`,`category`,`nature`,`name`,`code`,`semester`,`credit`,`classhours`,`theoryhours`,`practicehours`,`experimenthours`,`otherhours`,`weeks`,`assessmenttype`,`assessmentway`,`teacher`,`teachermethod`,`teacherway`,`description`) values ('2fa0fd63262230639d2c45a3acd9045c','2024-05-30 20:58:34',NULL,'','1','1','计算机导论12','111007',NULL,'4.50',64,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110339','暂定','线下授课',NULL),('36c34a4225526dd20ee3840da61d3701','2024-05-28 20:58:36',NULL,'','1','1','计算机组成原理','111006',NULL,'4.00',64,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110339','暂定','线下授课',NULL),('6f5de6dd8c8d5d9d02a63c8444b9d5bb','2024-05-26 20:58:40',NULL,'','1','1','测试课程','111008',NULL,'4.00',64,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110339','暂定','线下授课',NULL),('72e1ad71bb855ba328f8c17964697354','2024-06-06 16:45:22',NULL,'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/KdxGCt8rKbruw3zEDTdkA.jpg','1','1','毛概','111012',NULL,'3.60',48,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL),('8721e6864387eb99b04692f125ac0a9f','2024-05-27 20:58:43',NULL,'','1','1','SQLServer数据库教程','111004',NULL,'4.00',0,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110327','暂定111','线下机房授课',NULL),('90ce365ae4e362f616776550e04ae0b4','2024-05-24 20:58:48',NULL,'','1','1','JavaEE','111002',NULL,'4.00',0,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110327','暂定','线下机房授课',NULL),('a2ba84374d86e85208c5906a96ea8205','2024-05-24 20:58:48',NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','1','1','JavaWeb','111003',NULL,'4.00',0,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110327','暂定','线下机房授课',NULL),('d511d26df8de551bc85ce765089771b4','2024-05-24 20:58:48',NULL,'','1','1','高级编程','111001',NULL,'4.00',0,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110327','暂定','线下机房授课',NULL),('d8d7bb93f100164659cac44ef2c4f55a','2024-06-06 16:17:39',NULL,'','1','1','近代史纲要','111011',NULL,'2.60',48,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL),('de3100cad98f76be3176dd39aa748a9e','2024-05-31 20:49:52',NULL,'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/E96JlmbPeqvzVcPvg43Lb.jpg','1','1','离散数学及其应用','111009',NULL,'2.00',64,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL);
/*Table structure for table `filetable` */
DROP TABLE IF EXISTS `filetable`;
CREATE TABLE `filetable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `filetable` */
insert into `filetable`(`id`,`course_id`,`file_name`,`file_path`) values (1,'1','1f88e9df6f0b4412b0eb067ad057adb5.mp4','video/1f88e9df6f0b4412b0eb067ad057adb5.mp4'),(2,'2','bda16852b6944ae08cfcc70597f8dbb6.md','others/bda16852b6944ae08cfcc70597f8dbb6.md'),(3,'3','4c0dbc0ad84344bc8ba3431346cc7078.md','others/4c0dbc0ad84344bc8ba3431346cc7078.md');
/*Table structure for table `objective_contents` */
DROP TABLE IF EXISTS `objective_contents`;
CREATE TABLE `objective_contents` (
`id` varchar(32) NOT NULL,
`objective_id` varchar(32) DEFAULT NULL COMMENT '对应的目标id',
`content` text COMMENT '内容',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `objective_contents` */
insert into `objective_contents`(`id`,`objective_id`,`content`) values ('3f85eb79c29be4a15c729d98b17676a5','c84dc451086f7938c28a4f757957f415','价值目标3'),('406c85c99bd2d4b9f624ca3a67c3ce66','53b27c94fe8af02ac8b23d9be9a2e329','思政目标2'),('4ad5a1f0f584e35e7af6ef5142773990','503dc084653ffd003cb404b62266dc7c','知识目标1'),('4b4458cd64b0a1e21b54191a89e9f83d','c84dc451086f7938c28a4f757957f415','价值目标2'),('53d9d78b41051696314c0b1c0efa5313','503dc084653ffd003cb404b62266dc7c','知识目标3'),('6689ed187bcbd36309510a21ea492225','da6e7283befa8965dae0f0f39ea7f24e','总目标3'),('979e59083e81f28145e1162069ffebb8','c84dc451086f7938c28a4f757957f415','价值目标1'),('9efcc83089e6de9945499876d1a6235a','da6e7283befa8965dae0f0f39ea7f24e','总目标1'),('c6b3fc522a5479e28cd3f0c9b971a871','53b27c94fe8af02ac8b23d9be9a2e329','思政目标3'),('dc31075d57f371970c5af09fd534a9af','da6e7283befa8965dae0f0f39ea7f24e','总目标2'),('eca937e6f047e3b6b06d67c5b4a9beff','53b27c94fe8af02ac8b23d9be9a2e329','思政目标1'),('ffde482fac55e6dec5b60f6c6208d42c','503dc084653ffd003cb404b62266dc7c','知识目标2');
/*Table structure for table `objectives_type` */
DROP TABLE IF EXISTS `objectives_type`;
CREATE TABLE `objectives_type` (
`id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`type_name` varchar(50) DEFAULT NULL COMMENT '类型名称',
PRIMARY KEY (`id`),
UNIQUE KEY `type_name` (`type_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `objectives_type` */
insert into `objectives_type`(`id`,`type_name`) values ('410fc58cd757cd248941af1bea6888e5','价值目标'),('71f73bd999f678bcbbdb101e23277feb','思政目标'),('c126ef1a66733ab7a4ba12aba0eb7f82','知识目标'),('2350f69ef928cd2949e7fc05b05bd0c3','素质目标');
/*Table structure for table `se_course_favour` */
DROP TABLE IF EXISTS `se_course_favour`;
CREATE TABLE `se_course_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id',
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '课程id',
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_course_favour` */
insert into `se_course_favour`(`id`,`course_id`,`user_id`) values ('1796378327262564353','a2ba84374d86e85208c5906a96ea8205','2'),('1796454599099658242','36c34a4225526dd20ee3840da61d3701','2'),('1796789887730647041','2fa0fd63262230639d2c45a3acd9045c','2'),('1797497056650289154','d511d26df8de551bc85ce765089771b4','1'),('1797499380101767170','d511d26df8de551bc85ce765089771b4','2'),('1798221492412149761','d511d26df8de551bc85ce765089771b4','5'),('1798621775654993922','d511d26df8de551bc85ce765089771b4','8'),('1798632199670714369','de3100cad98f76be3176dd39aa748a9e','2');
/*Table structure for table `se_course_thumb` */
DROP TABLE IF EXISTS `se_course_thumb`;
CREATE TABLE `se_course_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_course_thumb` */
insert into `se_course_thumb`(`id`,`course_id`,`user_id`) values ('1796343958854623233','2','1'),('1796344002215337985','2','2'),('1796362250491191298','1','2'),('1796437673614974977','6','2'),('1796445964822847489','7','4');
/*Table structure for table `se_know_favour` */
DROP TABLE IF EXISTS `se_know_favour`;
CREATE TABLE `se_know_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`know_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_know_favour` */
insert into `se_know_favour`(`id`,`course_id`,`know_id`,`user_id`) values ('1796378889450295297','1','2','3');
/*Table structure for table `se_know_thumb` */
DROP TABLE IF EXISTS `se_know_thumb`;
CREATE TABLE `se_know_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`know_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_know_thumb` */
insert into `se_know_thumb`(`id`,`course_id`,`know_id`,`user_id`) values ('1796347057337982977','1','2','2'),('1796347303317135361','2','2','3'),('1796347343968329730','2','3','3'),('1796347380697849857','1','3','3');
/*Table structure for table `se_resource_favour` */
DROP TABLE IF EXISTS `se_resource_favour`;
CREATE TABLE `se_resource_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_resource_favour` */
insert into `se_resource_favour`(`id`,`course_id`,`resource_id`,`user_id`) values ('1796379012112715778','1','2','3');
/*Table structure for table `se_resource_thumb` */
DROP TABLE IF EXISTS `se_resource_thumb`;
CREATE TABLE `se_resource_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*Data for the table `se_resource_thumb` */
insert into `se_resource_thumb`(`id`,`course_id`,`resource_id`,`user_id`) values ('1796366535710904322','2','1','1');
/*Table structure for table `user` */
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`userAccount` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号',
`userPassword` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码',
`userName` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户昵称',
`userAvatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户头像',
`userRole` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user' COMMENT '用户角色:user/admin/ban',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`isDelete` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1793257199111405570 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='用户';
/*Data for the table `user` */
insert into `user`(`id`,`userAccount`,`userPassword`,`userName`,`userAvatar`,`userRole`,`createTime`,`updateTime`,`isDelete`) values (1793257199111405569,'youhang','84fccf8fe96cab775b23698a9c9b7eaa','游航',NULL,'admin','2024-05-22 20:26:48','2024-05-22 20:27:53',0);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

@ -0,0 +1,322 @@
/*
Navicat Premium Data Transfer
Source Server : localhost_3306
Source Server Type : MySQL
Source Server Version : 80037
Source Host : localhost:3306
Source Schema : teaching_db
Target Server Type : MySQL
Target Server Version : 80037
File Encoding : 65001
Date: 06/06/2024 17:36:05
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for course_objectives
-- ----------------------------
DROP TABLE IF EXISTS `course_objectives`;
CREATE TABLE `course_objectives`
(
`id` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '内部编号',
`create_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
`update_by` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '更新人',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新日期',
`pid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT '0' COMMENT '父级节点 默认0没有',
`has_child` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT '0' COMMENT '是否有子节点 添加子节点变1,默认0没有',
`name` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '目标名称',
`type` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '目标类型',
`content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '目标内容',
`courseid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程id',
`requireid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '毕业要求id',
`temp` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '毕业要求',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of course_objectives
-- ----------------------------
INSERT INTO `course_objectives`
VALUES ('43f2c4b4a10a47784e50e772b9d10457', '2140110334', '2024-05-31 17:39:13', NULL, NULL, '0', '0',
'测试课程课程总体目标', NULL, NULL, '6f5de6dd8c8d5d9d02a63c8444b9d5bb', NULL, NULL);
INSERT INTO `course_objectives`
VALUES ('7a302cd72d653647778840b42f4e076a', NULL, '2024-06-03 10:43:13', NULL, NULL, '0', '0', '软件构造课程总体目标',
NULL, NULL, 'ee2447b4463a5ad3f47e1744d912a824', NULL, NULL);
INSERT INTO `course_objectives`
VALUES ('b41fa8332f39cca11d35635bd9fac720', '2140110334', '2024-05-31 11:24:33', NULL, NULL, '0', '0',
'计算机导论课程总体目标', NULL, NULL, '2fa0fd63262230639d2c45a3acd9045c', NULL, NULL);
INSERT INTO `course_objectives`
VALUES ('d452f583115465d067a1719458690b95', '2140110334', '2024-05-31 11:16:37', NULL, NULL, '0', '0',
'计算机组成原理总体目标', NULL, NULL, '36c34a4225526dd20ee3840da61d3701', NULL, NULL);
INSERT INTO `course_objectives`
VALUES ('da6e7283befa8965dae0f0f39ea7f24e', NULL, '2024-05-31 20:49:52', NULL, NULL, '0', '1',
'离散数学及其应用课程总体目标', NULL, NULL, 'de3100cad98f76be3176dd39aa748a9e', NULL, NULL);
INSERT INTO `course_objectives`
VALUES ('e668f90e40d85e051381541b9d8436c3', NULL, '2024-05-31 20:49:52', NULL, '2024-06-03 09:51:31',
'da6e7283befa8965dae0f0f39ea7f24e', '1', '思政目标', '1', '阿巴阿巴2', 'de3100cad98f76be3176dd39aa748a9e', NULL,
NULL);
-- ----------------------------
-- Table structure for courses
-- ----------------------------
DROP TABLE IF EXISTS `courses`;
CREATE TABLE `courses`
(
`id` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '内部编号',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`img` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程封面',
`category` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程类别',
`nature` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程性质',
`name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程名称',
`code` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '课程编码',
`semester` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '开课学期',
`credit` decimal(5, 0) NULL DEFAULT NULL COMMENT '课程学分',
`classhours` int NULL DEFAULT NULL COMMENT '课程学时',
`theoryhours` int NULL DEFAULT NULL COMMENT '理论学时',
`practicehours` int NULL DEFAULT NULL COMMENT '实践学时',
`experimenthours` int NULL DEFAULT NULL COMMENT '实验学时',
`otherhours` int NULL DEFAULT NULL COMMENT '其他学时',
`weeks` int NULL DEFAULT NULL COMMENT '上课周数',
`assessmenttype` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '考核类型',
`assessmentway` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '考核方式',
`teacher` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '负责教师',
`teachermethod` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '教学方法',
`teacherway` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '教学方式',
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '课程简介',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of courses
-- ----------------------------
INSERT INTO `courses`
VALUES ('2fa0fd63262230639d2c45a3acd9045c', '2024-05-30 20:58:34', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1', '计算机导论',
'111007', NULL, 4, 64, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110339', '暂定', '线下授课',
NULL);
INSERT INTO `courses`
VALUES ('36c34a4225526dd20ee3840da61d3701', '2024-05-28 20:58:36', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1',
'计算机组成原理', '111006', NULL, 4, 64, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110339',
'暂定', '线下授课', NULL);
INSERT INTO `courses`
VALUES ('6f5de6dd8c8d5d9d02a63c8444b9d5bb', '2024-05-26 20:58:40', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1', '测试课程',
'111008', NULL, 4, 64, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110339', '暂定', '线下授课',
NULL);
INSERT INTO `courses`
VALUES ('8721e6864387eb99b04692f125ac0a9f', '2024-05-27 20:58:43', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1',
'SQLServer数据库教程', '111004', NULL, 4, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327',
'暂定111', '线下机房授课', NULL);
INSERT INTO `courses`
VALUES ('90ce365ae4e362f616776550e04ae0b4', '2024-05-24 20:58:48', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1', 'JavaEE',
'111002', NULL, 4, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327', '暂定', '线下机房授课',
NULL);
INSERT INTO `courses`
VALUES ('a2ba84374d86e85208c5906a96ea8205', '2024-05-24 20:58:48', NULL,
'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '1', '1', 'JavaWeb',
'111003', NULL, 4, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327', '暂定', '线下机房授课',
NULL);
INSERT INTO `courses`
VALUES ('d511d26df8de551bc85ce765089771b4', '2024-05-24 20:58:48', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1', '高级编程',
'111001', NULL, 4, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327', '暂定', '线下机房授课',
NULL);
INSERT INTO `courses`
VALUES ('de3100cad98f76be3176dd39aa748a9e', '2024-05-31 20:49:52', NULL,
'https://youhang.oss-cn-beijing.aliyuncs.com/5a117cf0-f76e-431a-932e-ac3693a710bd.jpg', '1', '1',
'离散数学及其应用', '111009', NULL, 2, 64, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334', '暂定',
'线下授课', NULL);
-- ----------------------------
-- Table structure for filetable
-- ----------------------------
DROP TABLE IF EXISTS `filetable`;
CREATE TABLE `filetable`
(
`id` int NOT NULL AUTO_INCREMENT,
`course_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of filetable
-- ----------------------------
INSERT INTO `filetable`
VALUES (1, '1', '1f88e9df6f0b4412b0eb067ad057adb5.mp4', 'video/1f88e9df6f0b4412b0eb067ad057adb5.mp4');
INSERT INTO `filetable`
VALUES (2, '2', 'bda16852b6944ae08cfcc70597f8dbb6.md', 'others/bda16852b6944ae08cfcc70597f8dbb6.md');
INSERT INTO `filetable`
VALUES (3, '3', '4c0dbc0ad84344bc8ba3431346cc7078.md', 'others/4c0dbc0ad84344bc8ba3431346cc7078.md');
-- ----------------------------
-- Table structure for se_course_favour
-- ----------------------------
DROP TABLE IF EXISTS `se_course_favour`;
CREATE TABLE `se_course_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id',
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '课程id',
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_course_favour
-- ----------------------------
INSERT INTO `se_course_favour`
VALUES ('1796378327262564353', 'a2ba84374d86e85208c5906a96ea8205', '2');
INSERT INTO `se_course_favour`
VALUES ('1796454599099658242', '36c34a4225526dd20ee3840da61d3701', '2');
INSERT INTO `se_course_favour`
VALUES ('1796789887730647041', '2fa0fd63262230639d2c45a3acd9045c', '2');
INSERT INTO `se_course_favour`
VALUES ('1797497056650289154', 'd511d26df8de551bc85ce765089771b4', '1');
INSERT INTO `se_course_favour`
VALUES ('1797499380101767170', 'd511d26df8de551bc85ce765089771b4', '2');
INSERT INTO `se_course_favour`
VALUES ('1798221492412149761', 'd511d26df8de551bc85ce765089771b4', '5');
INSERT INTO `se_course_favour`
VALUES ('1798621775654993922', 'd511d26df8de551bc85ce765089771b4', '8');
INSERT INTO `se_course_favour`
VALUES ('1798632199670714369', 'de3100cad98f76be3176dd39aa748a9e', '2');
-- ----------------------------
-- Table structure for se_course_thumb
-- ----------------------------
DROP TABLE IF EXISTS `se_course_thumb`;
CREATE TABLE `se_course_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_course_thumb
-- ----------------------------
INSERT INTO `se_course_thumb`
VALUES ('1796343958854623233', '2', '1');
INSERT INTO `se_course_thumb`
VALUES ('1796344002215337985', '2', '2');
INSERT INTO `se_course_thumb`
VALUES ('1796362250491191298', '1', '2');
INSERT INTO `se_course_thumb`
VALUES ('1796437673614974977', '6', '2');
INSERT INTO `se_course_thumb`
VALUES ('1796445964822847489', '7', '4');
-- ----------------------------
-- Table structure for se_know_favour
-- ----------------------------
DROP TABLE IF EXISTS `se_know_favour`;
CREATE TABLE `se_know_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`know_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_know_favour
-- ----------------------------
INSERT INTO `se_know_favour`
VALUES ('1796378889450295297', '1', '2', '3');
-- ----------------------------
-- Table structure for se_know_thumb
-- ----------------------------
DROP TABLE IF EXISTS `se_know_thumb`;
CREATE TABLE `se_know_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`know_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_know_thumb
-- ----------------------------
INSERT INTO `se_know_thumb`
VALUES ('1796347057337982977', '1', '2', '2');
INSERT INTO `se_know_thumb`
VALUES ('1796347303317135361', '2', '2', '3');
INSERT INTO `se_know_thumb`
VALUES ('1796347343968329730', '2', '3', '3');
INSERT INTO `se_know_thumb`
VALUES ('1796347380697849857', '1', '3', '3');
-- ----------------------------
-- Table structure for se_resource_favour
-- ----------------------------
DROP TABLE IF EXISTS `se_resource_favour`;
CREATE TABLE `se_resource_favour` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_resource_favour
-- ----------------------------
INSERT INTO `se_resource_favour`
VALUES ('1796379012112715778', '1', '2', '3');
-- ----------------------------
-- Table structure for se_resource_thumb
-- ----------------------------
DROP TABLE IF EXISTS `se_resource_thumb`;
CREATE TABLE `se_resource_thumb` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`course_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`resource_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of se_resource_thumb
-- ----------------------------
INSERT INTO `se_resource_thumb`
VALUES ('1796366535710904322', '2', '1', '1');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`userAccount` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号',
`userPassword` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码',
`userName` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户昵称',
`userAvatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户头像',
`userRole` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user' COMMENT '用户角色:user/admin/ban',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1793257199111405570 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user`
VALUES (1793257199111405569, 'youhang', '84fccf8fe96cab775b23698a9c9b7eaa', '游航', NULL, 'admin',
'2024-05-22 20:26:48', '2024-05-22 20:27:53', 0);
SET FOREIGN_KEY_CHECKS = 1;

@ -1,13 +1,18 @@
package com.teaching;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.teaching.backend.mapper")
public class TeachingBackendApplication {
public static void main(String[] args) {
SpringApplication.run(TeachingBackendApplication.class, args);
}
}

@ -0,0 +1,34 @@
package com.teaching.backend.common;
import lombok.Data;
import java.io.Serializable;
/**
* 通用返回类
*
* @param <T>
*/
@Data
public class BaseResponse<T> implements Serializable {
private int code;
private T data;
private String message;
public BaseResponse(int code, T data, String message) {
this.code = code;
this.data = data;
this.message = message;
}
public BaseResponse(int code, T data) {
this(code, data, "");
}
public BaseResponse(ErrorCode errorCode) {
this(errorCode.getCode(), null, errorCode.getMessage());
}
}

@ -0,0 +1,46 @@
package com.teaching.backend.common;
/**
* 自定义错误码
*
* @author <a href="https://github.com/liyh">程序员鱼皮</a>
* @from <a href="https://yh.icu">编程导航知识星球</a>
*/
public enum ErrorCode {
SUCCESS(200, "ok"),
PARAMS_ERROR(40000, "请求参数错误"),
NOT_LOGIN_ERROR(40100, "未登录"),
NO_AUTH_ERROR(40101, "无权限"),
NOT_FOUND_ERROR(40400, "请求数据不存在"),
CONTENT_EXISTS(41000, "内容存在"),
FORBIDDEN_ERROR(40300, "禁止访问"),
PARAMS_ILLEGAL(42000, "请求参数违法"),
SYSTEM_ERROR(50000, "系统内部异常"),
OPERATION_ERROR(50001, "操作失败");
/**
* 状态码
*/
private final int code;
/**
* 信息
*/
private final String message;
ErrorCode(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}

@ -0,0 +1,32 @@
package com.teaching.backend.common;
import com.teaching.backend.constant.CommonConstant;
import lombok.Data;
/**
* 分页请求
*/
@Data
public class PageRequest {
/**
* 当前页号
*/
private int current = 1;
/**
* 页面大小
*/
private int pageSize = 10;
/**
* 排序字段
*/
private String sortField;
/**
* 排序顺序默认升序
*/
private String sortOrder = CommonConstant.SORT_ORDER_ASC;
}

@ -0,0 +1,52 @@
package com.teaching.backend.common;
/**
* 返回工具类
*
* @author <a href="https://github.com/liyh">程序员鱼皮</a>
* @from <a href="https://yh.icu">编程导航知识星球</a>
*/
public class ResultUtils {
/**
* 成功
*
* @param data
* @param <T>
* @return
*/
public static <T> BaseResponse<T> success(T data) {
return new BaseResponse<>(200, data, "ok");
}
/**
* 失败
*
* @param errorCode
* @return
*/
public static BaseResponse error(ErrorCode errorCode) {
return new BaseResponse<>(errorCode);
}
/**
* 失败
*
* @param code
* @param message
* @return
*/
public static BaseResponse error(int code, String message) {
return new BaseResponse(code, null, message);
}
/**
* 失败
*
* @param errorCode
* @return
*/
public static BaseResponse error(ErrorCode errorCode, String message) {
return new BaseResponse(errorCode.getCode(), null, message);
}
}

@ -1,9 +0,0 @@
package com.teaching.backend.common;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,29 @@
package com.teaching.backend.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MyBatis Plus 配置
*/
@Configuration
@MapperScan("com.teaching.backend.mapper")
public class MyBatisPlusConfig {
/**
* 拦截器配置
*
* @return
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

@ -0,0 +1,18 @@
package com.teaching.backend.constant;
/**
* 通用常量
*/
public interface CommonConstant {
/**
* 升序
*/
String SORT_ORDER_ASC = "ascend";
/**
* 降序
*/
String SORT_ORDER_DESC = " descend";
}

@ -0,0 +1,20 @@
package com.teaching.backend.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author author
* @since 2024-06-07
*/
@RestController
@RequestMapping("/chapter")
public class ChapterController {
}

@ -0,0 +1,151 @@
package com.teaching.backend.controller;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.OSSObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.FileTable;
import com.teaching.backend.service.FileTableService;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.*;
import java.nio.file.Paths;
import java.util.Date;
import java.util.UUID;
/**
* ClassName: CommonController
* Package: com.teaching.backend.controller
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/1 10:30
* @Version 1.0
*/
@RestController
public class CommonController {
@Resource
private FileTableService fileTableService;
@Value("${aliyun.oss.endpoint}")
private String endpoint;
@Value("${aliyun.oss.accessKeyId}")
private String accessKeyId;
@Value("${aliyun.oss.accessKeySecret}")
private String accessKeySecret;
@Value("${aliyun.oss.bucketName}")
private String bucketName;
@PostMapping("/upload")
public BaseResponse<String> upload(@RequestParam("courseId") String courseId, MultipartFile file) throws IOException {
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
String originalFilename = file.getOriginalFilename();
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
String subDir;
if (suffix.equalsIgnoreCase(".jpg") || suffix.equalsIgnoreCase(".jpeg") || suffix.equalsIgnoreCase(".png")) {
subDir = "img/";
} else if (suffix.equalsIgnoreCase(".mp4") || suffix.equalsIgnoreCase(".avi") || suffix.equalsIgnoreCase(".mov")) {
subDir = "video/";
} else {
subDir = "others/";
}
String fileName = UUID.randomUUID().toString().replace("-", "") + suffix;
ossClient.putObject(bucketName, subDir + fileName, file.getInputStream());
String objectUrl = ossClient.generatePresignedUrl(bucketName, subDir + fileName, new Date(System.currentTimeMillis() + 3600 * 1000)).toString();
fileTableService.updateFile(courseId, fileName, objectUrl); // 更新文件路径为OSS生成的URL
ossClient.shutdown();
System.out.println("文件的地址是:" + objectUrl);
return ResultUtils.success(objectUrl);
}
//文件下载
@GetMapping("/download")
public BaseResponse<String> download(@RequestParam String courseId, @RequestParam String path, HttpServletResponse response) throws IOException {
System.out.println("执行了下载的方法");
FileTable fileTable = fileTableService.getById(courseId);
System.out.println(fileTable);
// 创建OSS客户端
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
String key = extractKeyFromFullPath(fileTable.getFilePath());
OSSObject object = ossClient.getObject(bucketName, key);
String fileName = fileTable.getFileName();
// 设置保存文件的路径
String savePath = path + "/" + fileName;
// 获取文件的输入流
InputStream inputStream = object.getObjectContent();
// 设置响应头
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
// 创建保存文件
File saveFile = new File(savePath);
// 将文件内容复制到保存文件中
FileUtils.copyInputStreamToFile(inputStream, saveFile);
// 关闭输入流和OSS客户端
inputStream.close();
ossClient.shutdown();
return ResultUtils.success("成功");
}
private String extractKeyFromFullPath(String filePath) {
// 提取存储桶名称
String key = filePath.substring(filePath.indexOf("com") + 4, filePath.indexOf("?"));
return key;
}
}

@ -1,21 +0,0 @@
package com.teaching.backend.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @Author:youhang
* @Date:2024-05-30-18:15
* @Description:
*/
@Controller
public class UserController {
@RequestMapping(value = "/1",method = RequestMethod.GET)
@ResponseBody
public String add(){
return "yh";
}
}

@ -0,0 +1,66 @@
package com.teaching.backend.controller;
import com.teaching.backend.utils.WordUtil;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
@RestController
public class WordController {
private String outputPath;
@PostMapping("/Word/get")
public ResponseEntity<byte[]> createWord(@RequestParam("outputPath") String outputPath) {
String filename = "generatedWord.docx";
System.out.println(outputPath);
WordUtil wordUtil = new WordUtil();
// 设置模板文件存放的目录
wordUtil.setBaseDir("C:\\Users\\jian\\Desktop\\123345\\");
// 设置模板文件名称
wordUtil.setTemplateFile("123.ftl");
// 设置 Word 生成的输出目录
wordUtil.setOutputDir(outputPath);
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("username1", "姜钧瀚");
String generatedFilePath = wordUtil.createWord(dataMap);
if (generatedFilePath.equals("操作失败")) {
System.out.println("操作失败");
return ResponseEntity.badRequest().body("操作失败".getBytes());
}
// 读取生成的 Word 文件内容
File file = new File(generatedFilePath);
byte[] fileContent;
try {
fileContent = Files.readAllBytes(file.toPath());
} catch (IOException e) {
e.printStackTrace();
return ResponseEntity.badRequest().body("文件读取失败".getBytes());
}
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", filename);
//返回word文件
return new ResponseEntity<>(fileContent, headers, HttpStatus.OK);
}
}

@ -0,0 +1,28 @@
package com.teaching.backend.controller.chapter;
import com.teaching.backend.service.chapter.IChapterService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* @author author
* @since 2024-05-31
*/
@Slf4j
@Api(tags = "章节管理")
@RestController
@RequestMapping("/chapter")
public class ChapterController {
@Autowired
private IChapterService chapterService;
}

@ -0,0 +1,78 @@
package com.teaching.backend.controller.courses;
import cn.hutool.core.bean.BeanUtil;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.courses.CourseObjectivesMapper;
import com.teaching.backend.model.dto.courses.CourseObjectivesDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.vo.CourseObjectivesTreeVO;
import com.teaching.backend.service.courses.ICourseObjectivesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author zjh
* @since 2024-05-31
*/
@Api(tags = "项目目标管理接口")
@RestController
@RequestMapping("/course_objectives")
public class CourseObjectivesController {
@Autowired
ICourseObjectivesService courseObjectivesService;
@Autowired
CourseObjectivesMapper courseObjectivesMapper;
@ApiOperation("新增分项目标-默认第一个必须添加思政目标")
@PostMapping("/addobjectives")
public BaseResponse<String> saveCourseObjectives(@RequestBody CourseObjectivesDTO courseObjectivesDTO){
String data = courseObjectivesService.addObjectives(courseObjectivesDTO);
return ResultUtils.success(data);
}
@ApiOperation("删除分项目标-只能最后一个删除思政目标")
@DeleteMapping("/{id}")
public BaseResponse<String> deleteCourseObjectivesByIds(@PathVariable String id){
String data = courseObjectivesService.deleteObjectives(id);
return ResultUtils.success(data);
}
/**
* 禁止修改课程编码和名称
* @param courseObjectivesDTO
* @return
*/
@ApiOperation("编辑分项目标")
@PutMapping
public BaseResponse<String> updateCourseObjectives(@RequestBody CourseObjectivesDTO courseObjectivesDTO){
String pid = courseObjectivesDTO.getPid();
CourseObjectives courseObjectives = courseObjectivesMapper.selectById(pid);
BeanUtil.copyProperties(courseObjectivesDTO, courseObjectives);
courseObjectives.setUpdateTime(LocalDateTime.now());
courseObjectivesService.updateById(courseObjectives);
return ResultUtils.success("编辑成功");
}
@ApiOperation("查询课程目标内容")
@GetMapping("/list/{id}")
public BaseResponse<List<CourseObjectivesTreeVO>> queryCourseObjectivesTree(@PathVariable String id){
List<CourseObjectivesTreeVO> courseObjectivesTreeVO = courseObjectivesService.queryCourseObjectivesTree(id);
return ResultUtils.success(courseObjectivesTreeVO);
}
}

@ -0,0 +1,97 @@
package com.teaching.backend.controller.courses;
import cn.hutool.core.bean.BeanUtil;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.query.CourseQuery;
import com.teaching.backend.model.vo.CoursesVO;
import com.teaching.backend.service.courses.ICoursesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author zjh
* @since 2024-05-30
*/
@Api(tags = "教师管理课程接口")
@RestController
@RequestMapping("/coursesteacher")
public class CoursesController {
@Autowired
ICoursesService coursesService;
@ApiOperation("网站首页")
@GetMapping("/index")
public BaseResponse<Map<String,Object>> getData(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize) {
List<CoursesVO> coursesVo = coursesService.getPagePageSize(page, pageSize);
long totalcount = coursesService.count();
long toatlPages = (int) Math.ceil((double)totalcount / pageSize);
Map<String,Object> objectMap = new HashMap<>();
objectMap.put("content",coursesVo);
objectMap.put("totalcount", totalcount);
objectMap.put("totalPages", toatlPages);
objectMap.put("currentPage", page);
return ResultUtils.success(objectMap);
}
@ApiOperation("新增课程--同步新增课程的总体目标")
@PostMapping("/addcourse")
public BaseResponse<String> saveCourse(@RequestBody CoursesDTO coursesDTO, @RequestParam String teacherId){
String data = coursesService.saveCourseWithObjective(coursesDTO, teacherId);
return ResultUtils.success(data);
}
@ApiOperation("查询课程列表")
@GetMapping("/page")
public BaseResponse<PageDTO<CoursesVO>> getCourses(CourseQuery courseQuery, @RequestParam String teacherId){
PageDTO<CoursesVO> coursesList = coursesService.queryCourses(courseQuery,teacherId);
return ResultUtils.success(coursesList);
}
@ApiOperation("根据id查询课程")
@GetMapping("/{id}")
public BaseResponse<CoursesDTO> getByIdCourse(@PathVariable String id){
Courses course = coursesService.getById(id);
CoursesDTO coursesDTO = new CoursesDTO();
BeanUtils.copyProperties(course,coursesDTO);
return ResultUtils.success(coursesDTO);
}
@ApiOperation("根据id修改课程")
@PutMapping
public BaseResponse<String> editCourse(@RequestBody CoursesDTO coursesDTO){
String courseId = coursesDTO.getId();
Courses course = coursesService.getById(courseId);
BeanUtil.copyProperties(coursesDTO, course);
coursesService.updateById(course);
return ResultUtils.success("编辑成功");
}
//TODO:删除功能暂未完善,数据表缺失
@ApiOperation("根据id删除课程")
@DeleteMapping("/{id}")
public BaseResponse deleteCourses(@PathVariable String id){
System.out.println(id);
coursesService.deleteBatchByIds(id);
// coursesService.removeBatchByIds(ids);
return ResultUtils.success("删除成功");
}
}

@ -0,0 +1,50 @@
package com.teaching.backend.controller.courses;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.service.courses.IObjectiveContentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@RestController
@RequestMapping("/objective_contents")
@Api(tags = "目标内容接口")
public class ObjectiveContentsController {
@Autowired
IObjectiveContentsService objectiveContentsService;
@ApiOperation("添加目标内容")
@PostMapping("/addcontent")
public BaseResponse<String> saveContent(@RequestBody ObjectiveContents objectiveContents){
objectiveContentsService.save(objectiveContents);
return ResultUtils.success("添加成功");
}
@ApiOperation("删除目标内容")
@DeleteMapping("/{id}")
public BaseResponse<String> deleteContent(@PathVariable String id){
objectiveContentsService.removeById(id);
return ResultUtils.success("删除成功");
}
@ApiOperation("修改目标内容")
@PutMapping("/update")
public BaseResponse<String> updateContent(@RequestBody ObjectiveContents objectiveContents){
objectiveContentsService.updateById(objectiveContents);
return ResultUtils.success("修改成功");
}
}

@ -0,0 +1,69 @@
package com.teaching.backend.controller.courses;
import cn.hutool.core.bean.BeanUtil;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.courses.ObjectivesType;
import com.teaching.backend.model.query.CourseQuery;
import com.teaching.backend.model.vo.CoursesVO;
import com.teaching.backend.service.courses.ICoursesService;
import com.teaching.backend.service.courses.IObjectivesTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@RestController
@RequestMapping("/objectives_type")
@Api(tags = "项目目标类型管理接口")
public class ObjectivesTypeController {
@Autowired
IObjectivesTypeService objectivesTypeService;
@ApiOperation("新增目标类型")
@PostMapping("/addobjectives")
public BaseResponse<String> saveObjectives(@RequestBody ObjectivesType objectivesType){
objectivesTypeService.save(objectivesType);
return ResultUtils.success("添加成功");
}
@ApiOperation("删除目标类型")
@DeleteMapping("/deleteobjectives/{id}")
public BaseResponse<String> deleteObjectives(@PathVariable String id){
objectivesTypeService.removeById(id);
return ResultUtils.success("删除成功");
}
@ApiOperation("修改目标类型")
@PutMapping
public BaseResponse<String> updateObjectives(@RequestBody ObjectivesType objectivesType){
objectivesTypeService.updateById(objectivesType);
return ResultUtils.success("修改成功");
}
@ApiOperation("列表显示目标类型")
@GetMapping("/list")
public BaseResponse<List<ObjectivesType>> ObjectivesList(){
List<ObjectivesType> list = objectivesTypeService.list();
return ResultUtils.success(list);
}
}

@ -0,0 +1,138 @@
package com.teaching.backend.controller.favour;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourAddRequest;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourAllRequest;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourListRequest;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourQueryRequest;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.favour.SeCourseFavour;
import com.teaching.backend.model.vo.CoursesVO;
import com.teaching.backend.model.vo.favour.CourseFavourDetailVO;
import com.teaching.backend.service.courses.ICoursesService;
import com.teaching.backend.service.favour.SeCourseFavourService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/course_favour")
@Slf4j
public class SeCourseFavourController {
@Resource
private SeCourseFavourService seCourseFavourService;
/**
* 点赞
*
* @param courseFavourAddRequest
* @return result 执行情况
*/
@PostMapping("/add")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody CourseFavourAddRequest courseFavourAddRequest) {
System.out.println(courseFavourAddRequest);
if (StringUtils.isAnyBlank(courseFavourAddRequest.getCourseId(), courseFavourAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在courseid , userid
Boolean result = seCourseFavourService.doCourseFavour(courseFavourAddRequest.getCourseId(), courseFavourAddRequest.getUserId());
return ResultUtils.success(result);
}
/**
* 课程点赞总数
*
* @param courseFavourAddRequest
* @return result 课程点赞总数
*/
@PostMapping("/count")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Long> favourCount(@RequestBody CourseFavourAddRequest courseFavourAddRequest) {
if (StringUtils.isAnyBlank(courseFavourAddRequest.getCourseId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
}
// todo 从数据库中校验是否存在courseid
Long result = seCourseFavourService.favourCount(courseFavourAddRequest.getCourseId());
return ResultUtils.success(result);
}
/**
* 课程下资源和知识点点赞总数
*
* @param courseFavourAllRequest
* @return result 课程下资源和知识点点赞总数
*/
@PostMapping("/countAll")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Long> courseCount(@RequestBody CourseFavourAllRequest courseFavourAllRequest) {
if (StringUtils.isAnyBlank(courseFavourAllRequest.getCourseId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
}
// todo 从数据库中校验是否存在courseid
Long result = seCourseFavourService.courseCount(courseFavourAllRequest.getCourseId());
return ResultUtils.success(result);
}
/**
* 某个用户课程列表
*
* @param courseFavourListRequest
* @return result 某个用户课程列表
*/
@PostMapping("/countList")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<List<String>> courseList(@RequestBody CourseFavourListRequest courseFavourListRequest) {
if (StringUtils.isAnyBlank(courseFavourListRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数-用户id不能为空");
}
// todo 从数据库中校验是否存在userid
List<String> result = seCourseFavourService.courseList(courseFavourListRequest.getUserId());
return ResultUtils.success(result);
}
/**
* 分页获取列表仅管理员
*
* @return
*/
@PostMapping("/list/page")
public BaseResponse<Page<CourseFavourDetailVO>> listPostByPage(@RequestBody CourseFavourQueryRequest courseFavourQueryRequest) {
long current = courseFavourQueryRequest.getCurrent();
long size = courseFavourQueryRequest.getPageSize();
String userId = courseFavourQueryRequest.getUserId();
List<String> ids = seCourseFavourService.courseList(userId);
QueryWrapper<Courses> courseQueryWrapper = new QueryWrapper<>();
courseQueryWrapper.in("id", ids);
Page<CourseFavourDetailVO> courseFavourDetailVOPage = seCourseFavourService.listCourseFavourByPage(new Page<>(current, size), courseQueryWrapper);
return ResultUtils.success(courseFavourDetailVOPage);
}
}

@ -0,0 +1,50 @@
package com.teaching.backend.controller.favour;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.favour.knowFavour.KnowFavourAddRequest;
import com.teaching.backend.service.favour.SeKnowFavourService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/know_favour")
@Slf4j
public class SeKnowFavourController {
@Resource
private SeKnowFavourService seKnowFavourService;
/**
* 点赞
*
* @param knowFavourAddRequest
* @return result 执行情况
*/
@PostMapping("/add")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody KnowFavourAddRequest knowFavourAddRequest) {
if (StringUtils.isAnyBlank(knowFavourAddRequest.getCourseId(), knowFavourAddRequest.getKnowId(), knowFavourAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在knowid , userid ,courseid
Boolean result = seKnowFavourService.doKnowFavour(knowFavourAddRequest.getCourseId(), knowFavourAddRequest.getKnowId(), knowFavourAddRequest.getUserId());
return ResultUtils.success(result);
}
}

@ -0,0 +1,51 @@
package com.teaching.backend.controller.favour;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.favour.resourceFavour.ResourceFavourAddRequest;
import com.teaching.backend.service.favour.SeResourceFavourService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/resource_favour")
@Slf4j
public class SeResourceFavourController {
@Resource
private SeResourceFavourService seResourceFavourService;
/**
* 收藏
*
* @param resourceFavourAddRequest
* @return result 执行情况
*/
@PostMapping("/add")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody ResourceFavourAddRequest resourceFavourAddRequest) {
if (StringUtils.isAnyBlank(resourceFavourAddRequest.getCourseId(), resourceFavourAddRequest.getResourceId(), resourceFavourAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在resourceid , userid ,courseid
Boolean result = seResourceFavourService.doResourceFavour(resourceFavourAddRequest.getCourseId(), resourceFavourAddRequest.getResourceId(), resourceFavourAddRequest.getUserId());
return ResultUtils.success(result);
}
}

@ -0,0 +1,87 @@
package com.teaching.backend.controller.thumb;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.thumb.coursethumb.CourseThumbAddRequest;
import com.teaching.backend.model.dto.thumb.coursethumb.CourseThumbAllRequest;
import com.teaching.backend.service.thumb.SeCourseThumbService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/course_thumb")
@Slf4j
public class SeCourseThumbController {
@Resource
private SeCourseThumbService seCourseThumbService;
/**
* 点赞/取消点赞
*
* @param courseThumbAddRequest
* @return result 执行情况
*/
@PostMapping("/")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody CourseThumbAddRequest courseThumbAddRequest) {
if (StringUtils.isAnyBlank(courseThumbAddRequest.getCourseId(), courseThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在courseid , userid 从课程表和用户表查询
Boolean result = seCourseThumbService.doCourseThumb(courseThumbAddRequest.getCourseId(), courseThumbAddRequest.getUserId());
return ResultUtils.success(result);
}
/**
* 课程点赞总数
*
* @param courseThumbAddRequest
* @return result 课程点赞总数
*/
@PostMapping("/count")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Long> thumbCount(@RequestBody CourseThumbAddRequest courseThumbAddRequest) {
if (StringUtils.isAnyBlank(courseThumbAddRequest.getCourseId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
}
// todo 从数据库中校验是否存在courseid
Long result = seCourseThumbService.thumbCount(courseThumbAddRequest.getCourseId());
return ResultUtils.success(result);
}
/**
* 课程下资源和知识点点赞总数
*
* @param courseThumbAllRequest
* @return result 课程下资源和知识点点赞总数
*/
@PostMapping("/countAll")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Long> courseCount(@RequestBody CourseThumbAllRequest courseThumbAllRequest) {
if (StringUtils.isAnyBlank(courseThumbAllRequest.getCourseId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
}
// todo 从数据库中校验是否存在courseid
Long result = seCourseThumbService.courseCount(courseThumbAllRequest.getCourseId());
return ResultUtils.success(result);
}
}

@ -0,0 +1,49 @@
package com.teaching.backend.controller.thumb;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.thumb.knowthumb.KnowThumbAddRequest;
import com.teaching.backend.service.thumb.SeKnowThumbService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/know_thumb")
@Slf4j
public class SeKnowThumbController {
@Resource
private SeKnowThumbService seKnowThumbService;
/**
* 点赞
*
* @param knowThumbAddRequest
* @return result 执行情况
*/
@PostMapping("/add")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody KnowThumbAddRequest knowThumbAddRequest) {
if (StringUtils.isAnyBlank(knowThumbAddRequest.getCourseId(), knowThumbAddRequest.getKnowId(), knowThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在knowid , userid ,courseid
Boolean result = seKnowThumbService.doKnowThumb(knowThumbAddRequest.getCourseId(), knowThumbAddRequest.getKnowId(), knowThumbAddRequest.getUserId());
return ResultUtils.success(result);
}
}

@ -0,0 +1,49 @@
package com.teaching.backend.controller.thumb;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.thumb.resourcethumb.ResourceThumbAddRequest;
import com.teaching.backend.service.thumb.SeResourceThumbService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
@RestController
@RequestMapping("/resource_thumb")
@Slf4j
public class SeResourceThumbController {
@Resource
private SeResourceThumbService seResourceThumbService;
/**
* 点赞
*
* @param resourceThumbAddRequest
* @return result 执行情况
*/
@PostMapping("/add")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody ResourceThumbAddRequest resourceThumbAddRequest) {
if (StringUtils.isAnyBlank(resourceThumbAddRequest.getCourseId(), resourceThumbAddRequest.getResourceId(), resourceThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
// todo 从数据库中校验是否存在resourceid , userid ,courseid
Boolean result = seResourceThumbService.doResourceThumb(resourceThumbAddRequest.getCourseId(), resourceThumbAddRequest.getResourceId(), resourceThumbAddRequest.getUserId());
return ResultUtils.success(result);
}
}

@ -0,0 +1,37 @@
package com.teaching.backend.exception;
import com.teaching.backend.common.ErrorCode;
/**
* 自定义异常类
*
* @author <a href="https://github.com/liyh">程序员鱼皮</a>
* @from <a href="https://yh.icu">编程导航知识星球</a>
*/
public class BusinessException extends RuntimeException {
/**
* 错误码
*/
private final int code;
public BusinessException(int code, String message) {
super(message);
this.code = code;
}
public BusinessException(ErrorCode errorCode) {
super(errorCode.getMessage());
this.code = errorCode.getCode();
}
public BusinessException(ErrorCode errorCode, String message) {
super(message);
this.code = errorCode.getCode();
}
public int getCode() {
return code;
}
}

@ -0,0 +1,45 @@
package com.teaching.backend.exception;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(BusinessException.class)
public ResponseEntity<ErrorResponse> handleBusinessException(BusinessException ex) {
ErrorResponse errorResponse = new ErrorResponse(ex.getCode(), ex.getMessage());
return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST);
}
// 其他异常处理器可以按需添加
public static class ErrorResponse {
private int code;
private String message;
public ErrorResponse(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
}

@ -1,9 +0,0 @@
package com.teaching.backend.exception;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,16 @@
package com.teaching.backend.mapper;
import com.teaching.backend.entity.Chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-06-07
*/
public interface ChapterMapper extends BaseMapper<Chapter> {
}

@ -0,0 +1,18 @@
package com.teaching.backend.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.FileTable;
import org.apache.ibatis.annotations.Mapper;
/**
* ClassName: FileTableMapper
* Package: com.teaching.backend.mapper
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/4 11:51
* @Version 1.0
*/
@Mapper
public interface FileTableMapper extends BaseMapper<FileTable> {
}

@ -0,0 +1,18 @@
package com.teaching.backend.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.User;
import org.apache.ibatis.annotations.Mapper;
/**
* ClassName: UserMapper
* Package: com.teaching.backend.mapper
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/3 17:47
* @Version 1.0
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.chapter.Chapter;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-05-31
*/
public interface ChapterMapper extends BaseMapper<Chapter> {
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.teaching.backend.mapper.ChapterMapper">
</mapper>

@ -0,0 +1,20 @@
package com.teaching.backend.mapper.courses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.vo.CourseObjectivesTreeVO;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zjh
* @since 2024-05-31
*/
public interface CourseObjectivesMapper extends BaseMapper<CourseObjectives> {
List<CourseObjectivesTreeVO> selectTreeNodes(String courseObjectivesId);
}

@ -0,0 +1,24 @@
package com.teaching.backend.mapper.courses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.courses.Courses;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zjh
* @since 2024-05-30
*/
@Mapper
public interface CoursesMapper extends BaseMapper<Courses> {
@Select("SELECT * FROM courses LIMIT #{start}, #{pageSize}")
List<Courses> getItemsByPage(@Param("start") int start, @Param("pageSize") int pageSize);
}

@ -0,0 +1,16 @@
package com.teaching.backend.mapper.courses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zjh
* @since 2024-06-05
*/
public interface ObjectiveContentsMapper extends BaseMapper<ObjectiveContents> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.courses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.courses.ObjectivesType;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zjh
* @since 2024-06-05
*/
public interface ObjectivesTypeMapper extends BaseMapper<ObjectivesType> {
}

@ -0,0 +1,15 @@
package com.teaching.backend.mapper.favour;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.favour.SeCourseFavour;
/**
* 课程点赞数据库操作
*/
public interface SeCourseFavourMapper extends BaseMapper<SeCourseFavour> {
}

@ -0,0 +1,16 @@
package com.teaching.backend.mapper.favour;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.favour.SeKnowFavour;
/**
* 知识点赞数据库操作
*/
public interface SeKnowFavourMapper extends BaseMapper<SeKnowFavour> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.favour;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.favour.SeResourceFavour;
/**
* 课程资源点赞数据库操作
*/
public interface SeResourceFavourMapper extends BaseMapper<SeResourceFavour> {
}

@ -1,9 +0,0 @@
package com.teaching.backend.mapper;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,15 @@
package com.teaching.backend.mapper.thumb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.thumb.SeCourseThumb;
/**
* 课程点赞数据库操作
*/
public interface SeCourseThumbMapper extends BaseMapper<SeCourseThumb> {
}

@ -0,0 +1,16 @@
package com.teaching.backend.mapper.thumb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.thumb.SeKnowThumb;
/**
* 知识点赞数据库操作
*/
public interface SeKnowThumbMapper extends BaseMapper<SeKnowThumb> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.thumb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.thumb.SeResourceThumb;
/**
* 课程资源点赞数据库操作
*/
public interface SeResourceThumbMapper extends BaseMapper<SeResourceThumb> {
}

@ -0,0 +1,41 @@
package com.teaching.backend.model.dto.courses;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel(description = "分项目标参数实体")
public class CourseObjectivesDTO implements Serializable {
/**
* 内部编号
*/
@ApiModelProperty("id")
private String id;
/**
* 分项目标名称
*/
@ApiModelProperty(value = "分项目标名称",required = true)
private String name;
/**
* 分项目标类型 思政 知识素质价值
*/
@ApiModelProperty(value = "分项目标类型",required = true)
private String type;
/**
* 父节点
*/
@ApiModelProperty(value = "父节点pid",required = true)
private String pid;
}

@ -0,0 +1,100 @@
package com.teaching.backend.model.dto.courses;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ApiModel(description = "教师创建课程参数实体")
public class CoursesDTO {
/**
* 内部编号
*/
@ApiModelProperty("id")
private String id;
/**
* 创建人 教师id
*/
@ApiModelProperty("负责教师")
private String teacher;
/**
* 创建日期
*/
@ApiModelProperty("创建日期")
private LocalDateTime createTime;
/**
* 课程封面
*/
@ApiModelProperty("图片")
private String img;
/**
* 课程类别 专业教育 通识教育
*/
@ApiModelProperty(value = "课程类别:专业教育1 通识教育2",required = true)
private String category;
/**
* 课程性质 必修选修任修
*/
@ApiModelProperty(value = "课程性质:必修1 选修2 任修3",required = true)
private String nature;
/**
* 课程名称
*/
@ApiModelProperty(value = "课程名称",required = true)
private String name;
/**
* 课程编码
*/
@ApiModelProperty(value = "课程编码",required = true)
private String code;
/**
* 课程学分
*/
@ApiModelProperty(value = "课程学分",required = true)
private BigDecimal credit;
/**
* 课程学时
*/
@ApiModelProperty(value = "课程学时",required = true)
private Integer classhours;
/**
* 考核类型 考试 考查
*/
@ApiModelProperty(value = "考核类型:考试1 考查2",required = true)
private String assessmenttype;
/**
* 考核方式 开卷 闭卷 其他
*/
@ApiModelProperty(value = "考核方式:开卷1 闭卷2 其他3",required = true)
private String assessmentway;
/**
* 教学方法
*/
@ApiModelProperty("教学方法")
private String teachermethod;
/**
* 教学方式
*/
@ApiModelProperty("教学方式")
private String teacherway;
/**
* 课程简介
*/
@ApiModelProperty("课程简介")
private String description;
}

@ -0,0 +1,60 @@
package com.teaching.backend.model.dto.courses;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
@Data
@ApiModel(description = "分页结果")
public class PageDTO<T> {
@ApiModelProperty("总条数")
private Long total;
@ApiModelProperty("总页数")
private Long pages;
@ApiModelProperty("集合")
private List<T> list;
public static <PO, VO> PageDTO<VO> of(Page<PO> p, Class<VO> clazz){
PageDTO<VO> dto = new PageDTO<>();
// 1.总条数
dto.setTotal(p.getTotal());
// 2.总页数
dto.setPages(p.getPages());
// 3.当前页数据
List<PO> records = p.getRecords();
if (CollUtil.isEmpty(records)) {
dto.setList(Collections.emptyList());
return dto;
}
// 4.拷贝user的VO
dto.setList(BeanUtil.copyToList(records, clazz));
// 5.返回
return dto;
}
public static <PO, VO> PageDTO<VO> of(Page<PO> p, Function<PO, VO> convertor){
PageDTO<VO> dto = new PageDTO<>();
// 1.总条数
dto.setTotal(p.getTotal());
// 2.总页数
dto.setPages(p.getPages());
// 3.当前页数据
List<PO> records = p.getRecords();
if (CollUtil.isEmpty(records)) {
dto.setList(Collections.emptyList());
return dto;
}
// 4.拷贝user的VO
dto.setList(records.stream().map(convertor).collect(Collectors.toList()));
// 5.返回
return dto;
}
}

@ -0,0 +1,24 @@
package com.teaching.backend.model.dto.favour.courseFavour;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseFavourAddRequest implements Serializable {
/**
* 帖子 id
*/
private String courseId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,20 @@
package com.teaching.backend.model.dto.favour.courseFavour;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseFavourAllRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,20 @@
package com.teaching.backend.model.dto.favour.courseFavour;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseFavourListRequest implements Serializable {
/**
* 用户 id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,22 @@
package com.teaching.backend.model.dto.favour.courseFavour;
import com.teaching.backend.common.PageRequest;
import com.teaching.backend.constant.CommonConstant;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseFavourQueryRequest extends PageRequest implements Serializable {
/**
* 用户 id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,29 @@
package com.teaching.backend.model.dto.favour.knowFavour;
import lombok.Data;
import java.io.Serializable;
/**
* 知识点点赞请求
*/
@Data
public class KnowFavourAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
*/
private String knowId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,29 @@
package com.teaching.backend.model.dto.favour.resourceFavour;
import lombok.Data;
import java.io.Serializable;
/**
* 资源点赞请求
*/
@Data
public class ResourceFavourAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
*/
private String resourceId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -1,9 +0,0 @@
package com.teaching.backend.model.dto;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,24 @@
package com.teaching.backend.model.dto.thumb.coursethumb;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseThumbAddRequest implements Serializable {
/**
* 帖子 id
*/
private String courseId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,20 @@
package com.teaching.backend.model.dto.thumb.coursethumb;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞请求
*/
@Data
public class CourseThumbAllRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,29 @@
package com.teaching.backend.model.dto.thumb.knowthumb;
import lombok.Data;
import java.io.Serializable;
/**
* 知识点点赞请求
*/
@Data
public class KnowThumbAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
*/
private String knowId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,29 @@
package com.teaching.backend.model.dto.thumb.resourcethumb;
import lombok.Data;
import java.io.Serializable;
/**
* 资源点赞请求
*/
@Data
public class ResourceThumbAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
*/
private String resourceId;
/**
* user id
*/
private String userId;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,32 @@
package com.teaching.backend.model.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.util.stream.Stream;
/**
* ClassName: FileTable
* Package: com.teaching.backend.model.entity
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/4 11:48
* @Version 1.0
*/
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@TableName("filetable")
public class FileTable {
private int id;
private String courseId;
private String fileName;
private String filePath;
}

@ -0,0 +1,26 @@
package com.teaching.backend.model.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* ClassName: User
* Package: com.teaching.backend.model.entity
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/3 17:42
* @Version 1.0
*/
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class User {
private int id;
private int userid;
private int bokeid;
private int type;
}

@ -0,0 +1,118 @@
package com.teaching.backend.model.entity.chapter;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author author
* @since 2024-05-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("chapter")
@ApiModel(value="Chapter对象", description="")
public class Chapter implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private String id;
@ApiModelProperty(value = "创建人")
@TableField("create_by")
private String createBy;
@ApiModelProperty(value = "创建日期")
@TableField("create_time")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
@TableField("update_by")
private String updateBy;
@ApiModelProperty(value = "更新日期")
@TableField("update_time")
private LocalDateTime updateTime;
@ApiModelProperty(value = "所属部门")
@TableField("sys_org_code")
private String sysOrgCode;
@ApiModelProperty(value = "序号")
@TableField("num")
private Integer num;
@ApiModelProperty(value = "名称")
@TableField("name")
private String name;
@ApiModelProperty(value = "简介")
@TableField("content")
private String content;
@ApiModelProperty(value = "父级节点")
@TableField("pid")
private String pid;
@ApiModelProperty(value = "是否有子节点")
@TableField("has_child")
private String hasChild;
@ApiModelProperty(value = "课程")
@TableField("courseid")
private String courseid;
@ApiModelProperty(value = "课程目标")
@TableField("courseobjectivesid")
private String courseobjectivesid;
@ApiModelProperty(value = "总学时")
@TableField("totalclasshours")
private String totalclasshours;
@ApiModelProperty(value = "要求")
@TableField("requirement")
private String requirement;
@ApiModelProperty(value = "线上学时")
@TableField("onlinclasshours")
private String onlinclasshours;
@ApiModelProperty(value = "知识点")
@TableField("knowid")
private String knowid;
@ApiModelProperty(value = "周次")
@TableField("zc")
private String zc;
@ApiModelProperty(value = "资源")
@TableField("ziyuan")
private String ziyuan;
@ApiModelProperty(value = "知识点")
@TableField("know")
private String know;
@ApiModelProperty(value = "内部序号显示")
@TableField("numshow")
private String numshow;
}

@ -0,0 +1,66 @@
package com.teaching.backend.model.entity.courses;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zjh
* @since 2024-05-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("course_objectives")
@ApiModel(value="CourseObjectives对象", description="")
public class CourseObjectives implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "内部编号")
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
@ApiModelProperty(value = "创建日期")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新日期")
private LocalDateTime updateTime;
@ApiModelProperty(value = "父级节点")
private String pid;
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
@ApiModelProperty(value = "目标名称")
private String name;
@ApiModelProperty(value = "目标类型")
private String type;
@ApiModelProperty(value = "课程id")
private String courseId;
@ApiModelProperty(value = "毕业要求id")
private String requireid;
@ApiModelProperty(value = "毕业要求")
private String temp;
}

@ -0,0 +1,143 @@
package com.teaching.backend.model.entity.courses;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zjh
* @since 2024-05-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("courses")
public class Courses implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 内部编号
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* 创建日期
*/
private LocalDateTime createTime;
/**
* 更新日期
*/
private LocalDateTime updateTime;
/**
* 课程封面
*/
private String img;
/**
* 课程类别
*/
private String category;
/**
* 课程性质
*/
private String nature;
/**
* 课程名称
*/
private String name;
/**
* 课程编码
*/
private String code;
/**
* 开课学期
*/
private String semester;
/**
* 课程学分
*/
private BigDecimal credit;
/**
* 课程学时
*/
private Integer classhours;
/**
* 理论学时
*/
private Integer theoryhours;
/**
* 实践学时
*/
private Integer practicehours;
/**
* 实验学时
*/
private Integer experimenthours;
/**
* 其他学时
*/
private Integer otherhours;
/**
* 上课周数
*/
private Integer weeks;
/**
* 考核类型
*/
private String assessmenttype;
/**
* 考核方式
*/
private String assessmentway;
/**
* 负责教师
*/
private String teacher;
/**
* 教学方法
*/
private String teachermethod;
/**
* 教学方式
*/
private String teacherway;
/**
* 课程简介
*/
private String description;
}

@ -0,0 +1,40 @@
package com.teaching.backend.model.entity.courses;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("objective_contents")
@ApiModel(value="ObjectiveContents对象", description="")
public class ObjectiveContents implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
@ApiModelProperty(value = "对应的目标id",required = true)
private String objectiveId;
@ApiModelProperty(value = "内容",required = true)
private String content;
}

@ -0,0 +1,38 @@
package com.teaching.backend.model.entity.courses;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("objectives_type")
@ApiModel(value="ObjectivesType对象", description="")
public class ObjectivesType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "类型编码,不用输入,使用雪花算法生成")
private String id;
@ApiModelProperty(value = "类型名称",required = true)
private String typeName;
}

@ -0,0 +1,35 @@
package com.teaching.backend.model.entity.favour;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 课程点赞
*/
@TableName(value = "se_course_favour")
@Data
public class SeCourseFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,40 @@
package com.teaching.backend.model.entity.favour;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 知识点点赞
*/
@TableName(value = "se_know_favour")
@Data
public class SeKnowFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String knowId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,40 @@
package com.teaching.backend.model.entity.favour;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 资源点赞
*/
@TableName(value = "se_resource_favour")
@Data
public class SeResourceFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String resourceId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -1,9 +0,0 @@
package com.teaching.backend.model.entity;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,36 @@
package com.teaching.backend.model.entity.thumb;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 课程点赞
*/
@TableName(value = "se_course_thumb")
@Data
public class SeCourseThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,40 @@
package com.teaching.backend.model.entity.thumb;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 知识点点赞
*/
@TableName(value = "se_know_thumb")
@Data
public class SeKnowThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String knowId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,40 @@
package com.teaching.backend.model.entity.thumb;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 资源点赞
*/
@TableName(value = "se_resource_thumb")
@Data
public class SeResourceThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String resourceId;
/**
* 创建用户 id
*/
private String userId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,14 @@
package com.teaching.backend.model.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(description = "课程查询条件实体")
public class CourseQuery extends PageQuery {
@ApiModelProperty("课程名称关键字")
private String name;
}

@ -0,0 +1,44 @@
package com.teaching.backend.model.query;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "分页查询实体")
public class PageQuery {
@ApiModelProperty("页码")
private Integer pageNo = 1;
@ApiModelProperty("每页数量")
private Integer pageSize = 10;
@ApiModelProperty("排序字段")
private String sortBy;
@ApiModelProperty("是否升序")
private Boolean isAsc = true;
public <T> Page<T> toMpPage(OrderItem ... items){
// 1.分页条件
Page<T> page = Page.of(pageNo, pageSize);
// 2.排序条件
if(StrUtil.isNotBlank(sortBy)){
// 不为空
page.addOrder(new OrderItem(sortBy, isAsc));
}else if(items != null){
// 为空,默认排序
page.addOrder(items);
}
return page;
}
public <T> Page<T> toMpPage(String defaultSortBy, Boolean defaultAsc){
return toMpPage(new OrderItem(defaultSortBy, defaultAsc));
}
public <T> Page<T> toMpPageDefaultSortByCreateTime(){
return toMpPage(new OrderItem("create_time", false));
}
public <T> Page<T> toMpPageDefaultSortByUpdateTime(){
return toMpPage(new OrderItem("update_time", false));
}
}

@ -1,9 +0,0 @@
package com.teaching.backend.model;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
public class test1 {
}

@ -0,0 +1,26 @@
package com.teaching.backend.model.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.teaching.backend.model.dto.courses.CourseObjectivesDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@Data
@ApiModel(description = "课程目标参数实体")
public class CourseObjectivesTreeVO extends CourseObjectives implements Serializable {
@ApiModelProperty(value = "目标内容列表")
private List<ObjectiveContents> contents;
@ApiModelProperty(value = "课程目标")
private List<CourseObjectivesTreeVO> courseObjectivesTrees;
}

@ -0,0 +1,60 @@
package com.teaching.backend.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(description = "课程VO实体")
public class CoursesVO {
/**
* 内部编号
*/
@ApiModelProperty("id")
private String id;
/**
* 教师id
*/
@ApiModelProperty("教师id")
private String teacher;
/**
* 课程封面
*/
@ApiModelProperty("图片")
private String img;
/**
* 课程名称
*/
@ApiModelProperty(value = "课程名称",required = true)
private String name;
/**
* 课程学分
*/
@ApiModelProperty(value = "课程学分",required = true)
private BigDecimal credit;
/**
* 课程学时
*/
@ApiModelProperty(value = "课程学时",required = true)
private Integer classhours;
@ApiModelProperty(value = "课程描述",required = true)
private String description;
@ApiModelProperty(value = "课程总学时",required = true)
private Integer totalHours;
@ApiModelProperty(value = "课程章节总数",required = true)
private Integer totalchapter;
@ApiModelProperty(value = "课程知识点总数",required = true)
private Integer totalKnow;
}

@ -0,0 +1,72 @@
package com.teaching.backend.model.vo.favour;
import com.baomidou.mybatisplus.annotation.TableName;
import com.teaching.backend.model.entity.courses.Courses;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
/**
* @Author:youhang
* @Date:2024-06-03-11:18
* @Description:
*/
@TableName(value = "courses")
@Data
public class CourseFavourDetailVO {
/**
* 内部编号
*/
private String id;
/**
* 课程封面
*/
private String img;
/**
* 课程名称
*/
private String name;
/**
* 教师id
*/
@ApiModelProperty("教师id")
private String teacher;
/**
* 课程学分
*/
@ApiModelProperty(value = "课程学分", required = true)
private BigDecimal credit;
/**
* 课程学时
*/
@ApiModelProperty(value = "课程学时", required = true)
private Integer classhours;
/**
* 对象转包装类
*
* @param course
* @return
*/
public static CourseFavourDetailVO objToVo(Courses course) {
if (course == null) {
return null;
}
CourseFavourDetailVO courseFavourDetailVO = new CourseFavourDetailVO();
BeanUtils.copyProperties(course, courseFavourDetailVO);
return courseFavourDetailVO;
}
}

@ -0,0 +1,25 @@
package com.teaching.backend.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.FileTable;
/**
* ClassName: FileTableService
* Package: com.teaching.backend.service
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/4 11:49
* @Version 1.0
*/
public interface FileTableService extends IService<FileTable> {
void updateFile(String courseId, String fileName, String filePath);
}

@ -0,0 +1,16 @@
package com.teaching.backend.service;
import com.teaching.backend.entity.Chapter;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author author
* @since 2024-06-07
*/
public interface IChapterService extends IService<Chapter> {
}

@ -0,0 +1,16 @@
package com.teaching.backend.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.User;
/**
* ClassName: UserService
* Package: com.teaching.backend.service
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/3 17:48
* @Version 1.0
*/
public interface UserService extends IService<User> {
}

@ -0,0 +1,13 @@
package com.teaching.backend.service.chapter;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.chapter.Chapter;
/**
*
* @author author
* @since 2024-05-31
*/
public interface IChapterService extends IService<Chapter> {
}

@ -0,0 +1,40 @@
package com.teaching.backend.service.courses;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.dto.courses.CourseObjectivesDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.vo.CourseObjectivesTreeVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author zjh
* @since 2024-05-31
*/
public interface ICourseObjectivesService extends IService<CourseObjectives> {
/**
* 添加课程目标
* @param courseObjectivesDTO
* @return
*/
String addObjectives(CourseObjectivesDTO courseObjectivesDTO);
/**
* 删除课程目标
* @param id
* @return
*/
String deleteObjectives(String id);
/**
* 查询课程目标以及相关内容
* @param id
* @return
*/
List<CourseObjectivesTreeVO> queryCourseObjectivesTree(String id);
}

@ -0,0 +1,34 @@
package com.teaching.backend.service.courses;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.query.CourseQuery;
import com.teaching.backend.model.vo.CoursesVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author zjh
* @since 2024-05-30
*/
public interface ICoursesService extends IService<Courses> {
String saveCourseWithObjective(CoursesDTO coursesDTO, String teacherId);
PageDTO<CoursesVO> queryCourses(CourseQuery courseQuery, String teacherId);
void deleteBatchByIds(String id);
int countHours(String id);
List<CoursesVO> getPagePageSize(int page, int pageSize);
}

@ -0,0 +1,18 @@
package com.teaching.backend.service.courses;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.model.vo.CourseObjectivesTreeVO;
/**
* <p>
* 服务类
* </p>
*
* @author zjh
* @since 2024-06-05
*/
public interface IObjectiveContentsService extends IService<ObjectiveContents> {
}

@ -0,0 +1,16 @@
package com.teaching.backend.service.courses;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.courses.ObjectivesType;
/**
* <p>
* 服务类
* </p>
*
* @author zjh
* @since 2024-06-05
*/
public interface IObjectivesTypeService extends IService<ObjectivesType> {
}

@ -0,0 +1,69 @@
package com.teaching.backend.service.favour;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourQueryRequest;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.favour.SeCourseFavour;
import com.teaching.backend.model.vo.favour.CourseFavourDetailVO;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
public interface SeCourseFavourService extends IService<SeCourseFavour> {
/**
* 收藏/取消收藏
*
* @param courseId
* @param userId
* @return
*/
boolean doCourseFavour(String courseId, String userId);
/**
* 收藏总数
*
* @param courseId
* @return
*/
long favourCount(String courseId);
/**
* 课程下资源和知识点的收藏总数
*
* @param courseId
* @return
*/
long courseCount(String courseId);
/**
* 某个用户课程列表
*
* @param userId
* @return
*/
List<String> courseList(String userId);
/**
* 某个用户课程列表全部信息
*
* @param page
* @param queryWrapper
* @return
*/
public Page<CourseFavourDetailVO> listCourseFavourByPage(Page<Courses> page, Wrapper<Courses> queryWrapper);
}

@ -0,0 +1,22 @@
package com.teaching.backend.service.favour;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.favour.SeKnowFavour;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
public interface SeKnowFavourService extends IService<SeKnowFavour> {
/**
* 收藏
*
* @param courseId
* @param userId
* @return
*/
boolean doKnowFavour(String courseId, String resourceId, String userId);
}

@ -0,0 +1,22 @@
package com.teaching.backend.service.favour;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.favour.SeResourceFavour;
/**
* @Author:youhang
* @Date:2024-05-30-20:22
* @Description:
*/
public interface SeResourceFavourService extends IService<SeResourceFavour> {
/**
* 收藏
*
* @param courseId
* @param userId
* @return
*/
boolean doResourceFavour(String courseId, String resourceId, String userId);
}

@ -0,0 +1,20 @@
package com.teaching.backend.service.impl;
import com.teaching.backend.entity.Chapter;
import com.teaching.backend.mapper.ChapterMapper;
import com.teaching.backend.service.IChapterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author author
* @since 2024-06-07
*/
@Service
public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, Chapter> implements IChapterService {
}

@ -0,0 +1,106 @@
package com.teaching.backend.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.FileTableMapper;
import com.teaching.backend.model.entity.FileTable;
import com.teaching.backend.service.FileTableService;
import org.springframework.stereotype.Service;
/**
* ClassName: FileTableImpl
* Package: com.teaching.backend.service.impl
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/4 11:50
* @Version 1.0
*/
@Service
public class FileTableServiceImpl extends ServiceImpl<FileTableMapper,FileTable> implements FileTableService {
@Override
public void updateFile(String courseId, String fileName, String filePath) {
System.out.println("执行了service中的方法");
System.out.println(courseId);
System.out.println(fileName);
System.out.println(filePath);
FileTable fileTable = new FileTable();
fileTable.setFileName(fileName);
fileTable.setFilePath(filePath);
// fileTable.setCourseId(courseId); // 设置主键值
//
// this.save(fileTable); // 使用save方法来添加新的记录
UpdateWrapper<FileTable> fileTableUpdateWrapper = new UpdateWrapper<>();
fileTableUpdateWrapper.eq("id", courseId);
this.update(fileTable, fileTableUpdateWrapper);
}}
// @Override
// public String getPath(String courseId, String basePath) {
//
// FileTable courseFile = this.getById(courseId);
//
// System.out.println("1111111111111111111111" + courseFile);
//
// String FileName = basePath + courseFile.getFilePath();
//
// System.out.println("这是往前端方法返回的值" + FileName);
// return FileName;
// }
// @Override
// public void download(String courseId, HttpServletResponse response, String endpoint) {
// OSS ossClient = new OSSClientBuilder().build(endpoint, accessKey, accessSecret);
//
// try {
//
// FileTable courseFile = this.getById(courseId);
//
// System.out.println(courseFile);
//
// if (courseFile != null) {
// String fileName = courseFile.getFileName();
// String filePath = courseFile.getFilePath();
// System.out.println("要下载的文件是:" + basePath + filePath);
//
// File file = new File(basePath, filePath);
//
// if (file.exists()) {
// FileInputStream fileInputStream = new FileInputStream(file);
//
// ServletOutputStream outputStream = response.getOutputStream();
//
// response.setContentType("application/octet-stream");
// response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
//
// byte[] buffer = new byte[1024];
// int len;
// while ((len = fileInputStream.read(buffer)) > 0) {
// outputStream.write(buffer, 0, len);
// }
//
// outputStream.flush();
// fileInputStream.close();
// outputStream.close();
// } else {
// System.out.println("文件不存在");
// }
// } else {
// System.out.println("文件不存在或未找到相关记录");
// }
//
// } catch (IOException e) {
// e.printStackTrace();
// }
//
//
//}

@ -0,0 +1,24 @@
package com.teaching.backend.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.UserMapper;
import com.teaching.backend.model.entity.User;
import com.teaching.backend.service.UserService;
import org.springframework.stereotype.Service;
/**
* ClassName: UserServiceImpl
* Package: com.teaching.backend.service.impl
* Description:
*
* @Author 姜钧瀚
* @Create 2024/6/3 17:48
* @Version 1.0
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
}

@ -0,0 +1,17 @@
package com.teaching.backend.service.impl.chapter;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.chapter.ChapterMapper;
import com.teaching.backend.model.entity.chapter.Chapter;
import com.teaching.backend.service.chapter.IChapterService;
import org.springframework.stereotype.Service;
/**
*
* @author author
* @since 2024-05-31
*/
@Service
public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, Chapter> implements IChapterService {
}

@ -0,0 +1,182 @@
package com.teaching.backend.service.impl.courses;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.courses.CourseObjectivesMapper;
import com.teaching.backend.mapper.courses.ObjectiveContentsMapper;
import com.teaching.backend.model.dto.courses.CourseObjectivesDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.model.vo.CourseObjectivesTreeVO;
import com.teaching.backend.service.courses.ICourseObjectivesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author zjh
* @since 2024-05-31
*/
@Service
public class CourseObjectivesServiceImpl extends ServiceImpl<CourseObjectivesMapper, CourseObjectives> implements ICourseObjectivesService {
@Autowired
CourseObjectivesMapper courseObjectivesMapper;
@Autowired
ObjectiveContentsMapper objectiveContentsMapper;
@Override
public String addObjectives(CourseObjectivesDTO courseObjectivesDTO) {
String pid = courseObjectivesDTO.getPid();
if(pid.equals(null)){
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR,"pid父节点不能为空");
}
String hasChild = courseObjectivesMapper.selectById(pid).getHasChild();
String type = courseObjectivesDTO.getType();
if (hasChild.equals("0") && !type.equals("71f73bd999f678bcbbdb101e23277feb")){
throw new BusinessException(ErrorCode.PARAMS_ILLEGAL,"请在添加完思政目标以后再添加此类型目标!");
}
//判断是否已经添加过该类型的目标
//每个类型的目标只能有一个
LambdaQueryWrapper<CourseObjectives> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.eq(CourseObjectives::getPid, pid)
.eq(CourseObjectives::getType, type);
Long count = courseObjectivesMapper.selectCount(queryWrapper);
if (count>0){
throw new BusinessException(ErrorCode.CONTENT_EXISTS,"该类型的目标已存在,禁止重复添加!");
}
//往表里面写分项目标
CourseObjectives courseObjectivesNew = new CourseObjectives();
BeanUtil.copyProperties(courseObjectivesDTO,courseObjectivesNew);
courseObjectivesNew.setCreateTime(LocalDateTime.now());
courseObjectivesMapper.insert(courseObjectivesNew);
//插入数据以后要把总体目标那边的haschild改成1
CourseObjectives courseObjectivesOld = courseObjectivesMapper.selectById(pid);
courseObjectivesOld.setUpdateTime(LocalDateTime.now());
courseObjectivesOld.setHasChild("1");
courseObjectivesMapper.updateById(courseObjectivesOld);
return "添加成功";
}
/**
* 删除课程目标
* 首先检查是不是思政目标如果是思政目标就要看此时的总目标下面有没有别的分项目标了如果有不准删除
* 如果此时只有分项目标检查分项目标下面有没有内容如果有禁止删除
* 删除分项目标也要检查下面有没有内容
* @param id
* @return
*/
@Override
public String deleteObjectives(String id) {
final String SI_ZHENG_TYPE="71f73bd999f678bcbbdb101e23277feb";
CourseObjectives courseObjectives = courseObjectivesMapper.selectById(id);
if (courseObjectives == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR);
}
String type = courseObjectives.getType();
String pid = courseObjectives.getPid();
if (SI_ZHENG_TYPE.equals(type)){
LambdaQueryWrapper<CourseObjectives> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CourseObjectives::getPid, pid);
Long count1 = courseObjectivesMapper.selectCount(queryWrapper);
if (count1==1){
Long count2 = getCount(id);
if (count2==0)
{
// 删除操作和更新父目标状态
deleteObjectiveAndUpdateParent(id, pid);
return "删除成功";
}
else {
throw new BusinessException(ErrorCode.CONTENT_EXISTS, "请删除该目标下的内容后,再删除该目标");
}
}
else
{
throw new BusinessException(ErrorCode.OPERATION_ERROR, "请删除其他类型的分目标后,再来删除思政目标");
}
}
else {
Long count3 = getCount(id);
if (count3==0){
courseObjectivesMapper.deleteById(id);
return "删除成功";
}
else {
throw new BusinessException(ErrorCode.CONTENT_EXISTS, "请删除该目标下的内容后,再删除该目标");
}
}
}
private Long getCount(String id) {
LambdaQueryWrapper<ObjectiveContents> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ObjectiveContents::getObjectiveId, id);
Long count = objectiveContentsMapper.selectCount(queryWrapper);
return count;
}
private void deleteObjectiveAndUpdateParent(String id, String pid) {
courseObjectivesMapper.deleteById(id);
CourseObjectives parentObjective = courseObjectivesMapper.selectById(pid);
parentObjective.setHasChild("0");
courseObjectivesMapper.updateById(parentObjective);
}
@Override
public List<CourseObjectivesTreeVO> queryCourseObjectivesTree(String id) {
LambdaQueryWrapper<CourseObjectives> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CourseObjectives::getCourseId, id);
CourseObjectives courseObjectives = courseObjectivesMapper.selectOne(queryWrapper);
String courseObjectivesId = courseObjectives.getId();
List<CourseObjectivesTreeVO> objectives = courseObjectivesMapper.selectTreeNodes(courseObjectivesId);
Map<String, CourseObjectivesTreeVO> map = new HashMap<>();
for (CourseObjectivesTreeVO objective : objectives) {
map.put(objective.getId(), objective);
}
// 构建树结构
List<CourseObjectivesTreeVO> roots = new ArrayList<>();
for (CourseObjectivesTreeVO objective : objectives) {
if ("0".equals(objective.getPid())) {
roots.add(objective);
} else {
CourseObjectivesTreeVO parent = map.get(objective.getPid());
if (parent != null) {
if (parent.getCourseObjectivesTrees() == null) {
parent.setCourseObjectivesTrees(new ArrayList<>());
}
parent.getCourseObjectivesTrees().add(objective);
}
}
// 填充内容
List<ObjectiveContents> contents = fetchContentsForObjective(objective.getId());
objective.setContents(contents);
}
return roots;
}
// 获取目标的内容列表
private List<ObjectiveContents> fetchContentsForObjective(String objectiveId) {
LambdaQueryWrapper<ObjectiveContents> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ObjectiveContents::getObjectiveId, objectiveId);
List<ObjectiveContents> contents = objectiveContentsMapper.selectList(queryWrapper);
return contents;
}
}

@ -0,0 +1,176 @@
package com.teaching.backend.service.impl.courses;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.courses.CourseObjectivesMapper;
import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.mapper.courses.ObjectiveContentsMapper;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.model.query.CourseQuery;
import com.teaching.backend.model.vo.CoursesVO;
import com.teaching.backend.service.courses.ICoursesService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author zjh
* @since 2024-05-30
*/
@Service
public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> implements ICoursesService {
@Autowired
CoursesMapper coursesMapper;
@Autowired
CourseObjectivesMapper courseObjectivesMapper;
@Autowired
ObjectiveContentsMapper objectiveContentsMapper;
@Override
@Transactional
public String saveCourseWithObjective(CoursesDTO coursesDTO, String teacherId) {
Courses courses = new Courses();
CourseObjectives courseObjectives = new CourseObjectives();
BeanUtils.copyProperties(coursesDTO, courses);
// List<String> teacherIds = new ArrayList<>();
// teacherIds.add(teacherId);
// courses.setTeacher(String.valueOf(teacherIds));
courses.setTeacher(teacherId);
courses.setCreateTime(LocalDateTime.now());
String code = coursesDTO.getCode();
QueryWrapper<Courses> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code);
Long count = coursesMapper.selectCount(queryWrapper);
if (count == 0) {
int insert = coursesMapper.insert(courses);
if (insert > 0) {
Courses courses1 = coursesMapper.selectOne(queryWrapper);
courseObjectives.setCourseId(courses1.getId());
courseObjectives.setCreateTime(courses1.getCreateTime());
courseObjectives.setName(courses1.getName() + "课程总体目标");
courseObjectivesMapper.insert(courseObjectives);
}
return "添加成功";
} else {
throw new BusinessException(ErrorCode.OPERATION_ERROR, "这个课程已经存在了!请联系系统相关人员为您导入课程数据!");
}
}
@Override
public PageDTO<CoursesVO> queryCourses(CourseQuery courseQuery, String teacherId) {
//要搜索的课程名字
String name = courseQuery.getName();
// 1.1构建分页条件
Page<Courses> page = courseQuery.toMpPageDefaultSortByCreateTime();
// 2.分页查询
Page<Courses> p = lambdaQuery()
.like(name != null, Courses::getName, name)
// .eq(Courses::getTeacher,teacherId)
// .apply("JSON_CONTAINS(teacher, JSON_QUOTE({0}))", teacherId)
.apply("FIND_IN_SET({0}, teacher)", teacherId)
.page(page);
return PageDTO.of(p, CoursesVO.class);
}
@Override
// @Transactional
public void deleteBatchByIds(String id) {
LambdaQueryWrapper<CourseObjectives> queryWrapper = new LambdaQueryWrapper<CourseObjectives>().eq(CourseObjectives::getCourseId, id);
CourseObjectives courseObjectives = courseObjectivesMapper.selectOne(queryWrapper);
String objectivesId = courseObjectives.getId();
LambdaQueryWrapper<ObjectiveContents> queryWrapper2 = new LambdaQueryWrapper<ObjectiveContents>().eq(ObjectiveContents::getObjectiveId, objectivesId);
Long count = objectiveContentsMapper.selectCount(queryWrapper2);
if (courseObjectives.getHasChild().equals("1")) {
throw new BusinessException(ErrorCode.CONTENT_EXISTS, "该课程已有分项目标,禁止删除");
}
if (!count.equals(0)){
throw new BusinessException(ErrorCode.CONTENT_EXISTS, "总目标下面还有内容,禁止删除");
}
else {
coursesMapper.deleteById(id);
courseObjectivesMapper.deleteById(courseObjectives.getId());
}
}
@Override
public List<CoursesVO> getPagePageSize(int page, int pageSize) {
int startIndex = (page-1) * pageSize;
List<Courses> list = coursesMapper.getItemsByPage(startIndex, pageSize);
// List<Courses> list = coursesMapper.selectList(null);
List<CoursesVO> coursesVo = BeanUtil.copyToList(list, CoursesVO.class);
coursesVo = coursesVo.stream().map((item) -> {
item.setTotalHours(countHours(item.getId()));
item.setTotalchapter(100);
item.setTotalKnow(100);
// if (StringUtils.isBlank(item.getName()) ||
// StringUtils.isBlank(item.getDescription()) ){
// throw new BusinessException(ErrorCode.OPERATION_ERROR,"数据格式有问题,请修改");
// }
return item;
}).collect(Collectors.toList());
return coursesVo;
}
@Override
public int countHours(String id) {
Courses courses = coursesMapper.selectById(id);
Integer classhours = 0;
Integer theoryhours = 0;
Integer practicehours = 0;
Integer experimenthours = 0;
Integer otherhours = 0;
if (courses.getClasshours() != null) {
classhours = courses.getClasshours();
}
if (courses.getTheoryhours() != null) {
theoryhours = courses.getTheoryhours();
}
if (courses.getPracticehours() != null) {
practicehours = courses.getPracticehours();
}
if (courses.getExperimenthours() != null) {
experimenthours = courses.getExperimenthours();
}
if (courses.getOtherhours() != null) {
otherhours = courses.getOtherhours();
}
int total = classhours + theoryhours + practicehours + experimenthours + otherhours;
return total;
}
}

@ -0,0 +1,21 @@
package com.teaching.backend.service.impl.courses;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.courses.ObjectiveContentsMapper;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.service.courses.IObjectiveContentsService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@Service
public class ObjectiveContentsServiceImpl extends ServiceImpl<ObjectiveContentsMapper, ObjectiveContents> implements IObjectiveContentsService {
}

@ -0,0 +1,20 @@
package com.teaching.backend.service.impl.courses;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.courses.ObjectivesTypeMapper;
import com.teaching.backend.model.entity.courses.ObjectivesType;
import com.teaching.backend.service.courses.IObjectivesTypeService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@Service
public class ObjectivesTypeServiceImpl extends ServiceImpl<ObjectivesTypeMapper, ObjectivesType> implements IObjectivesTypeService {
}

@ -0,0 +1,162 @@
package com.teaching.backend.service.impl.favour;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.favour.SeCourseFavourMapper;
import com.teaching.backend.model.dto.favour.courseFavour.CourseFavourQueryRequest;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.favour.SeCourseFavour;
import com.teaching.backend.model.entity.favour.SeKnowFavour;
import com.teaching.backend.model.entity.favour.SeResourceFavour;
import com.teaching.backend.model.vo.CoursesVO;
import com.teaching.backend.model.vo.favour.CourseFavourDetailVO;
import com.teaching.backend.service.courses.ICoursesService;
import com.teaching.backend.service.favour.SeCourseFavourService;
import com.teaching.backend.service.favour.SeKnowFavourService;
import com.teaching.backend.service.favour.SeResourceFavourService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
* @Author:youhang
* @Date:2024-05-30-20:23
* @Description:
*/
@Service
public class SeCourseFavourServiceImpl extends ServiceImpl<SeCourseFavourMapper, SeCourseFavour> implements SeCourseFavourService {
@Resource
private SeResourceFavourService seResourceFavourService;
@Resource
SeKnowFavourService seKnowFavourService;
@Autowired
ICoursesService coursesService;
@Override
public boolean doCourseFavour(String courseId, String userId) {
System.out.println("进入点赞" + courseId + userId);
// todo 先查询数据库记录,该用户是否点赞
SeCourseFavour seCourseFavour = new SeCourseFavour();
seCourseFavour.setCourseId(courseId);
seCourseFavour.setUserId(userId);
QueryWrapper<SeCourseFavour> favourQueryWrapper = new QueryWrapper<>(seCourseFavour);
SeCourseFavour oldSeCourseFavour = this.getOne(favourQueryWrapper);
boolean result = false;
//已点赞
if (oldSeCourseFavour != null) {
// 取消点赞 删除记录
result = this.remove(favourQueryWrapper);
if (result) {
System.out.println("取消点赞成功");
return result;
} else {
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
}
} else {
// 每个用户串行点赞
// 锁必须要包裹住事务方法
Lock lock = new ReentrantLock();
lock.lock();
try {
result = this.save(seCourseFavour);
} catch (Exception e) {
throw new BusinessException(ErrorCode.OPERATION_ERROR);
} finally {
lock.unlock();
System.out.println("点赞成功");
return result;
}
}
}
@Override
public long favourCount(String courseId) {
System.out.println("进入课程点赞统计" + courseId);
QueryWrapper<SeCourseFavour> favourQueryWrapper = new QueryWrapper<>();
favourQueryWrapper.eq("course_id", courseId);
long result = this.count(favourQueryWrapper);
if (result == 0) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "查询参数不存在");
} else {
return result;
}
}
@Override
public long courseCount(String courseId) {
System.out.println("进入课程下资源和知识点的点赞统计" + courseId);
QueryWrapper<SeResourceFavour> ResourceQueryWrapper = new QueryWrapper<>();
ResourceQueryWrapper.eq("course_id", courseId);
long result1 = seResourceFavourService.count(ResourceQueryWrapper);
QueryWrapper<SeKnowFavour> KnowQueryWrapper = new QueryWrapper<>();
KnowQueryWrapper.eq("course_id", courseId);
long result2 = seKnowFavourService.count(KnowQueryWrapper);
long result = result1 + result2;
if (result == 0) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "查询参数不存在");
} else {
return result;
}
}
/**
* 某个用户课程列表
*
* @param userId
* @return
*/
@Override
public List<String> courseList(String userId) {
QueryWrapper<SeCourseFavour> courseQueryWrapper = new QueryWrapper<>();
courseQueryWrapper.eq("user_id", userId);
List<String> list = this.list(courseQueryWrapper).stream().map(SeCourseFavour::getCourseId).collect(Collectors.toList());
return list;
}
@Override
public Page<CourseFavourDetailVO> listCourseFavourByPage(Page<Courses> page, Wrapper<Courses> queryWrapper) {
Page<Courses> coursePage = coursesService.page(page, queryWrapper);
Page<CourseFavourDetailVO> courseFavourVOPage = new Page<>(coursePage.getCurrent(), coursePage.getSize(), coursePage.getTotal());
List<Courses> courseFavourList = coursePage.getRecords();
//若数据为空,直接返回
if (CollUtil.isEmpty(courseFavourList)) {
return courseFavourVOPage;
}
//过滤字段
List<CourseFavourDetailVO> courseFavourDetailVOList = new ArrayList<>();
for (int i = 0; i < courseFavourList.size(); i++) {
CourseFavourDetailVO courseFavourDetailVO = new CourseFavourDetailVO();
BeanUtils.copyProperties(courseFavourList.get(i), courseFavourDetailVO);
courseFavourDetailVOList.add(courseFavourDetailVO);
}
courseFavourVOPage.setRecords(courseFavourDetailVOList);
return courseFavourVOPage;
}
}

@ -0,0 +1,64 @@
package com.teaching.backend.service.impl.favour;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.favour.SeKnowFavourMapper;
import com.teaching.backend.model.entity.favour.SeKnowFavour;
import com.teaching.backend.service.favour.SeKnowFavourService;
import org.springframework.stereotype.Service;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @Author:youhang
* @Date:2024-05-30-20:23
* @Description:
*/
@Service
public class SeKnowFavourServiceImpl extends ServiceImpl<SeKnowFavourMapper, SeKnowFavour> implements SeKnowFavourService {
@Override
public boolean doKnowFavour(String courseId, String knowId, String userId) {
System.out.println("进入知识点点赞" + knowId + userId);
// 先查询数据库记录,该用户是否点赞
SeKnowFavour seKnowFavour = new SeKnowFavour();
seKnowFavour.setKnowId(knowId);
seKnowFavour.setUserId(userId);
seKnowFavour.setCourseId(courseId);
QueryWrapper<SeKnowFavour> favourQueryWrapper = new QueryWrapper<>(seKnowFavour);
SeKnowFavour oldSeKnowFavour = this.getOne(favourQueryWrapper);
boolean result = false;
//已点赞
if (oldSeKnowFavour != null) {
// 取消点赞 删除记录
result = this.remove(favourQueryWrapper);
if (result) {
System.out.println("取消点赞成功");
return result;
} else {
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
}
} else {
// 每个用户串行点赞
// 锁必须要包裹住事务方法
Lock lock = new ReentrantLock();
lock.lock();
try {
result = this.save(seKnowFavour);
} catch (Exception e) {
throw new BusinessException(ErrorCode.OPERATION_ERROR);
} finally {
lock.unlock();
System.out.println("点赞成功");
return result;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save