Merge remote-tracking branch 'origin/master'

master
youahng 5 months ago
commit efaf142cf9
  1. 7
      pom.xml
  2. 174
      sql/teaching_db.sql
  3. 383
      sql/teaching_db3.1.sql
  4. 173
      src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java
  5. 31
      src/main/java/com/teaching/backend/mapper/records/LearningRecordsMapper.java
  6. 192
      src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java
  7. 104
      src/main/java/com/teaching/backend/model/vo/records/LearningRecordsVo.java
  8. 1
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  9. 364
      src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java
  10. 38
      src/main/java/com/teaching/backend/service/records/LearningRecordsService.java

@ -155,13 +155,6 @@
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- &lt;!&ndash; pagehelper &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.pagehelper</groupId>-->
<!-- <artifactId>pagehelper</artifactId>-->
<!-- <version>3.4.2</version>-->
<!-- </dependency>-->
</dependencies>

@ -20,20 +20,17 @@ 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_time` datetime 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(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '目标类型',
`course_id` 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;
CREATE TABLE `course_objectives` (
`id` varchar(36) NOT NULL COMMENT '内部编号',
`pid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '父级节点 默认0没有',
`has_child` int(1) DEFAULT '0' COMMENT '是否有子节点 添加子节点变1,默认0没有',
`name` varchar(200) DEFAULT NULL COMMENT '目标名称',
`type` int(5) 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;
-- ----------------------------
-- Records of course_objectives
@ -53,45 +50,48 @@ INSERT INTO `course_objectives` VALUES ('da6e7283befa8965dae0f0f39ea7f24e', '202
-- 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, 2) 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;
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(4,2) DEFAULT NULL COMMENT '课程学分',
`classhours` int(5) DEFAULT NULL COMMENT '课程学时',
`theoryhours` int(5) DEFAULT NULL COMMENT '理论学时',
`practicehours` int(5) DEFAULT NULL COMMENT '实践学时',
`experimenthours` int(5) DEFAULT NULL COMMENT '实验学时',
`otherhours` int(5) 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 '课程简介',
`status` int(1) DEFAULT '0' COMMENT '课程状态 0未在修改 1在修改中',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of courses
-- ----------------------------
INSERT INTO `courses` 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);
INSERT INTO `courses` VALUES ('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);
INSERT INTO `courses` VALUES ('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);
INSERT INTO `courses` VALUES ('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);
INSERT INTO `courses` VALUES ('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);
INSERT INTO `courses` VALUES ('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);
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.00, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327', '暂定', '线下机房授课', NULL);
INSERT INTO `courses` VALUES ('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);
INSERT INTO `courses` VALUES ('d8d7bb93f100164659cac44ef2c4f55a', '2024-06-06 16:17:39', NULL, '', '1', '1', '近代史纲要', '111011', NULL, 2.60, 48, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334', '暂定', '线下授课', NULL);
INSERT INTO `courses` VALUES ('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);
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`,`status`) values ('2fa0fd63262230639d2c45a3acd9045c','2024-05-30 20:58:34',NULL,'','1','1','计算机导论1.0','111007',NULL,'4.60',64,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334,2140110339','暂定','线下授课',NULL,0),
('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,0),
('51d973f1cf0bad437da57d31f83a3232','2024-06-07 18:42:08',NULL,'','1','1','Test课程2','111014',NULL,'3.50',48,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL,0),
('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,0),
('72e1ad71bb855ba328f8c17964697354','2024-06-06 16:45:22',NULL,'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/KdxGCt8rKbruw3zEDTdkA.jpg','1','1','毛概','111012',NULL,'3.70',48,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL,0),
('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,0),
('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,0),
('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,0),
('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,0),
('d8d7bb93f100164659cac44ef2c4f55a','2024-06-06 16:17:39',NULL,'','1','1','近代史纲要','111011',NULL,'2.60',48,NULL,NULL,NULL,NULL,NULL,'1','1','2140110334','暂定','线下授课',NULL,0),
('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,0);
-- ----------------------------
-- Table structure for know
@ -172,48 +172,50 @@ INSERT INTO `learning_records` VALUES ('1797984330104299521', '3', '1', NULL, NU
-- ----------------------------
-- Table structure for objective_contents
-- ----------------------------
DROP TABLE IF EXISTS `objective_contents`;
CREATE TABLE `objective_contents` (
`id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`objective_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '对应的目标id',
`content` 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 objective_contents
-- ----------------------------
INSERT INTO `objective_contents` VALUES ('3f85eb79c29be4a15c729d98b17676a5', 'c84dc451086f7938c28a4f757957f415', '价值目标3');
INSERT INTO `objective_contents` VALUES ('406c85c99bd2d4b9f624ca3a67c3ce66', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标2');
INSERT INTO `objective_contents` VALUES ('4ad5a1f0f584e35e7af6ef5142773990', '503dc084653ffd003cb404b62266dc7c', '知识目标1');
INSERT INTO `objective_contents` VALUES ('4b4458cd64b0a1e21b54191a89e9f83d', 'c84dc451086f7938c28a4f757957f415', '价值目标2');
INSERT INTO `objective_contents` VALUES ('53d9d78b41051696314c0b1c0efa5313', '503dc084653ffd003cb404b62266dc7c', '知识目标3');
INSERT INTO `objective_contents` VALUES ('6689ed187bcbd36309510a21ea492225', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标3');
INSERT INTO `objective_contents` VALUES ('979e59083e81f28145e1162069ffebb8', 'c84dc451086f7938c28a4f757957f415', '价值目标1');
INSERT INTO `objective_contents` VALUES ('9efcc83089e6de9945499876d1a6235a', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标1');
INSERT INTO `objective_contents` VALUES ('c6b3fc522a5479e28cd3f0c9b971a871', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标3');
INSERT INTO `objective_contents` VALUES ('dc31075d57f371970c5af09fd534a9af', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标2');
INSERT INTO `objective_contents` VALUES ('eca937e6f047e3b6b06d67c5b4a9beff', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标1');
INSERT INTO `objective_contents` VALUES ('ffde482fac55e6dec5b60f6c6208d42c', '503dc084653ffd003cb404b62266dc7c', '知识目标2');
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 ('056b889ceb437abc96c759c2c9d61393','09f36bd3e0e65016f95281eb3d4f48a7','价值目标1'),
('3f85eb79c29be4a15c729d98b17676a5','c84dc451086f7938c28a4f757957f415','价值目标3'),
('406c85c99bd2d4b9f624ca3a67c3ce66','53b27c94fe8af02ac8b23d9be9a2e329','思政目标2'),
('4ad5a1f0f584e35e7af6ef5142773990','503dc084653ffd003cb404b62266dc7c','知识目标1'),
('4b4458cd64b0a1e21b54191a89e9f83d','c84dc451086f7938c28a4f757957f415','价值目标2'),
('53d9d78b41051696314c0b1c0efa5313','503dc084653ffd003cb404b62266dc7c','知识目标3'),
('6689ed187bcbd36309510a21ea492225','da6e7283befa8965dae0f0f39ea7f24e','总目标3'),
('93cc64742c6ae993b6c8d8e0e6784758','09f36bd3e0e65016f95281eb3d4f48a7','价值目标2'),
('979e59083e81f28145e1162069ffebb8','c84dc451086f7938c28a4f757957f415','价值目标1'),
('9efcc83089e6de9945499876d1a6235a','da6e7283befa8965dae0f0f39ea7f24e','总目标1'),
('bdacef102860e3dd3c1c3dcd3c3ef395','8d87cbacd499ad8b171e72a3aeeb7cab','思政目标2'),
('c6b3fc522a5479e28cd3f0c9b971a871','53b27c94fe8af02ac8b23d9be9a2e329','思政目标3'),
('dc31075d57f371970c5af09fd534a9af','da6e7283befa8965dae0f0f39ea7f24e','总目标2'),
('eca937e6f047e3b6b06d67c5b4a9beff','53b27c94fe8af02ac8b23d9be9a2e329','思政目标1'),
('f71f70ff7f6a83cf7be889eccd7015e1','8d87cbacd499ad8b171e72a3aeeb7cab','思政目标3'),
('f890c64ee471b8a22db79e33d622ee79','8d87cbacd499ad8b171e72a3aeeb7cab','思政目标1'),
('ffde482fac55e6dec5b60f6c6208d42c','503dc084653ffd003cb404b62266dc7c','知识目标2');
-- ----------------------------
-- Table structure for objectives_type
-- ----------------------------
DROP TABLE IF EXISTS `objectives_type`;
CREATE TABLE `objectives_type` (
`id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`type_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '类型名称',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `type_name`(`type_name` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of objectives_type
-- ----------------------------
INSERT INTO `objectives_type` VALUES ('410fc58cd757cd248941af1bea6888e5', '价值目标');
INSERT INTO `objectives_type` VALUES ('71f73bd999f678bcbbdb101e23277feb', '思政目标');
INSERT INTO `objectives_type` VALUES ('c126ef1a66733ab7a4ba12aba0eb7f82', '知识目标');
INSERT INTO `objectives_type` VALUES ('2350f69ef928cd2949e7fc05b05bd0c3', '素质目标');
CREATE TABLE `objectives_type` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`type_name` varchar(50) DEFAULT NULL COMMENT '类型名称',
PRIMARY KEY (`id`),
UNIQUE KEY `type_name` (`type_name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*Data for the table `objectives_type` */
insert into `objectives_type`(`id`,`type_name`) values (4,'价值目标'),
(1,'思政目标'),
(2,'知识目标'),
(3,'素质目标');
-- ----------------------------
-- Table structure for resource

@ -0,0 +1,383 @@
/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 80012 (8.0.12)
Source Host : localhost:3306
Source Schema : teaching_db
Target Server Type : MySQL
Target Server Version : 80012 (8.0.12)
File Encoding : 65001
Date: 11/06/2024 20:24:56
*/
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 utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内部编号',
`pid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '父级节点 默认0没有',
`has_child` int(1) NULL DEFAULT 0 COMMENT '是否有子节点 添加子节点变1,默认0没有',
`name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标名称',
`type` int(5) NULL DEFAULT NULL COMMENT '目标类型',
`course_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程id',
`requireid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '毕业要求id',
`temp` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '毕业要求',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of course_objectives
-- ----------------------------
-- ----------------------------
-- Table structure for courses
-- ----------------------------
DROP TABLE IF EXISTS `courses`;
CREATE TABLE `courses` (
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内部编号',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`img` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程封面',
`category` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程类别',
`nature` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程性质',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程名称',
`code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '课程编码',
`semester` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开课学期',
`credit` decimal(4, 2) NULL DEFAULT NULL COMMENT '课程学分',
`classhours` int(5) NULL DEFAULT NULL COMMENT '课程学时',
`theoryhours` int(5) NULL DEFAULT NULL COMMENT '理论学时',
`practicehours` int(5) NULL DEFAULT NULL COMMENT '实践学时',
`experimenthours` int(5) NULL DEFAULT NULL COMMENT '实验学时',
`otherhours` int(5) NULL DEFAULT NULL COMMENT '其他学时',
`weeks` int(11) NULL DEFAULT NULL COMMENT '上课周数',
`assessmenttype` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '考核类型',
`assessmentway` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '考核方式',
`teacher` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责教师',
`teachermethod` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '教学方法',
`teacherway` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '教学方式',
`description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '课程简介',
`status` int(1) NULL DEFAULT 0 COMMENT '课程状态 0未在修改 1在修改中',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `code`(`code` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of courses
-- ----------------------------
INSERT INTO `courses` VALUES ('2fa0fd63262230639d2c45a3acd9045c', '2024-05-30 20:58:34', NULL, '', '1', '1', '计算机导论1.0', '111007', NULL, 4.60, 64, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110339', '暂定', '线下授课', NULL, 0);
INSERT INTO `courses` VALUES ('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, 0);
INSERT INTO `courses` VALUES ('51d973f1cf0bad437da57d31f83a3232', '2024-06-07 18:42:08', NULL, '', '1', '1', 'Test课程2', '111014', NULL, 3.50, 48, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334', '暂定', '线下授课', NULL, 0);
INSERT INTO `courses` VALUES ('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, 0);
INSERT INTO `courses` VALUES ('72e1ad71bb855ba328f8c17964697354', '2024-06-06 16:45:22', NULL, 'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/KdxGCt8rKbruw3zEDTdkA.jpg', '1', '1', '毛概', '111012', NULL, 3.70, 48, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334', '暂定', '线下授课', NULL, 0);
INSERT INTO `courses` VALUES ('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, 0);
INSERT INTO `courses` VALUES ('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, 0);
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.00, 0, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334,2140110327', '暂定', '线下机房授课', NULL, 0);
INSERT INTO `courses` VALUES ('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, 0);
INSERT INTO `courses` VALUES ('d8d7bb93f100164659cac44ef2c4f55a', '2024-06-06 16:17:39', NULL, '', '1', '1', '近代史纲要', '111011', NULL, 2.60, 48, NULL, NULL, NULL, NULL, NULL, '1', '1', '2140110334', '暂定', '线下授课', NULL, 0);
INSERT INTO `courses` VALUES ('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, 0);
-- ----------------------------
-- Table structure for know
-- ----------------------------
DROP TABLE IF EXISTS `know`;
CREATE TABLE `know` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '知识点名称',
`info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '简介',
`content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '知识点内容',
`img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '知识点图片',
`hour` varchar(255) 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 know
-- ----------------------------
-- ----------------------------
-- Table structure for know_relationship
-- ----------------------------
DROP TABLE IF EXISTS `know_relationship`;
CREATE TABLE `know_relationship` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键id',
`chapterId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '章节id',
`courseId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '课程id',
`knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '知识点id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of know_relationship
-- ----------------------------
-- ----------------------------
-- Table structure for learning_records
-- ----------------------------
DROP TABLE IF EXISTS `learning_records`;
CREATE TABLE `learning_records` (
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '学习记录id',
`user_id` varchar(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '用户id',
`courses_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '课程id',
`chapter_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '章节id',
`knowledge_point_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '知识点id',
`resource_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '资源id',
`access_time` datetime NULL DEFAULT NULL COMMENT '访问时间',
`learning_method1` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '0' COMMENT '学习方式:打开; 1,打开过,2未打开',
`learning_method2` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '0' COMMENT '学习方式:下载; 1下载过, 2未下载',
`video_duration` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '视频学习时长',
`is_completed` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '是否完成观看:1,已完成,0未完成',
`content` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '记录封面图片',
`address` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '资源地址',
`status` varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '1' COMMENT '是否存在: 1存在;0不存在;',
`parent_node` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '父节点',
`type` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '类型, 如:1,课程; 2,章节; 3,知识点; 4,学习资源',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of learning_records
-- ----------------------------
INSERT INTO `learning_records` VALUES ('1800503516676349954', '1', 'd511d26df8de551bc85ce765089771b4', '', '', '', '2024-06-11 20:21:05', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503500855435266', '1', 'a2ba84374d86e85208c5906a96ea8205', '', '', '', '2024-06-11 20:21:01', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503486640939009', '1', '90ce365ae4e362f616776550e04ae0b4', '', '', '', '2024-06-11 20:20:58', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503470169907201', '1', '8721e6864387eb99b04692f125ac0a9f', '', '', '', '2024-06-11 20:20:54', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503455372402689', '1', '72e1ad71bb855ba328f8c17964697354', '', '', '', '2024-06-11 20:20:50', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503433251643394', '1', '6f5de6dd8c8d5d9d02a63c8444b9d5bb', '', '', '', '2024-06-11 20:20:45', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503413798461442', '1', '51d973f1cf0bad437da57d31f83a3232', '', '', '', '2024-06-11 20:20:40', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503397340012545', '1', '36c34a4225526dd20ee3840da61d3701', '', '', '', '2024-06-11 20:20:36', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503375982616578', '1', '2fa0fd63262230639d2c45a3acd9045c', '', '', '', '2024-06-11 20:21:17', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503532941860866', '1', 'd8d7bb93f100164659cac44ef2c4f55a', '', '', '', '2024-06-11 20:21:09', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503546241998849', '1', 'de3100cad98f76be3176dd39aa748a9e', '', '', '', '2024-06-11 20:21:12', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
INSERT INTO `learning_records` VALUES ('1800503664320045057', '2', '2fa0fd63262230639d2c45a3acd9045c', '', '', '', '2024-06-11 20:21:40', '1', '0', '', '', 'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg', '/portal', '1', '', '1');
-- ----------------------------
-- Table structure for objective_contents
-- ----------------------------
DROP TABLE IF EXISTS `objective_contents`;
CREATE TABLE `objective_contents` (
`id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`objective_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应的目标id',
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of objective_contents
-- ----------------------------
INSERT INTO `objective_contents` VALUES ('056b889ceb437abc96c759c2c9d61393', '09f36bd3e0e65016f95281eb3d4f48a7', '价值目标1');
INSERT INTO `objective_contents` VALUES ('3f85eb79c29be4a15c729d98b17676a5', 'c84dc451086f7938c28a4f757957f415', '价值目标3');
INSERT INTO `objective_contents` VALUES ('406c85c99bd2d4b9f624ca3a67c3ce66', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标2');
INSERT INTO `objective_contents` VALUES ('4ad5a1f0f584e35e7af6ef5142773990', '503dc084653ffd003cb404b62266dc7c', '知识目标1');
INSERT INTO `objective_contents` VALUES ('4b4458cd64b0a1e21b54191a89e9f83d', 'c84dc451086f7938c28a4f757957f415', '价值目标2');
INSERT INTO `objective_contents` VALUES ('53d9d78b41051696314c0b1c0efa5313', '503dc084653ffd003cb404b62266dc7c', '知识目标3');
INSERT INTO `objective_contents` VALUES ('6689ed187bcbd36309510a21ea492225', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标3');
INSERT INTO `objective_contents` VALUES ('93cc64742c6ae993b6c8d8e0e6784758', '09f36bd3e0e65016f95281eb3d4f48a7', '价值目标2');
INSERT INTO `objective_contents` VALUES ('979e59083e81f28145e1162069ffebb8', 'c84dc451086f7938c28a4f757957f415', '价值目标1');
INSERT INTO `objective_contents` VALUES ('9efcc83089e6de9945499876d1a6235a', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标1');
INSERT INTO `objective_contents` VALUES ('bdacef102860e3dd3c1c3dcd3c3ef395', '8d87cbacd499ad8b171e72a3aeeb7cab', '思政目标2');
INSERT INTO `objective_contents` VALUES ('c6b3fc522a5479e28cd3f0c9b971a871', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标3');
INSERT INTO `objective_contents` VALUES ('dc31075d57f371970c5af09fd534a9af', 'da6e7283befa8965dae0f0f39ea7f24e', '总目标2');
INSERT INTO `objective_contents` VALUES ('eca937e6f047e3b6b06d67c5b4a9beff', '53b27c94fe8af02ac8b23d9be9a2e329', '思政目标1');
INSERT INTO `objective_contents` VALUES ('f71f70ff7f6a83cf7be889eccd7015e1', '8d87cbacd499ad8b171e72a3aeeb7cab', '思政目标3');
INSERT INTO `objective_contents` VALUES ('f890c64ee471b8a22db79e33d622ee79', '8d87cbacd499ad8b171e72a3aeeb7cab', '思政目标1');
INSERT INTO `objective_contents` VALUES ('ffde482fac55e6dec5b60f6c6208d42c', '503dc084653ffd003cb404b62266dc7c', '知识目标2');
-- ----------------------------
-- Table structure for objectives_type
-- ----------------------------
DROP TABLE IF EXISTS `objectives_type`;
CREATE TABLE `objectives_type` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`type_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型名称',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `type_name`(`type_name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of objectives_type
-- ----------------------------
INSERT INTO `objectives_type` VALUES (4, '价值目标');
INSERT INTO `objectives_type` VALUES (1, '思政目标');
INSERT INTO `objectives_type` VALUES (2, '知识目标');
INSERT INTO `objectives_type` VALUES (3, '素质目标');
-- ----------------------------
-- Table structure for resource
-- ----------------------------
DROP TABLE IF EXISTS `resource`;
CREATE TABLE `resource` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资源名称',
`type` int(11) NULL DEFAULT NULL COMMENT '资源类型',
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资源路径',
`status` int(11) NULL DEFAULT NULL COMMENT '资源状态',
`tags` varchar(255) 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 resource
-- ----------------------------
-- ----------------------------
-- Table structure for resource_relationship
-- ----------------------------
DROP TABLE IF EXISTS `resource_relationship`;
CREATE TABLE `resource_relationship` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键',
`courseId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '课程id',
`chapterId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '章节id',
`knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '知识点id',
`resourceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资源id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of resource_relationship
-- ----------------------------
-- ----------------------------
-- 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(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 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(4) 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,89 +1,84 @@
//package com.teaching.backend.controller.records;
//
//
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import com.teaching.backend.common.BaseResponse;
//import com.teaching.backend.common.ResultUtils;
//
//import com.teaching.backend.model.entity.records.LearningRecords;
//import com.teaching.backend.model.vo.records.LearningRecordsVo;
//import com.teaching.backend.service.impl.records.LearningRecordsServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@RestController
//@RequestMapping("/learningrecords")
//public class LearningRecordsController {
//
// @Autowired
// private LearningRecordsServiceImpl learningRecordsService;
//
//
// /**
// * 获取当前登录用户的学习记录
// * @param m
// * @param pagenum
// * @param pagesize
// * @return
// */
// @GetMapping("/getall")
// public BaseResponse<PageInfo> getAll(Model m,
// @RequestParam(value = "pagenum", defaultValue = "1") int pagenum,
// @RequestParam(value = "pagesize", defaultValue = "15") int pagesize,
// @RequestParam String userId){
// PageHelper.startPage(pagenum,pagesize);
// List<LearningRecordsVo> cs= learningRecordsService.getAll(userId);
// List<LearningRecordsVo> pageCs = new ArrayList<>();
// //当前页面
// for(int i = (pagenum - 1) * pagesize; i < cs.size() && i < (pagenum) * pagesize; i++){
// pageCs.add(cs.get(i));
// }
// PageInfo<LearningRecordsVo> pageInfo = new PageInfo<>(pageCs);
// System.out.println("当前页面:"+pagenum);
// System.out.println("当前页面大小:"+pagesize);
// System.out.println("当前页面内容:"+pageCs);
//// PageInfo<LearningRecordsVo> pageInfo = new PageInfo<>(cs);
//// pageInfo.setPageSize(pagesize);//设置当前页面大小
//// pageInfo.setPageNum(pagenum);//设置当前页码
//// pageInfo.setSize(pagesize);//不知道是啥,---------
//// pageInfo.setTotal(cs.size());//设置总条数
// long total = pageInfo.getTotal(); // 总记录数
//// pageInfo.setPages((int)(Math.ceil((double) total / pagesize)));//设置总页数
// return ResultUtils.success(pageInfo);
// }
//
// @GetMapping("/all")
// public BaseResponse<List<LearningRecords>> All(){
// System.out.println("学习记录:"+learningRecordsService.list());
// return ResultUtils.success(learningRecordsService.list());
// }
//
// //资源类型: 1,课程学习记录,2,知识点学习记录,3课程资源学习记录
// /**
// * 添加课程记录
// * @param learningRecords
// * @return
// */
// @PostMapping("/saverecords")
// public BaseResponse<String> saveRecords(@RequestBody LearningRecords learningRecords){
// System.out.println(learningRecords);
// return ResultUtils.success(learningRecordsService.saveRecords(learningRecords));
// }
//
// /**
// * 根据id删除
// * @param ids
// * @return
// */
// @DeleteMapping("/delete")
// public BaseResponse<String> deleteRecords(@RequestParam List<Long> ids){
//
// return ResultUtils.success(learningRecordsService.delete(ids));
// }
//
//}
package com.teaching.backend.controller.records;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.records.LearningRecords;
import com.teaching.backend.model.vo.records.LearningRecordsVo;
import com.teaching.backend.service.impl.records.LearningRecordsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/learningrecords")
public class LearningRecordsController {
@Autowired
private LearningRecordsServiceImpl learningRecordsService;
/**
* 获取当前登录用户的学习记录
* @param pagenum
* @param pagesize
* @return
*/
@GetMapping("/getall")
public BaseResponse<Page> getAll(@RequestParam(value = "pagenum", defaultValue = "1") int pagenum,
@RequestParam(value = "pagesize", defaultValue = "15") int pagesize,
@RequestParam String userId){
List<LearningRecordsVo> cs= learningRecordsService.getAll(userId);
List<LearningRecordsVo> pageCs = new ArrayList<>();
//当前页面
for(int i = (pagenum - 1) * pagesize; i < cs.size() && i < (pagenum) * pagesize; i++){
pageCs.add(cs.get(i));
}
long total = cs.size(); // 总记录数
Page<LearningRecordsVo> pageInfo = new Page<>(pagenum,pagesize,total);
pageInfo.setRecords(pageCs);
System.out.println("总记录数"+pageInfo.getTotal());
System.out.println("当前页面:"+pagenum);
System.out.println("当前页面大小:"+pagesize);
System.out.println("当前页面内容:"+pageCs);
System.out.println("页面数:"+pageInfo.getPages());
pageInfo.setPages((int)(Math.ceil((double) total / pagesize)));//设置总页数
System.out.println(pageInfo.getPages());
return ResultUtils.success(pageInfo);
}
@GetMapping("/all")
public BaseResponse<List<LearningRecords>> All(){
System.out.println("学习记录:"+learningRecordsService.list());
return ResultUtils.success(learningRecordsService.list());
}
//资源类型: 1,课程学习记录,2,知识点学习记录,3课程资源学习记录
/**
* 添加课程记录
* @param learningRecords
* @return
*/
@PostMapping("/saverecords")
public BaseResponse<String> saveRecords(@RequestBody LearningRecords learningRecords){
System.out.println(learningRecords);
return ResultUtils.success(learningRecordsService.saveRecords(learningRecords));
}
/**
* 根据id删除
* @param ids
* @return
*/
@DeleteMapping("/delete")
public BaseResponse<String> deleteRecords(@RequestParam List<Long> ids){
return ResultUtils.success(learningRecordsService.delete(ids));
}
}

@ -1,16 +1,17 @@
//package com.teaching.backend.mapper.records;
package com.teaching.backend.mapper.records;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.model.entity.records.LearningRecords;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface LearningRecordsMapper extends BaseMapper<LearningRecords> {
IPage<LearningRecords> selectPageList(Page<LearningRecords> page, @Param("model")LearningRecords model);
}
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//
//import com.teaching.backend.model.entity.records.LearningRecords;
//import org.apache.ibatis.annotations.Mapper;
//import org.apache.ibatis.annotations.Param;
//
//@Mapper
//public interface LearningRecordsMapper extends BaseMapper<LearningRecords> {
// IPage<LearningRecords> selectPageList(Page<LearningRecords> page, @Param("model")LearningRecords model);
//
//}
////

@ -1,96 +1,96 @@
//package com.teaching.backend.model.entity.records;
//
//
//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.time.LocalDateTime;
//
//
//@Data
//@EqualsAndHashCode(callSuper = false)
//@Accessors(chain = true)
//@TableName("learning_records")
//public class LearningRecords {
// private static final long serialVersionUID = 1L;
//
// /**
// * 内部编号
// */
// @TableId(value = "id", type = IdType.ASSIGN_ID)
// private String id;
//
// /**
// * 用户id
// */
// private String userId;
//
// /**
// * 课程id
// */
// private String coursesId;
// /**
// * 章节id
// */
// private String chapterId;
// /**
// * 知识点id
// */
// private String knowledgePointId;
// /**
// * 资源id
// */
// private String resourceId;
// /**
// * 访问时间
// */
// private LocalDateTime accessTime;
//
// /**
// * 学习方式:打开; 1,打开过,2未打开
// */
// private String learningMethod1;
// /**
// * 学习方式:下载; 1下载过, 2未下载
// */
// private String learningMethod2;
// /**
// *视频学习时长
// */
// private String videoDuration;
//
// /**
// *是否完成观看:1,已完成,0未完成
// */
// private String isCompleted;
//
// /**
// * 记录封面图片
// */
// private String content;
// /**
// * 资源地址
// */
// private String address;
//
// /**
// * 是否存在: 1存在;0不存在;
// */
// private String status;
// /**
// * 类型, 如:1,课程; 2,章节; 3,知识点; 4,学习资源
// */
// private String type;
// /**
// * 父节点
// */
// private String parentNode;
//
//
//
//
//}
package com.teaching.backend.model.entity.records;
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.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("learning_records")
public class LearningRecords {
private static final long serialVersionUID = 1L;
/**
* 内部编号
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 用户id
*/
private String userId;
/**
* 课程id
*/
private String coursesId;
/**
* 章节id
*/
private String chapterId;
/**
* 知识点id
*/
private String knowledgePointId;
/**
* 资源id
*/
private String resourceId;
/**
* 访问时间
*/
private LocalDateTime accessTime;
/**
* 学习方式:打开; 1,打开过,2未打开
*/
private String learningMethod1;
/**
* 学习方式:下载; 1下载过, 2未下载
*/
private String learningMethod2;
/**
*视频学习时长
*/
private String videoDuration;
/**
*是否完成观看1已完成0未完成
*/
private String isCompleted;
/**
* 记录封面图片
*/
private String content;
/**
* 资源地址
*/
private String address;
/**
* 是否存在: 1存在;0不存在;
*/
private String status;
/**
* 类型, :1,课程; 2,章节; 3,知识点; 4,学习资源
*/
private String type;
/**
* 父节点
*/
private String parentNode;
}

@ -1,59 +1,59 @@
//package com.teaching.backend.model.vo.records;
//
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//import lombok.experimental.Accessors;
//
//@Data
//@EqualsAndHashCode(callSuper = false)
//@Accessors(chain = true)
//public class LearningRecordsVo {
//// private static final long serialVersionUID = 1L;
//
package com.teaching.backend.model.vo.records;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class LearningRecordsVo {
// private static final long serialVersionUID = 1L;
/**
* 内部编号
*/
private String id;
/**
* 课程名称
*/
private String coursesName;
// /**
// * 内部编号
// * 资源类型
// */
// private String id;
//
// private String type;
/**
* 封面
*/
private String content;
/**
* 资源观看人数
*/
private Long number;
/**
* 上次观看时间
*/
private String time;
/**
* 地址
*/
private String address;
// /**
// * 课程名称
// * 创建日期
// */
// private String coursesName;
//
//// /**
//// * 资源类型
//// */
//// private String type;
// private LocalDateTime createTime;
//
// /**
// * 封面
// * 更新日期
// */
// private String content;
//
// /**
// * 资源观看人数
// */
// private Long number;
//
//
// /**
// * 上次观看时间
// */
// private String time;
// /**
// * 地址
// */
// private String address;
//// /**
//// * 创建日期
//// */
//// private LocalDateTime createTime;
////
//// /**
//// * 更新日期
//// */
//// private LocalDateTime updateTime;
//
//
//
//}
// private LocalDateTime updateTime;
}

@ -164,6 +164,7 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
coursesMapper.updateById(course);
BeanUtil.copyProperties(coursesDTO, course);
course.setStatus(0);
course.setUpdateTime(LocalDateTime.now());
coursesMapper.updateById(course);
}

@ -1,185 +1,185 @@
//package com.teaching.backend.service.impl.records;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//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.mapper.records.LearningRecordsMapper;
//
//import com.teaching.backend.model.entity.records.LearningRecords;
//import com.teaching.backend.model.vo.records.LearningRecordsVo;
//import com.teaching.backend.service.impl.chapter.ChapterServiceImpl;
//import com.teaching.backend.service.impl.courses.CoursesServiceImpl;
//import com.teaching.backend.service.impl.know.IknowServiceimpl;
//import com.teaching.backend.service.records.LearningRecordsService;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.ZoneId;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//@Service
//public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMapper, LearningRecords> implements LearningRecordsService {
//
// @Autowired
// private CoursesServiceImpl coursesService;
package com.teaching.backend.service.impl.records;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.mapper.records.LearningRecordsMapper;
import com.teaching.backend.model.entity.records.LearningRecords;
import com.teaching.backend.model.vo.records.LearningRecordsVo;
import com.teaching.backend.service.impl.chapter.ChapterServiceImpl;
import com.teaching.backend.service.impl.courses.CoursesServiceImpl;
import com.teaching.backend.service.impl.know.IknowServiceimpl;
import com.teaching.backend.service.records.LearningRecordsService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMapper, LearningRecords> implements LearningRecordsService {
@Autowired
private CoursesServiceImpl coursesService;
@Autowired
private LearningRecordsMapper learningRecordsMapper;
// @Autowired
// private LearningRecordsMapper learningRecordsMapper;
//// @Autowired
//// private LearningResourceServiceImpl learningResourceService;
// @Autowired
// private IknowServiceimpl knowledgePointService;
// @Autowired
// private ChapterServiceImpl chapterService;
//
// @Override
// public IPage<LearningRecords> selectPageList(Page<LearningRecords> page, LearningRecords model) {
// return learningRecordsMapper.selectPageList(page,model);
// }
//
// @Override
// public String delete(List<Long> ids) {
// LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.in(LearningRecords::getId, ids);
// List<LearningRecords> list = this.list(lambdaQueryWrapper);
// //把即将要删除的记录状态调成0
// for (LearningRecords learningRecords : list) {
// learningRecords.setStatus("0");
// }
// this.updateBatchById(list);
//// System.out.println(this.updateBatchById(list));
//// this.remove(lambdaQueryWrapper);
// return "删除成功";
// }
//
// @Override
// public List<LearningRecordsVo> getAll(String userId){
// //格式化时间
// //格式化时间
// String strDateFormat = "yyyy-MM-dd HH:mm:ss";
// SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
//
// List<LearningRecordsVo> list = new ArrayList<>();
// //将学习记录实体转成学习记录Vo实体
// LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
// lambdaQueryWrapper1
// .orderByDesc(LearningRecords::getAccessTime)
// .eq(LearningRecords::getUserId, userId)
// .eq(LearningRecords::getStatus, "1");
// System.out.println(this.list(lambdaQueryWrapper1));
// //如果为空-------------------?????
// for (LearningRecords learningRecords : this.list(lambdaQueryWrapper1)) {
// //查找该用户的学习记录
//// if (learningRecords.getUserId().equals(userId) && learningRecords.getStatus().equals("1")){
// LearningRecordsVo learningRecordsVo = new LearningRecordsVo();//好像可以拿出去-----------??
// BeanUtils.copyProperties(learningRecords,learningRecordsVo);//从多传到少(缺少人数,和资源名称,时间需要转格式)
// //添加时间
// //LocalDateTime转Date
// Date date = Date.from(learningRecords.getAccessTime().atZone(ZoneId.systemDefault()).toInstant());
// learningRecordsVo.setTime(sdf.format(date));
// LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(LearningRecords::getCoursesId, learningRecords.getCoursesId());
//// System.out.println(learningRecords.getResourceId());
//// System.out.println("1");
//
// //添加课程名称
// switch (learningRecords.getType()) {
// case "4": //如果是资源学习
// learningRecordsVo.setCoursesName("学习资源");//设置名称 --------------------------------------------待完善
//
// break;
// case "3": //如果是知识点学习记录
// learningRecordsVo.setCoursesName(knowledgePointService.getById(learningRecords.getCoursesId()).getName());
//
// break;
// case "2": //如果是章节学习记录
// learningRecordsVo.setCoursesName(chapterService.getById(learningRecords.getCoursesId()).getName());
//
// break;
// case "1": //如果是课程学习记录
// learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName());
// break;
// }
// //添加观看人数
// //统计记录表里有多少人查看过这门资源
// long count = this.count(lambdaQueryWrapper);
// System.out.println(count);
// learningRecordsVo.setNumber(count);
// //把整合后该用户的学习记录添加到List里
// list.add(learningRecordsVo);
//// }
// }
// System.out.println(list);
// return list;
// }
//
// /**
// * 根据用户id和学习资源id来判断记录是否存在
// * @param learningRecords
// * @return
// */
// @Override
// public String saveRecords(LearningRecords learningRecords) {
// String userId = learningRecords.getUserId();
// String coursesId = learningRecords.getCoursesId();
// System.out.println("学习记录:"+learningRecords);
// //查找该用户是否观看过该学习资源
// LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper
// .eq(LearningRecords::getUserId, userId)
// .eq(LearningRecords::getCoursesId, coursesId)
// .eq(LearningRecords::getType, learningRecords.getType());
// long count = this.count(lambdaQueryWrapper);
// System.out.println("数据库:"+count);
// learningRecords.setStatus("1");//将该记录的状态设置为1
// //更新观看时间
// learningRecords.setAccessTime(LocalDateTime.now());
// //设置默认封面
// if (learningRecords.getContent() == null || learningRecords.getContent().equals("")){
// learningRecords.setContent("https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg");
// }
//// //添加记录封面
//// switch (learningRecords.getType()) {
//// case "4": //如果是资源学习
//// learningRecords.setContent(learningResourceService.getById(learningRecords.getCoursesId()).getContent());//设置封面
//// break;
//// case "3": //如果是知识点学习记录
//// learningRecords.setContent(knowledgePointService.getById(learningRecords.getCoursesId()).getContent());//设置封面
////
//// break;
//// case "2": //如果是章节学习记录
//// learningRecords.setContent(chapterService.getById(learningRecords.getCoursesId()).getContent());//设置封面
////
//// break;
//// case "1": //如果是课程学习记录
//// learningRecords.setContent(coursesService.getById(learningRecords.getCoursesId()).getImg());//设置封面
//// break;
//// }
// if (count == 0){//如果没有就新增并记录学习方式是打开还是下载
// //根据传上来的type设置
//// learningRecords.setType(learningRecords.getType());
// this.save(learningRecords);
// return "添加成功";
// }else {//有就修改记录,更新学习方式
// LearningRecords one = this.getOne(lambdaQueryWrapper);
// System.out.println(one);
// learningRecords.setId(one.getId());//找到该条记录的id并赋值给本次观看记录
// if ( one.getLearningMethod1() != null && one.getLearningMethod1().equals("1")){
// learningRecords.setLearningMethod1(one.getLearningMethod1());
// private LearningResourceServiceImpl learningResourceService;
@Autowired
private IknowServiceimpl knowledgePointService;
@Autowired
private ChapterServiceImpl chapterService;
@Override
public IPage<LearningRecords> selectPageList(Page<LearningRecords> page, LearningRecords model) {
return learningRecordsMapper.selectPageList(page,model);
}
@Override
public String delete(List<Long> ids) {
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(LearningRecords::getId, ids);
List<LearningRecords> list = this.list(lambdaQueryWrapper);
//把即将要删除的记录状态调成0
for (LearningRecords learningRecords : list) {
learningRecords.setStatus("0");
}
this.updateBatchById(list);
// System.out.println(this.updateBatchById(list));
// this.remove(lambdaQueryWrapper);
return "删除成功";
}
@Override
public List<LearningRecordsVo> getAll(String userId){
//格式化时间
//格式化时间
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
List<LearningRecordsVo> list = new ArrayList<>();
//将学习记录实体转成学习记录Vo实体
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
lambdaQueryWrapper1
.orderByDesc(LearningRecords::getAccessTime)
.eq(LearningRecords::getUserId, userId)
.eq(LearningRecords::getStatus, "1");
System.out.println(this.list(lambdaQueryWrapper1));
//如果为空-------------------?????
for (LearningRecords learningRecords : this.list(lambdaQueryWrapper1)) {
//查找该用户的学习记录
// if (learningRecords.getUserId().equals(userId) && learningRecords.getStatus().equals("1")){
LearningRecordsVo learningRecordsVo = new LearningRecordsVo();//好像可以拿出去-----------??
BeanUtils.copyProperties(learningRecords,learningRecordsVo);//从多传到少(缺少人数,和资源名称,时间需要转格式)
//添加时间
//LocalDateTime转Date
Date date = Date.from(learningRecords.getAccessTime().atZone(ZoneId.systemDefault()).toInstant());
learningRecordsVo.setTime(sdf.format(date));
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(LearningRecords::getCoursesId, learningRecords.getCoursesId());
// System.out.println(learningRecords.getResourceId());
// System.out.println("1");
//添加课程名称
switch (learningRecords.getType()) {
case "4": //如果是资源学习
learningRecordsVo.setCoursesName("学习资源");//设置名称 --------------------------------------------待完善
break;
case "3": //如果是知识点学习记录
learningRecordsVo.setCoursesName(knowledgePointService.getById(learningRecords.getCoursesId()).getName());
break;
case "2": //如果是章节学习记录
learningRecordsVo.setCoursesName(chapterService.getById(learningRecords.getCoursesId()).getName());
break;
case "1": //如果是课程学习记录
learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName());
break;
}
//添加观看人数
//统计记录表里有多少人查看过这门资源
long count = this.count(lambdaQueryWrapper);
System.out.println(count);
learningRecordsVo.setNumber(count);
//把整合后该用户的学习记录添加到List里
list.add(learningRecordsVo);
// }
// if (one.getLearningMethod2() != null && one.getLearningMethod2().equals("1")){
// learningRecords.setLearningMethod2(one.getLearningMethod2());
// }
// this.updateById(learningRecords);
// return "修改成功";
}
System.out.println(list);
return list;
}
/**
* 根据用户id和学习资源id来判断记录是否存在
* @param learningRecords
* @return
*/
@Override
public String saveRecords(LearningRecords learningRecords) {
String userId = learningRecords.getUserId();
String coursesId = learningRecords.getCoursesId();
System.out.println("学习记录:"+learningRecords);
//查找该用户是否观看过该学习资源
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper
.eq(LearningRecords::getUserId, userId)
.eq(LearningRecords::getCoursesId, coursesId)
.eq(LearningRecords::getType, learningRecords.getType());
long count = this.count(lambdaQueryWrapper);
System.out.println("数据库:"+count);
learningRecords.setStatus("1");//将该记录的状态设置为1
//更新观看时间
learningRecords.setAccessTime(LocalDateTime.now());
//设置默认封面
if (learningRecords.getContent() == null || learningRecords.getContent().equals("")){
learningRecords.setContent("https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg");
}
// //添加记录封面
// switch (learningRecords.getType()) {
// case "4": //如果是资源学习
// learningRecords.setContent(learningResourceService.getById(learningRecords.getCoursesId()).getContent());//设置封面
// break;
// case "3": //如果是知识点学习记录
// learningRecords.setContent(knowledgePointService.getById(learningRecords.getCoursesId()).getContent());//设置封面
//
// break;
// case "2": //如果是章节学习记录
// learningRecords.setContent(chapterService.getById(learningRecords.getCoursesId()).getContent());//设置封面
//
// break;
// case "1": //如果是课程学习记录
// learningRecords.setContent(coursesService.getById(learningRecords.getCoursesId()).getImg());//设置封面
// break;
// }
// }
//
//
//}
if (count == 0){//如果没有就新增并记录学习方式是打开还是下载
//根据传上来的type设置
// learningRecords.setType(learningRecords.getType());
this.save(learningRecords);
return "添加成功";
}else {//有就修改记录,更新学习方式
LearningRecords one = this.getOne(lambdaQueryWrapper);
System.out.println(one);
learningRecords.setId(one.getId());//找到该条记录的id并赋值给本次观看记录
if ( one.getLearningMethod1() != null && one.getLearningMethod1().equals("1")){
learningRecords.setLearningMethod1(one.getLearningMethod1());
}
if (one.getLearningMethod2() != null && one.getLearningMethod2().equals("1")){
learningRecords.setLearningMethod2(one.getLearningMethod2());
}
this.updateById(learningRecords);
return "修改成功";
}
}
}

@ -1,19 +1,19 @@
//package com.teaching.backend.service.records;
//
//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.model.entity.records.LearningRecords;
//import com.teaching.backend.model.vo.records.LearningRecordsVo;
//
//
//import java.util.List;
//
//public interface LearningRecordsService extends IService<LearningRecords> {
// public List<LearningRecordsVo> getAll(String username);
// public String saveRecords(LearningRecords learningRecords);
// IPage<LearningRecords> selectPageList(Page<LearningRecords> page, LearningRecords model);
//
// public String delete(List<Long> ids);
//
//}
package com.teaching.backend.service.records;
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.model.entity.records.LearningRecords;
import com.teaching.backend.model.vo.records.LearningRecordsVo;
import java.util.List;
public interface LearningRecordsService extends IService<LearningRecords> {
public List<LearningRecordsVo> getAll(String username);
public String saveRecords(LearningRecords learningRecords);
IPage<LearningRecords> selectPageList(Page<LearningRecords> page, LearningRecords model);
public String delete(List<Long> ids);
}

Loading…
Cancel
Save