diff --git a/sql/teaching_db6.0.sql b/sql/teaching_db6.0.sql index fc191b8..0b60265 100644 --- a/sql/teaching_db6.0.sql +++ b/sql/teaching_db6.0.sql @@ -1,514 +1,515 @@ -/* -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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '毕业要求id', - `temp` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '毕业要求', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -/*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 ('226ab3b2fa8364bd39a9843a45204051',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','价值目标',4,NULL,NULL,NULL),('38e983568790404eec9ea56f6d9e679d',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','知识目标',2,NULL,NULL,NULL),('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','知识目标',2,NULL,NULL,NULL),('53b27c94fe8af02ac8b23d9be9a2e329','2024-06-03 11:32:19',NULL,'da6e7283befa8965dae0f0f39ea7f24e','0','思政目标',1,NULL,NULL,NULL),('7a302cd72d653647778840b42f4e076a','2024-06-03 10:43:13',NULL,'0','0','软件构造课程总体目标',NULL,'ee2447b4463a5ad3f47e1744d912a824',NULL,NULL),('89dfcb62f7bbe9a95c3f85f65fcd2de7',NULL,NULL,'0','1','测试课程AB课程总体目标',NULL,'ef9a33abd58bc06ac36759d3e4cc83a9',NULL,NULL),('9d4395c460ab954b7c995f759ffd7004',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','思政目标',1,NULL,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','价值目标',4,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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程类别', - `nature` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程性质', - `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程名称', - `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程编码', - `semester` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '考核类型', - `assessmentway` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '考核方式', - `teacher` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '负责教师', - `teachermethod` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '教学方法', - `teacherway` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '教学方式', - `description` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '课程简介', - `status` int(1) DEFAULT '0' COMMENT '课程状态 0未在修改中 1修改中', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -/*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`,`status`) 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,xiao1111','暂定','线下授课',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','暂定','线下授课',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','暂定','线下授课',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.60',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','暂定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','暂定','线下机房授课',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','暂定','线下机房授课',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,xiao1111','暂定','线下机房授课',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),('ef9a33abd58bc06ac36759d3e4cc83a9','2024-06-12 22:15:28',NULL,'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/ppGmBQJHhEeOXdEUGdys2.jpg','1','1','测试课程AB','111014',NULL,'4.00',64,NULL,NULL,NULL,NULL,NULL,'1','2','2140110334','','','',0); - -/*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 `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 DEFAULT NULL COMMENT '知识点名称', - `info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '简介', - `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点内容', - `img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点图片', - `hour` varchar(255) 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 `know` */ - -/*Table structure for table `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 DEFAULT NULL COMMENT '章节id', - `courseId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '课程id', - `knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `know_relationship` */ - -/*Table structure for table `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 DEFAULT NULL COMMENT '用户id', - `courses_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '课程id', - `chapter_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '章节id', - `knowledge_point_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '知识点id', - `resource_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '资源id', - `access_time` datetime DEFAULT NULL COMMENT '访问时间', - `learning_method1` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '0' COMMENT '学习方式:打开; 1,打开过,2未打开', - `learning_method2` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '0' COMMENT '学习方式:下载; 1下载过, 2未下载', - `video_duration` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '视频学习时长', - `is_completed` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '是否完成观看:1,已完成,0未完成', - `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '记录封面图片', - `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '资源地址', - `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '1' COMMENT '是否存在: 1存在;0不存在;', - `parent_node` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '父节点', - `type` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '类型, 如:1,课程; 2,章节; 3,知识点; 4,学习资源', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `learning_records` */ - -insert into `learning_records`(`id`,`user_id`,`courses_id`,`chapter_id`,`knowledge_point_id`,`resource_id`,`access_time`,`learning_method1`,`learning_method2`,`video_duration`,`is_completed`,`content`,`address`,`status`,`parent_node`,`type`) values ('1','1','290bf0217c6a1569abf225289c7e11ea',NULL,NULL,NULL,'2024-05-31 21:35:11',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('2','2','d511d26df8de551bc85ce765089771b4',NULL,NULL,NULL,'2024-05-31 00:00:00',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('3','1','d511d26df8de551bc85ce765089771b4',NULL,NULL,NULL,'2024-05-31 00:00:00',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('4','1','1','','','','2024-06-07 10:49:42','1','0','','','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0','','2'),('5','1','2',NULL,NULL,NULL,'2024-05-02 00:00:00',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('6','1','3',NULL,NULL,NULL,'2024-06-04 10:10:49',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('7','1','4',NULL,NULL,NULL,'2024-06-04 10:12:01',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0',NULL,'1'),('96','1','5',NULL,NULL,NULL,'2024-05-30 20:46:21',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('8','2','3',NULL,NULL,NULL,'2024-06-04 10:15:01',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('75','2','4',NULL,NULL,NULL,'2024-06-04 10:17:16',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('71','2','5',NULL,NULL,NULL,'2024-06-04 12:01:48',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('1797841286352658434','3','5','','','','2024-06-06 16:59:38','1','1','','','','/portal','1','','1'),('1798911495222161409','1','1','','','','2024-06-07 10:54:57','1','0','','','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0','','1'),('1797984330104299521','3','1',NULL,NULL,NULL,'2024-06-04 21:30:44',NULL,'1','1','1','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.baidu.com/','1',NULL,'1'); - -/*Table structure for table `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 DEFAULT NULL COMMENT '对应的目标id', - `content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '内容', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -/*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'),('b5c6684d8dbdfd5b706991cc25b9b34a','226ab3b2fa8364bd39a9843a45204051','价值目标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` int(5) NOT NULL, - `type_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型名称', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `type_name` (`type_name`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -/*Data for the table `objectives_type` */ - -insert into `objectives_type`(`id`,`type_name`) values (4,'价值目标'),(1,'思政目标'),(2,'知识目标'),(3,'素质目标'); - -/*Table structure for table `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 DEFAULT NULL COMMENT '资源名称', - `type` int(11) DEFAULT NULL COMMENT '资源类型', - `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源路径', - `status` int(11) DEFAULT NULL COMMENT '资源状态', - `tags` varchar(255) 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 `resource` */ - -/*Table structure for table `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 DEFAULT NULL COMMENT '课程id', - `chapterId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '章节id', - `knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点id', - `resourceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `resource_relationship` */ - -/*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 `ums_admin` */ - -DROP TABLE IF EXISTS `ums_admin`; - -CREATE TABLE `ums_admin` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户名', - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '密码', - `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', - `nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '昵称', - `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像', - `create_time` datetime DEFAULT NULL COMMENT '注册时间', - `status` int(11) DEFAULT '1' COMMENT '帐号启用状态:0->禁用;1->启用', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_admin` */ - -insert into `ums_admin`(`id`,`username`,`password`,`phone`,`nick_name`,`icon`,`create_time`,`status`) values (2,'123','$2a$10$ACn80kN2ZEREGH3yOce9mui/KoWQllCHjNVXzXzrTI3gKJi/LB/YK','123456789','','','2024-06-05 23:23:45',1),(3,'youhang','$2a$10$TYJcMWBdDmmYfV/Kxi771ee7krjYJCLzI8O6MyjCofty9Y0OPLEna','13547534472','yy','','2024-06-12 15:09:10',1),(4,'xiao1111','$2a$10$lDwfuRcOuNNdSXhmcwV9w.2SUblbwlS4ipxHXmqzTpw54CvxTwtU.','','','','2024-06-12 16:13:34',1),(5,'2140110334','$2a$10$3m3wQGx8R1VoOJVEgRuoVewIG46w6tj28HmzDnFevW8fqibggEb8m','15660622831','','','2024-06-12 20:11:31',1); - -/*Table structure for table `ums_admin_role_relation` */ - -DROP TABLE IF EXISTS `ums_admin_role_relation`; - -CREATE TABLE `ums_admin_role_relation` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `admin_id` int(11) DEFAULT NULL, - `role_id` int(11) 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 `ums_admin_role_relation` */ - -insert into `ums_admin_role_relation`(`id`,`admin_id`,`role_id`) values (1,3,2),(2,4,1),(3,5,1); - -/*Table structure for table `ums_menu` */ - -DROP TABLE IF EXISTS `ums_menu`; - -CREATE TABLE `ums_menu` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `parent_id` int(11) DEFAULT NULL COMMENT '父级ID', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '菜单名称', - `level` int(11) DEFAULT NULL COMMENT '菜单级数', - `sort` int(11) DEFAULT NULL COMMENT '菜单排序', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '前端名称', - `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '前端图标', - `hidden` int(11) DEFAULT NULL COMMENT '前端隐藏', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_menu` */ - -insert into `ums_menu`(`id`,`parent_id`,`create_time`,`title`,`level`,`sort`,`name`,`icon`,`hidden`) values (1,NULL,'2024-06-12 15:44:52','个人中心',NULL,NULL,'Home',NULL,NULL),(2,NULL,'2024-06-12 15:45:19','课程',NULL,NULL,'Course',NULL,NULL),(3,NULL,'2024-06-12 15:45:26','学生',NULL,NULL,'Student',NULL,NULL),(4,NULL,'2024-06-12 15:45:34','分组',NULL,NULL,'Group',NULL,NULL),(5,NULL,'2024-06-12 15:45:38','消息',NULL,NULL,'Message',NULL,NULL),(6,NULL,'2024-06-12 15:45:44','课程基本信息',NULL,NULL,'BasicCourseInformation',NULL,NULL),(7,NULL,'2024-06-12 15:46:48','课程目标',NULL,NULL,'CourseObjectives',NULL,NULL),(8,NULL,'2024-06-12 15:46:53','课程章节',NULL,NULL,'CourseChapters',NULL,NULL),(9,NULL,'2024-06-12 15:46:59','知识点',NULL,NULL,'KnowledgePoints',NULL,NULL),(10,NULL,'2024-06-12 15:47:04','课程图谱',NULL,NULL,'CurriculumMap',NULL,NULL),(11,NULL,'2024-06-12 15:47:10','课程资源',NULL,NULL,'CourseResources',NULL,NULL),(12,NULL,'2024-06-12 15:47:16','课程学习记录',NULL,NULL,'LearningProcess',NULL,NULL),(13,NULL,'2024-06-12 15:49:09','课程收藏',NULL,NULL,'CourseCollections',NULL,NULL),(14,NULL,'2024-06-12 15:49:17','课程点赞',NULL,NULL,'Courselikes',NULL,NULL),(15,NULL,'2024-06-12 15:50:03','网站首页',NULL,NULL,'WebHome',NULL,NULL),(16,NULL,'2024-06-12 15:50:09','课程首页',NULL,NULL,'CourseHome',NULL,NULL),(17,NULL,'2024-06-12 15:50:15','学习路径推荐',NULL,NULL,'LearningPathRecommendations',NULL,NULL),(18,NULL,'2024-06-12 15:51:24','知识点学习',NULL,NULL,'KnowledgePointLearning',NULL,NULL),(19,NULL,'2024-06-12 15:51:31','课程报告',NULL,NULL,'CourseReports',NULL,NULL),(20,NULL,'2024-06-12 15:53:15','学习过程',NULL,NULL,'MyCourseStudyManagement',NULL,NULL); - -/*Table structure for table `ums_resource` */ - -DROP TABLE IF EXISTS `ums_resource`; - -CREATE TABLE `ums_resource` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源名称', - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源URL', - `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', - `category_id` int(11) DEFAULT NULL COMMENT '资源分类ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_resource` */ - -insert into `ums_resource`(`id`,`create_time`,`name`,`url`,`description`,`category_id`) values (1,'2024-06-04 09:56:19','首页','/home/advertise/**',NULL,1); - -/*Table structure for table `ums_resource_category` */ - -DROP TABLE IF EXISTS `ums_resource_category`; - -CREATE TABLE `ums_resource_category` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '分类名称', - `sort` int(11) DEFAULT NULL COMMENT '排序', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_resource_category` */ - -insert into `ums_resource_category`(`id`,`create_time`,`name`,`sort`) values (1,'2024-06-04 09:57:23','首页模块',0); - -/*Table structure for table `ums_role` */ - -DROP TABLE IF EXISTS `ums_role`; - -CREATE TABLE `ums_role` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称', - `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', - `admin_count` int(11) DEFAULT NULL COMMENT '后台用户数量', - `create_time` datetime NOT NULL COMMENT '创建时间', - `status` int(11) DEFAULT '1' COMMENT '启用状态:0->禁用;1->启用', - `sort` int(11) DEFAULT '0', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_role` */ - -insert into `ums_role`(`id`,`name`,`description`,`admin_count`,`create_time`,`status`,`sort`) values (1,'老师','能查看自己和所有学生的信息',0,'2024-06-04 09:59:47',1,0),(2,'学生','只能查看自己信息',0,'2024-06-04 10:02:15',1,0); - -/*Table structure for table `ums_role_menu_relation` */ - -DROP TABLE IF EXISTS `ums_role_menu_relation`; - -CREATE TABLE `ums_role_menu_relation` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `role_id` int(11) DEFAULT NULL COMMENT '角色ID', - `menu_id` int(11) DEFAULT NULL COMMENT '菜单ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_role_menu_relation` */ - -insert into `ums_role_menu_relation`(`id`,`role_id`,`menu_id`) values (1,1,1),(2,1,2),(3,1,3),(4,1,4),(5,1,5),(6,1,6),(7,1,7),(8,1,8),(9,1,9),(10,1,10),(11,2,1),(12,2,5),(13,2,11),(14,2,12),(15,2,13),(16,2,14),(17,2,15),(18,2,16),(19,2,17),(20,2,18),(21,2,19),(22,2,20); - -/*Table structure for table `ums_role_resource_relation` */ - -DROP TABLE IF EXISTS `ums_role_resource_relation`; - -CREATE TABLE `ums_role_resource_relation` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `role_id` int(11) DEFAULT NULL COMMENT '角色ID', - `resource_id` int(11) DEFAULT NULL COMMENT '资源ID', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_role_resource_relation` */ - -insert into `ums_role_resource_relation`(`id`,`role_id`,`resource_id`) values (1,1,1),(2,2,1); - -/*Table structure for table `ums_student` */ - -DROP TABLE IF EXISTS `ums_student`; - -CREATE TABLE `ums_student` ( - `id` int(11) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '姓名', - `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性别', - `nationality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '民族', - `number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学号', - `birthday` datetime DEFAULT NULL COMMENT '生日', - `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', - `faculty` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '院系', - `major` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '专业', - `year` date DEFAULT NULL COMMENT '入学年份', - `class_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '班级', - `user_id` int(11) DEFAULT NULL COMMENT 'user_id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_student` */ - -/*Table structure for table `ums_teacher` */ - -DROP TABLE IF EXISTS `ums_teacher`; - -CREATE TABLE `ums_teacher` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '姓名', - `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性别', - `nationality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '民族', - `profession` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '专业', - `education` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学历', - `degree` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学位', - `professional_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '职称', - `emergency_contact` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', - `join_work_time` datetime DEFAULT NULL COMMENT '参加工作时间', - `political_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '政治面貌', - `user_id` int(11) DEFAULT NULL COMMENT 'user_id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; - -/*Data for the table `ums_teacher` */ - -insert into `ums_teacher`(`id`,`name`,`sex`,`nationality`,`profession`,`education`,`degree`,`professional_title`,`emergency_contact`,`join_work_time`,`political_status`,`user_id`) values (1,'张俊豪','男',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5),(2,'肖海南','男',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4); - -/*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=1793257199111405571 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),(1793257199111405570,'2140110334','84fccf8fe96cab775b23698a9c9b7eaa','张俊豪',NULL,'admin','2024-06-11 21:53:20','2024-06-11 21:53:25',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 */; +/* +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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '毕业要求id', + `temp` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '毕业要求', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +/*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 ('226ab3b2fa8364bd39a9843a45204051',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','价值目标',4,NULL,NULL,NULL),('38e983568790404eec9ea56f6d9e679d',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','知识目标',2,NULL,NULL,NULL),('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','知识目标',2,NULL,NULL,NULL),('53b27c94fe8af02ac8b23d9be9a2e329','2024-06-03 11:32:19',NULL,'da6e7283befa8965dae0f0f39ea7f24e','0','思政目标',1,NULL,NULL,NULL),('7a302cd72d653647778840b42f4e076a','2024-06-03 10:43:13',NULL,'0','0','软件构造课程总体目标',NULL,'ee2447b4463a5ad3f47e1744d912a824',NULL,NULL),('89dfcb62f7bbe9a95c3f85f65fcd2de7',NULL,NULL,'0','1','测试课程AB课程总体目标',NULL,'ef9a33abd58bc06ac36759d3e4cc83a9',NULL,NULL),('9d4395c460ab954b7c995f759ffd7004',NULL,NULL,'89dfcb62f7bbe9a95c3f85f65fcd2de7','0','思政目标',1,NULL,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','价值目标',4,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) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程类别', + `nature` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程性质', + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程名称', + `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '课程编码', + `semester` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '考核类型', + `assessmentway` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '考核方式', + `teacher` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '负责教师', + `teachermethod` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '教学方法', + `teacherway` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '教学方式', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '课程简介', + `status` int(1) DEFAULT '0' COMMENT '课程状态 0未在修改中 1修改中', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +/*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`,`status`) 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,xiao1111','暂定','线下授课',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','暂定','线下授课',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','暂定','线下授课',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.60',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','暂定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','暂定','线下机房授课',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','暂定','线下机房授课',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,xiao1111','暂定','线下机房授课',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),('ef9a33abd58bc06ac36759d3e4cc83a9','2024-06-12 22:15:28',NULL,'http://teaching-edu123.oss-cn-beijing.aliyuncs.com/ppGmBQJHhEeOXdEUGdys2.jpg','1','1','测试课程AB','111014',NULL,'4.00',64,NULL,NULL,NULL,NULL,NULL,'1','2','2140110334','','','',0); + +/*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 `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 DEFAULT NULL COMMENT '知识点名称', + `info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '简介', + `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点内容', + `img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点图片', + `hour` varchar(255) 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 `know` */ + +/*Table structure for table `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 DEFAULT NULL COMMENT '章节id', + `courseId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '课程id', + `knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `know_relationship` */ + +/*Table structure for table `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 DEFAULT NULL COMMENT '用户id', + `courses_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '课程id', + `chapter_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '章节id', + `knowledge_point_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '知识点id', + `resource_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '资源id', + `access_time` datetime DEFAULT NULL COMMENT '访问时间', + `learning_method1` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '0' COMMENT '学习方式:打开; 1,打开过,2未打开', + `learning_method2` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '0' COMMENT '学习方式:下载; 1下载过, 2未下载', + `video_duration` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '视频学习时长', + `is_completed` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '是否完成观看:1,已完成,0未完成', + `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '记录封面图片', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '资源地址', + `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '1' COMMENT '是否存在: 1存在;0不存在;', + `parent_node` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '父节点', + `type` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '类型, 如:1,课程; 2,章节; 3,知识点; 4,学习资源', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `learning_records` */ + +insert into `learning_records`(`id`,`user_id`,`courses_id`,`chapter_id`,`knowledge_point_id`,`resource_id`,`access_time`,`learning_method1`,`learning_method2`,`video_duration`,`is_completed`,`content`,`address`,`status`,`parent_node`,`type`) values ('1','1','290bf0217c6a1569abf225289c7e11ea',NULL,NULL,NULL,'2024-05-31 21:35:11',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('2','2','d511d26df8de551bc85ce765089771b4',NULL,NULL,NULL,'2024-05-31 00:00:00',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('3','1','d511d26df8de551bc85ce765089771b4',NULL,NULL,NULL,'2024-05-31 00:00:00',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('4','1','1','','','','2024-06-07 10:49:42','1','0','','','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0','','2'),('5','1','2',NULL,NULL,NULL,'2024-05-02 00:00:00',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('6','1','3',NULL,NULL,NULL,'2024-06-04 10:10:49',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('7','1','4',NULL,NULL,NULL,'2024-06-04 10:12:01',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0',NULL,'1'),('96','1','5',NULL,NULL,NULL,'2024-05-30 20:46:21',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','1',NULL,'1'),('8','2','3',NULL,NULL,NULL,'2024-06-04 10:15:01',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('75','2','4',NULL,NULL,NULL,'2024-06-04 10:17:16',NULL,'0',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('71','2','5',NULL,NULL,NULL,'2024-06-04 12:01:48',NULL,'1',NULL,NULL,'https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.taobao.com/','1',NULL,'1'),('1797841286352658434','3','5','','','','2024-06-06 16:59:38','1','1','','','','/portal','1','','1'),('1798911495222161409','1','1','','','','2024-06-07 10:54:57','1','0','','','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','/portal','0','','1'),('1797984330104299521','3','1',NULL,NULL,NULL,'2024-06-04 21:30:44',NULL,'1','1','1','https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg','https://www.baidu.com/','1',NULL,'1'); + +/*Table structure for table `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 DEFAULT NULL COMMENT '对应的目标id', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '内容', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +/*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'),('b5c6684d8dbdfd5b706991cc25b9b34a','226ab3b2fa8364bd39a9843a45204051','价值目标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` int(5) NOT NULL, + `type_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型名称', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `type_name` (`type_name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +/*Data for the table `objectives_type` */ + +insert into `objectives_type`(`id`,`type_name`) values (4,'价值目标'),(1,'思政目标'),(2,'知识目标'),(3,'素质目标'); + +/*Table structure for table `resourceMysql` */ + +DROP TABLE IF EXISTS `resourceMysql`; + +CREATE TABLE `resourceMysql` ( + `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 DEFAULT NULL COMMENT '资源名称', + `type` int(11) DEFAULT NULL COMMENT '资源类型', + `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源路径', + `status` int(11) DEFAULT NULL COMMENT '资源状态', + `tags` varchar(255) 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 `resourceMysql` */ + +/*Table structure for table `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 DEFAULT NULL COMMENT '课程id', + `chapterId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '章节id', + `knowId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '知识点id', + `resourceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `resource_relationship` */ + +/*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 `ums_admin` */ + +DROP TABLE IF EXISTS `ums_admin`; + +CREATE TABLE `ums_admin` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户名', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '密码', + `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', + `nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '昵称', + `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像', + `create_time` datetime DEFAULT NULL COMMENT '注册时间', + `status` int(11) DEFAULT '1' COMMENT '帐号启用状态:0->禁用;1->启用', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_admin` */ + +insert into `ums_admin`(`id`,`username`,`password`,`phone`,`nick_name`,`icon`,`create_time`,`status`) values (2,'123','$2a$10$ACn80kN2ZEREGH3yOce9mui/KoWQllCHjNVXzXzrTI3gKJi/LB/YK','123456789','','','2024-06-05 23:23:45',1),(3,'youhang','$2a$10$TYJcMWBdDmmYfV/Kxi771ee7krjYJCLzI8O6MyjCofty9Y0OPLEna','13547534472','yy','','2024-06-12 15:09:10',1),(4,'xiao1111','$2a$10$lDwfuRcOuNNdSXhmcwV9w.2SUblbwlS4ipxHXmqzTpw54CvxTwtU.','','','','2024-06-12 16:13:34',1),(5,'2140110334','$2a$10$3m3wQGx8R1VoOJVEgRuoVewIG46w6tj28HmzDnFevW8fqibggEb8m','15660622831','','','2024-06-12 20:11:31',1); + +/*Table structure for table `ums_admin_role_relation` */ + +DROP TABLE IF EXISTS `ums_admin_role_relation`; + +CREATE TABLE `ums_admin_role_relation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `admin_id` int(11) DEFAULT NULL, + `role_id` int(11) 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 `ums_admin_role_relation` */ + +insert into `ums_admin_role_relation`(`id`,`admin_id`,`role_id`) values (1,3,2),(2,4,1),(3,5,1); + +/*Table structure for table `ums_menu` */ + +DROP TABLE IF EXISTS `ums_menu`; + +CREATE TABLE `ums_menu` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `parent_id` int(11) DEFAULT NULL COMMENT '父级ID', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '菜单名称', + `level` int(11) DEFAULT NULL COMMENT '菜单级数', + `sort` int(11) DEFAULT NULL COMMENT '菜单排序', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '前端名称', + `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '前端图标', + `hidden` int(11) DEFAULT NULL COMMENT '前端隐藏', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_menu` */ + +insert into `ums_menu`(`id`,`parent_id`,`create_time`,`title`,`level`,`sort`,`name`,`icon`,`hidden`) values (1,NULL,'2024-06-12 15:44:52','个人中心',NULL,NULL,'Home',NULL,NULL),(2,NULL,'2024-06-12 15:45:19','课程',NULL,NULL,'Course',NULL,NULL),(3,NULL,'2024-06-12 15:45:26','学生',NULL,NULL,'Student',NULL,NULL),(4,NULL,'2024-06-12 15:45:34','分组',NULL,NULL,'Group',NULL,NULL),(5,NULL,'2024-06-12 15:45:38','消息',NULL,NULL,'Message',NULL,NULL),(6,NULL,'2024-06-12 15:45:44','课程基本信息',NULL,NULL,'BasicCourseInformation',NULL,NULL),(7,NULL,'2024-06-12 15:46:48','课程目标',NULL,NULL,'CourseObjectives',NULL,NULL),(8,NULL,'2024-06-12 15:46:53','课程章节',NULL,NULL,'CourseChapters',NULL,NULL),(9,NULL,'2024-06-12 15:46:59','知识点',NULL,NULL,'KnowledgePoints',NULL,NULL),(10,NULL,'2024-06-12 15:47:04','课程图谱',NULL,NULL,'CurriculumMap',NULL,NULL),(11,NULL,'2024-06-12 15:47:10','课程资源',NULL,NULL,'CourseResources',NULL,NULL),(12,NULL,'2024-06-12 15:47:16','课程学习记录',NULL,NULL,'LearningProcess',NULL,NULL),(13,NULL,'2024-06-12 15:49:09','课程收藏',NULL,NULL,'CourseCollections',NULL,NULL),(14,NULL,'2024-06-12 15:49:17','课程点赞',NULL,NULL,'Courselikes',NULL,NULL),(15,NULL,'2024-06-12 15:50:03','网站首页',NULL,NULL,'WebHome',NULL,NULL),(16,NULL,'2024-06-12 15:50:09','课程首页',NULL,NULL,'CourseHome',NULL,NULL),(17,NULL,'2024-06-12 15:50:15','学习路径推荐',NULL,NULL,'LearningPathRecommendations',NULL,NULL),(18,NULL,'2024-06-12 15:51:24','知识点学习',NULL,NULL,'KnowledgePointLearning',NULL,NULL),(19,NULL,'2024-06-12 15:51:31','课程报告',NULL,NULL,'CourseReports',NULL,NULL),(20,NULL,'2024-06-12 15:53:15','学习过程',NULL,NULL,'MyCourseStudyManagement',NULL,NULL); + +/*Table structure for table `ums_resource` */ + +DROP TABLE IF EXISTS `ums_resource`; + +CREATE TABLE `ums_resource` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源名称', + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '资源URL', + `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `category_id` int(11) DEFAULT NULL COMMENT '资源分类ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_resource` */ + +insert into `ums_resource`(`id`,`create_time`,`name`,`url`,`description`,`category_id`) values (1,'2024-06-04 09:56:19','首页','/home/advertise/**',NULL,1); + +/*Table structure for table `ums_resource_category` */ + +DROP TABLE IF EXISTS `ums_resource_category`; + +CREATE TABLE `ums_resource_category` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '分类名称', + `sort` int(11) DEFAULT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_resource_category` */ + +insert into `ums_resource_category`(`id`,`create_time`,`name`,`sort`) values (1,'2024-06-04 09:57:23','首页模块',0); + +/*Table structure for table `ums_role` */ + +DROP TABLE IF EXISTS `ums_role`; + +CREATE TABLE `ums_role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称', + `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `admin_count` int(11) DEFAULT NULL COMMENT '后台用户数量', + `create_time` datetime NOT NULL COMMENT '创建时间', + `status` int(11) DEFAULT '1' COMMENT '启用状态:0->禁用;1->启用', + `sort` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_role` */ + +insert into `ums_role`(`id`,`name`,`description`,`admin_count`,`create_time`,`status`,`sort`) values (1,'老师','能查看自己和所有学生的信息',0,'2024-06-04 09:59:47',1,0),(2,'学生','只能查看自己信息',0,'2024-06-04 10:02:15',1,0); + +/*Table structure for table `ums_role_menu_relation` */ + +DROP TABLE IF EXISTS `ums_role_menu_relation`; + +CREATE TABLE `ums_role_menu_relation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `role_id` int(11) DEFAULT NULL COMMENT '角色ID', + `menu_id` int(11) DEFAULT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_role_menu_relation` */ + +insert into `ums_role_menu_relation`(`id`,`role_id`,`menu_id`) values (1,1,1),(2,1,2),(3,1,3),(4,1,4),(5,1,5),(6,1,6),(7,1,7),(8,1,8),(9,1,9),(10,1,10),(11,2,1),(12,2,5),(13,2,11),(14,2,12),(15,2,13),(16,2,14),(17,2,15),(18,2,16),(19,2,17),(20,2,18),(21,2,19),(22,2,20); + +/*Table structure for table `ums_role_resource_relation` */ + +DROP TABLE IF EXISTS `ums_role_resource_relation`; + +CREATE TABLE `ums_role_resource_relation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `role_id` int(11) DEFAULT NULL COMMENT '角色ID', + `resource_id` int(11) DEFAULT NULL COMMENT '资源ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_role_resource_relation` */ + +insert into `ums_role_resource_relation`(`id`,`role_id`,`resource_id`) values (1,1,1),(2,2,1); + +/*Table structure for table `ums_student` */ + +DROP TABLE IF EXISTS `ums_student`; + +CREATE TABLE `ums_student` ( + `id` int(11) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '姓名', + `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性别', + `nationality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '民族', + `number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学号', + `birthday` datetime DEFAULT NULL COMMENT '生日', + `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', + `faculty` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '院系', + `major` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '专业', + `year` date DEFAULT NULL COMMENT '入学年份', + `class_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '班级', + `user_id` int(11) DEFAULT NULL COMMENT 'user_id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_student` */ + +/*Table structure for table `ums_teacher` */ + +DROP TABLE IF EXISTS `ums_teacher`; + +CREATE TABLE `ums_teacher` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '姓名', + `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性别', + `nationality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '民族', + `profession` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '专业', + `education` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学历', + `degree` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学位', + `professional_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '职称', + `emergency_contact` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号', + `join_work_time` datetime DEFAULT NULL COMMENT '参加工作时间', + `political_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '政治面貌', + `user_id` int(11) DEFAULT NULL COMMENT 'user_id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `ums_teacher` */ + +insert into `ums_teacher`(`id`,`name`,`sex`,`nationality`,`profession`,`education`,`degree`,`professional_title`,`emergency_contact`,`join_work_time`,`political_status`,`user_id`) values (1,'张俊豪','男',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5),(2,'肖海南','男',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4); + +/*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=1793257199111405571 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),(1793257199111405570,'2140110334','84fccf8fe96cab775b23698a9c9b7eaa','张俊豪',NULL,'admin','2024-06-11 21:53:20','2024-06-11 21:53:25',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 */; diff --git a/sql/teaching_db6.1.sql b/sql/teaching_db6.1.sql index 36e1a54..8b64568 100644 --- a/sql/teaching_db6.1.sql +++ b/sql/teaching_db6.1.sql @@ -239,10 +239,10 @@ INSERT INTO `objectives_type` VALUES (2, '知识目标'); INSERT INTO `objectives_type` VALUES (3, '素质目标'); -- ---------------------------- --- Table structure for resource +-- Table structure for resourceMysql -- ---------------------------- -DROP TABLE IF EXISTS `resource`; -CREATE TABLE `resource` ( +DROP TABLE IF EXISTS `resourceMysql`; +CREATE TABLE `resourceMysql` ( `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 '资源类型', @@ -253,7 +253,7 @@ CREATE TABLE `resource` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of resource +-- Records of resourceMysql -- ---------------------------- -- ---------------------------- diff --git a/src/main/java/com/teaching/backend/common/ErrorCode.java b/src/main/java/com/teaching/backend/common/ErrorCode.java index 9679c72..808b0e5 100644 --- a/src/main/java/com/teaching/backend/common/ErrorCode.java +++ b/src/main/java/com/teaching/backend/common/ErrorCode.java @@ -33,6 +33,7 @@ public enum ErrorCode { CONTENT_EXISTS(41000, "内容存在"), STUDENT_ROLE_CANT_MULTIPLESEND(41001, "学生用户不能群发,只能单发"), LEAST_ONE_USER(41002, "最少选择一个用户"), + MOST_ONE_COURSE(41003, "您一次性最多只能在一个课程下发消息!"), KNOWS_EXISTS(41001, "存在关联的知识点"), ADD_RELATION_FAILED(41002, "添加关系失败"), diff --git a/src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java b/src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java index 42718d9..f6ac1c7 100644 --- a/src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java +++ b/src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java @@ -7,7 +7,7 @@ //import com.teaching.backend.model.entity.resource.CourseResources; //import org.springframework.web.bind.annotation.*; // -//import javax.annotation.Resource; +//import javax.annotation.ResourceMysql; //import java.util.List; // ///** @@ -24,7 +24,7 @@ //public class FavourInformationController{ // // -// @Resource +// @ResourceMysql // CourseResourcesService courseResourcesService; // // diff --git a/src/main/java/com/teaching/backend/controller/Know/KnowController.java b/src/main/java/com/teaching/backend/controller/Know/KnowController.java index 989f77e..2ec254d 100644 --- a/src/main/java/com/teaching/backend/controller/Know/KnowController.java +++ b/src/main/java/com/teaching/backend/controller/Know/KnowController.java @@ -6,183 +6,128 @@ package com.teaching.backend.controller.Know; * @Description: */ import com.teaching.backend.common.BaseResponse; - -import com.teaching.backend.mapper.know.KnowRepository; import com.teaching.backend.model.dto.Know.*; -import com.teaching.backend.model.entity.know.Know; -import com.teaching.backend.model.entity.know.KnowChapter; -import com.teaching.backend.model.entity.know.KnowCourse; -import com.teaching.backend.model.entity.resource.Resources; -import com.teaching.backend.model.vo.knowGraph.KnowVO1; - +import com.teaching.backend.model.entity.know.*; +import com.teaching.backend.model.entity.knowtmp.Knowtmp; +import com.teaching.backend.model.vo.knowGraph.KnowVO; import com.teaching.backend.service.Know.KnowService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.neo4j.core.Neo4jClient; import org.springframework.web.bind.annotation.*; +import java.util.List; -import javax.annotation.Resource; -import java.util.Collection; -import java.util.Map; -import java.util.Set; @RestController @RequestMapping("/api/knowNeo") +@Api(tags= "图-知识点管理") public class KnowController { @Autowired private KnowService knowService; - @Autowired - private KnowRepository knowRepository; - @Resource - private Neo4jClient neo4jClient; - - - - - //返回2层知识点 - @GetMapping("/twoLevelKnows") - BaseResponse getTwoLevelKnows(@RequestParam Long id){ - return knowService.getTwoLevelKnows(id); - } - //返回3层知识点 - @GetMapping("/threeLevelKnows") - BaseResponse getThreeLevelKnows(@RequestParam Long id){ - return knowService.getThreeLevelKnows(id); - } - //返回4层知识点 - @GetMapping("/fourLevelKnows") - BaseResponse getFourLevelKnows(@RequestParam Long id){ - return knowService.getFourLevelKnows(id); - } - - - //通过courseId 显示图的JSON - @GetMapping("/test") - void test(){ - String t = "related"; - String str = "MATCH (p:Know), (j:Know) WHERE ID(p)= "+407+" AND ID(j)= "+389+" CREATE (p)-[r: "+t+" ]->(j) return count(r);"; - Collection> res = neo4jClient.query(str).fetch().all(); - System.out.println(res); - } - - //通过courseId 显示图的JSON + //通过courseId 查询所有结点,存储成JSON + @ApiOperation(value = "通过courseId 查询所有结点,存储成JSON") @GetMapping("/showGraphJson") BaseResponse showGraphJson(@RequestParam String courseId){ return knowService.showGraphJson(courseId); } - - // 添加全部知识点 - @PostMapping("/addAllKnow") - BaseResponse addAllKnow(@RequestParam String courseId){ - return knowService.addAllKnow(courseId); + //通过courseId 查询 JSON 生成图 + @ApiOperation(value = "通过courseId 查询 JSON 生成图") + @GetMapping("/generateGraph") + BaseResponse generateGraph(@RequestParam String courseId){ + return knowService.generateGraph(courseId); } - // 添加知识点与资源的关系 - @PostMapping("/addRelationship/Withresources") - BaseResponse addRelationshipWithresources(@RequestParam Long id,@RequestParam Long resourceId){ - return knowService.addRelationshipWithresources(id,resourceId); - } - - //=================== -// // 添加知识点 -// @PostMapping("/addKnow") -// BaseResponse addKnow(@RequestBody KnowRequest knowRequest){ -// return knowService.addKnow(knowRequest); -// } - - // 修改知识点 - @PostMapping("/updateKnow") - BaseResponse updateKnow(@RequestBody KnowUpdateRequest knowUpdateRequest){ - return knowService.updateKnow(knowUpdateRequest); + //生成知识点学习路径 默认从第一个知识点到第最后个知识点 + @ApiOperation(value = "生成知识点学习路径") + @GetMapping("/knowLearnPath") + BaseResponse> knowLearnPath(@RequestParam String corseId){ + return knowService.knowLearnPath(corseId); } - - // 删除知识点 - @GetMapping("/deleteKnow") - BaseResponse deleteKnow(@RequestParam Long id){ - return knowService.deleteKnow(id); + //生成知识点学习路径 默认从第一个知识点到第最后个知识点 + @ApiOperation(value = "生成知识点学习路径-图信息") + @GetMapping("/knowLearnPathGraph") + BaseResponse knowLearnPathGraph(@RequestParam String corseId){ + return knowService.knowLearnPathGraph(corseId); } - //查询知识点通过id - @GetMapping("/queryKnow") - BaseResponse queryKnow(@RequestParam Long id){ - return knowService.queryKnow(id); - } - - //====================================== - - // 添加课程 - @PostMapping("/addCourse") - BaseResponse addCourse(@RequestBody KnowCourseCreateRequest knowCourseCreateRequest){ - return knowService.addCourse(knowCourseCreateRequest); + //返回depth层知识点 + @ApiOperation(value = "返回depth层知识点") + @GetMapping("/getNodeByDepth") + BaseResponse getNodeByDepth(@RequestParam Long id,@RequestParam Long depth){ + return knowService.getNodeByDepth(id,depth); } - // 修改课程 - @PostMapping("/updateCourse") - BaseResponse updateCourse(@RequestBody KnowCourseCreateRequest knowCourseCreateRequest){ - return knowService.updateCourse(knowCourseCreateRequest); + //通过courseId 返回depth层知识点 + @ApiOperation(value = "通过courseId-返回depth层知识点") + @GetMapping("/getDepthNodeByCourseId") + BaseResponse getDepthNodeByCourseId(@RequestParam String courseId,@RequestParam Long depth){ + return knowService.getDepthNodeByCourseId(courseId,depth); } - // 删除课程 - @PostMapping("/deleteCourse") - BaseResponse deleteCourse(@RequestParam String courseId){ - return knowService.deleteCourse(courseId); + //返回课程下指定关系的知识图谱 + @ApiOperation(value = "返回课程下指定关系的知识图谱") + @PostMapping("/getRelsNodesByCourseId") + BaseResponse getRelsNodesByCourseId(@RequestBody RelsNodesVO relsNodesVO){ + String courseId = relsNodesVO.getCourseId(); + Integer level = relsNodesVO.getLevel(); + List types = relsNodesVO.getTypes(); + return knowService.getRelsNodesByCourseId(courseId, level,types); } - //查询课程通过courseid - @GetMapping ("/queryCourse") - BaseResponse queryCourse(@RequestParam String courseId){ - return knowService.queryCourse(courseId); + //返回知识点的前后知识点 + @ApiOperation(value = "返回知识点的前后知识点") + @GetMapping("/getFontedAndBackKnows") + BaseResponse> getFontedAndBackKnows(@RequestParam Long id){ + return knowService.getFontedAndBackKnows(id); } - //========================= - // 添加章节 - @PostMapping("/addChapter") - BaseResponse addChapter(@RequestBody KnowChapterCreateRequest knowChapterCreateRequest){ - return knowService.addChapter(knowChapterCreateRequest); - } - // 修改章节 - @PostMapping("/updateChapter") - BaseResponse updateChapter(@RequestBody KnowChapterCreateRequest knowChapterCreateRequest){ - return knowService.updateChapter(knowChapterCreateRequest); + //返回知识点下指定关系的知识图谱 + @ApiOperation(value = "返回知识点下指定关系的知识图谱") + @GetMapping("/getRelsNodesById") + BaseResponse getRelsNodesById(@RequestParam Long id,@RequestParam Listtypes){ + return knowService.getRelsNodesById(id,types); } - // 删除章节 - @GetMapping("/deleteChapter") - BaseResponse deleteChapter(@RequestParam Long chapterId){ - return knowService.deleteChapter(chapterId); + //重置 知识点下 知识图谱 + @ApiOperation(value = "重置-知识点下-知识图谱") + @GetMapping("/getKnowGraphById") + BaseResponse getKnowGraphById(@RequestParam Long id){ + return knowService.getKnowGraphById(id); } - //查询章节通过chapterId - @PostMapping("/queryChapter") - BaseResponse queryChapter(@RequestParam Long chapterId){ - return knowService.queryChapter(chapterId); - } - //===================== + + //通过courseId 删除所有节点 + @ApiOperation(value = "通过courseId 删除所有节点") + @GetMapping("/deleteAllByCourseId") + BaseResponse deleteAllByCourseId(@RequestParam String courseId){ + return knowService.deleteAllByCourseId(courseId); + } //获取课程下的所有知识点 + @ApiOperation(value = "获取课程下的所有知识点") @GetMapping("/getAllKnowByCourseId") BaseResponse getAllKnowByCourseId(@RequestParam String id){ return knowService.getAllKnowByCourseId(id); } - - //获取二级知识图谱 - @GetMapping("/getsecondKnowsById") - BaseResponse getsecondKnowsById(@RequestParam Long id){ - return knowService.getsecondKnowsById(id); + //批量修改节点关系 + @ApiOperation(value = "批量修改节点关系") + @PostMapping("/updateLinks") + BaseResponse updateLinks(@RequestBody List linksList){ + return knowService.updateLinks(linksList); } - - } diff --git a/src/main/java/com/teaching/backend/controller/Know/KnowPathVO.java b/src/main/java/com/teaching/backend/controller/Know/KnowPathVO.java new file mode 100644 index 0000000..9fec2bc --- /dev/null +++ b/src/main/java/com/teaching/backend/controller/Know/KnowPathVO.java @@ -0,0 +1,21 @@ +package com.teaching.backend.controller.Know; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Author:youhang + * @Date:2024-08-29-11:23 + * @Description: + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KnowPathVO { + private ListnodeList; + private Double weight; + +} diff --git a/src/main/java/com/teaching/backend/controller/Know/RelsNodesVO.java b/src/main/java/com/teaching/backend/controller/Know/RelsNodesVO.java new file mode 100644 index 0000000..3609edd --- /dev/null +++ b/src/main/java/com/teaching/backend/controller/Know/RelsNodesVO.java @@ -0,0 +1,24 @@ +package com.teaching.backend.controller.Know; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @Author:youhang + * @Date:2024-09-02-9:47 + * @Description: + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RelsNodesVO { + @NonNull + private String courseId; + private Integer level; + private List types; +} diff --git a/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java b/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java index c71c1a8..686ff1c 100644 --- a/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java +++ b/src/main/java/com/teaching/backend/controller/Knowtmp/KnowtmpController.java @@ -6,6 +6,9 @@ import com.teaching.backend.model.dto.Knowtmp.KnowtempAdd; import com.teaching.backend.model.dto.Knowtmp.KnowtempUpdate; import com.teaching.backend.model.entity.knowtmp.Knowtmp; import com.teaching.backend.service.knowtmp.KnowtmpService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -18,21 +21,25 @@ import java.util.List; */ @RestController @RequestMapping("/knowtmp") +@Api(tags="Mysql-知识点管理") public class KnowtmpController { @Autowired private KnowtmpService knowtmpService; + + + //返回课程下所有知识点 + @ApiOperation(value = "返回课程下所有知识点") @GetMapping("/getAllKnows") BaseResponse getAllKnows(@RequestParam String courseId){ return knowtmpService.getAllKnows(courseId); } - - // 添加知识点 + @ApiOperation(value = "添加知识点") @PostMapping("/addKnow") BaseResponse add(@RequestBody KnowtempAdd knowtempAdd){ return knowtmpService.add(knowtempAdd); @@ -40,26 +47,30 @@ public class KnowtmpController { //修改知识点 + @ApiOperation(value = "修改知识点") @PostMapping("/updateKnow") BaseResponse update(@RequestBody KnowtempUpdate knowtempUpdate){ return knowtmpService.update(knowtempUpdate); } - //删除知识点 + @ApiOperation(value = "删除知识点") @GetMapping("/deleteKnow") BaseResponse delete(Long id){ return knowtmpService.delete(id); } //查询通过chapterId List + @ApiOperation(value = "查询通过chapterId List") @GetMapping("/query") BaseResponse query(Long id){ return knowtmpService.query(id); } + //查询通过chapterId List + @ApiOperation(value = "查询通过chapterId List") @GetMapping("/queryKnow") - List queryByChapterId(Long chapterId){ + BaseResponse> queryByChapterId(Long chapterId){ return knowtmpService.queryByChapterId(chapterId); } } diff --git a/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java b/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java index 19e79df..1631a0b 100644 --- a/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java +++ b/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java @@ -33,7 +33,7 @@ public class CmsEssayController { * @return */ @PostMapping("/add") - public BaseResponse addEssay(CmsEssay cmsEssay){ + public BaseResponse addEssay(@RequestBody CmsEssay cmsEssay){ return cmsEssayService.addEssay(cmsEssay); } @@ -59,7 +59,7 @@ public class CmsEssayController { } /** - * 查询文章 + * 根据栏目id查询文章 * @param category_id * @return */ @@ -68,6 +68,16 @@ public class CmsEssayController { return cmsEssayService.queryEssay(category_id); } + /** + * 根据文章id查询文章 + * @param essay_id + * @return + */ + @GetMapping("/queryessaybyid") + public BaseResponse queryEssayById(Integer essay_id){ + return cmsEssayService.queryEssayById(essay_id); + } + /** * 取消发布 * @param cmsEssay @@ -77,4 +87,14 @@ public class CmsEssayController { public BaseResponse editStatus(@RequestBody CmsEssay cmsEssay){ return cmsEssayService.editStatus(cmsEssay); } + + /** + * 浏览量 + * @param id + * @return + */ + @PutMapping("/views/{id}") + public BaseResponse views(@PathVariable Integer id){ + return cmsEssayService.views(id); + } } diff --git a/src/main/java/com/teaching/backend/controller/courses/CoursesController.java b/src/main/java/com/teaching/backend/controller/courses/CoursesController.java index c42bb16..d53b0c5 100644 --- a/src/main/java/com/teaching/backend/controller/courses/CoursesController.java +++ b/src/main/java/com/teaching/backend/controller/courses/CoursesController.java @@ -140,7 +140,7 @@ public class CoursesController { } @ApiOperation("根据用户id,查询与用户有关的课程列表,并在课程列表显示所有用户信息") -// @ValidateParams({"userId"}) + @ValidateParams({"userId"}) @GetMapping("/page/courseusers") public BaseResponse> getUserInfByCourse(@RequestParam Long userId){ List courseUsersInfList = coursesService.getUserInfByCourse(userId); diff --git a/src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java b/src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java index 8983b0b..97d3731 100644 --- a/src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java +++ b/src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java @@ -12,7 +12,7 @@ //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // -//import javax.annotation.Resource; +//import javax.annotation.ResourceMysql; // ///** // * @Author:youhang @@ -24,7 +24,7 @@ //@Slf4j //public class SeKnowFavourController { // -// @Resource +// @ResourceMysql // private SeKnowFavourService seKnowFavourService; // // diff --git a/src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java b/src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java index 0c481c2..d22bd33 100644 --- a/src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java +++ b/src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java @@ -16,7 +16,7 @@ //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // -//import javax.annotation.Resource; +//import javax.annotation.ResourceMysql; // ///** // * @Author:youhang @@ -28,7 +28,7 @@ //@Slf4j //public class SeResourceFavourController { // -// @Resource +// @ResourceMysql // private SeResourceFavourService seResourceFavourService; // // diff --git a/src/main/java/com/teaching/backend/controller/message/MessagesController.java b/src/main/java/com/teaching/backend/controller/message/MessagesController.java index be95f7f..bfcf1c6 100644 --- a/src/main/java/com/teaching/backend/controller/message/MessagesController.java +++ b/src/main/java/com/teaching/backend/controller/message/MessagesController.java @@ -37,7 +37,7 @@ public class MessagesController { private IMessagesService messagesService; @ApiOperation("发送消息") - @ValidateParams({"senderId","title","content","receiverId"}) // 需要校验的参数 + @ValidateParams({"senderId","title","content","receiverId","courseId"}) // 需要校验的参数 @PostMapping("/addmessage") public BaseResponse sendMessage(@RequestBody SysMessageDTO sysMessageDTO){ String data = messagesService.sendMessageToUserInbox(sysMessageDTO); diff --git a/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java b/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java index 29b19b9..4400569 100644 --- a/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java +++ b/src/main/java/com/teaching/backend/controller/records/ResourceLearningRecordController.java @@ -37,7 +37,7 @@ public class ResourceLearningRecordController { // @ValidateParams({"userId","type","coursesId"}) @PostMapping("/saverecords") public BaseResponse saveResourceRecords(@RequestBody ResourceLearningRecord resourceLearningRecord) { - return resourceLearningRecordService.saveCoursesRecords(resourceLearningRecord); + return resourceLearningRecordService.saveResourceRecords(resourceLearningRecord); } /** diff --git a/src/main/java/com/teaching/backend/controller/resource/ResourceController.java b/src/main/java/com/teaching/backend/controller/resource/ResourceController.java index 9c45bd9..f66710d 100644 --- a/src/main/java/com/teaching/backend/controller/resource/ResourceController.java +++ b/src/main/java/com/teaching/backend/controller/resource/ResourceController.java @@ -8,21 +8,21 @@ package com.teaching.backend.controller.resource; import com.teaching.backend.common.BaseResponse; -import com.teaching.backend.model.dto.resource.ResourceUploadDto; +import com.teaching.backend.model.entity.resource.ResourceMysql; import com.teaching.backend.model.entity.resource.Resources; import com.teaching.backend.service.resource.ResourceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.InputStreamResource; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.util.List; -import java.util.Set; - @RestController @RequestMapping("/api/resource") +@Api(tags= "资源管理") public class ResourceController { @Autowired @@ -32,6 +32,7 @@ public class ResourceController { //添加知识点 @PostMapping("/upload") @ResponseBody + @ApiOperation(value = "添加资源") public BaseResponse uploadFile(@RequestPart("file") MultipartFile file) { return resourceService.upload(file); } @@ -39,51 +40,16 @@ public class ResourceController { //删除资源 @GetMapping ("delete") @ResponseBody + @ApiOperation(value = "删除资源") public BaseResponse deleteResource(@RequestParam("filename") String filename) { return resourceService.delete(filename); } @GetMapping("/read") + @ApiOperation(value = "查询资源") public ResponseEntity readFile(@RequestParam String filename) { return resourceService.readFile(filename); } - @GetMapping("/addRelationship/BetweenCourseAndResources") - public BaseResponse addResourcesAndKnowByCourseId(@RequestParam String courseId, @RequestParam List resourcesIds){ - return resourceService.addResourcesAndKnowByCourseId(courseId,resourcesIds); - } - @GetMapping("/addRelationship/BetweenChapterAndResources") - public BaseResponse addResourcesAndKnowByChapterId(@RequestParam Long chapterId,@RequestParam List resourcesIds){ - return resourceService.addResourcesAndKnowByChapterId(chapterId,resourcesIds); - } - @GetMapping("/addRelationship/BetweenKnowAndResources") - public BaseResponse addResourcesAndKnowById(@RequestParam Long id, @RequestParam List resourcesIds){ - return resourceService.addResourcesAndKnowById(id,resourcesIds); - } - - //查询课程下资源 - @GetMapping("/queryByCourseId") - BaseResponse> queryResourcesByCourseId(@RequestParam String courseId){ - return resourceService.queryResourcesByCourseId(courseId); - } - - //查询章节下资源 - @GetMapping("/queryByChapterId") - BaseResponse> queryResourcesByChapterId(@RequestParam Long chapterId){ - return resourceService.queryResourcesByChapterId(chapterId); - } - - //查询二级节点下资源 - @GetMapping("/queryBesidesKnow") - BaseResponse> queryBesidesKnowToResources(@RequestParam Long KnowId){ - return resourceService.queryBesidesKnowToResources(KnowId); - } - //查询知识点下资源 - @GetMapping("/queryResourcesByKnowId") - BaseResponse> queryResourcesByKnowId(@RequestParam Long KnowId){ - return resourceService.queryResourcesByKnowId(KnowId); - } - - } diff --git a/src/main/java/com/teaching/backend/controller/resource/ResourceGraphController.java b/src/main/java/com/teaching/backend/controller/resource/ResourceGraphController.java new file mode 100644 index 0000000..72655fe --- /dev/null +++ b/src/main/java/com/teaching/backend/controller/resource/ResourceGraphController.java @@ -0,0 +1,78 @@ +package com.teaching.backend.controller.resource; + +/** + * @Author:youhang + * @Date:2024-06-09-9:55 + * @Description: + */ + + +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.model.entity.resource.Resources; +import com.teaching.backend.service.resource.ResourceGraphService; +import com.teaching.backend.service.resource.ResourceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.InputStreamResource; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Set; + + +@RestController +@RequestMapping("/api/resource/graph") +@Api(tags= "资源与图管理") +public class ResourceGraphController { + + @Autowired + private ResourceGraphService resourceGraphService; + + + @GetMapping("/addRelationship/BetweenKnowAndResources") + @ApiOperation(value = "添加知识点资源关系") + public BaseResponse addResourcesByIdAndResourcesId(@RequestParam Long id,@RequestParam Long resourcesId){ + return resourceGraphService.addResourcesByIdAndResourcesId(id,resourcesId); + } + + @GetMapping("/deleteRelationship/BetweenKnowAndResources") + @ApiOperation(value = "删除知识点资源关系") + public BaseResponse deleteResourcesAndKnowById(@RequestParam Long id, @RequestParam Long resourcesId){ + return resourceGraphService.deleteResourcesAndKnowById(id,resourcesId); + } + + //查询课程下资源 + @GetMapping("/queryByCourseId") + @ApiOperation(value = "查询课程下资源") + BaseResponse> queryResourcesByCourseId(@RequestParam String courseId){ + return resourceGraphService.queryResourcesByCourseId(courseId); + } + + //查询章节下资源 + @GetMapping("/queryByChapterId") + @ApiOperation(value = "查询章节下资源") + BaseResponse> queryResourcesByChapterId(@RequestParam Long chapterId){ + return resourceGraphService.queryResourcesByChapterId(chapterId); + } + + //查询二级节点下资源 + @ApiOperation(value = "查询二级节点下资源") + @GetMapping("/queryBesidesKnow") + BaseResponse> queryBesidesKnowToResources(@RequestParam Long knowId){ + return resourceGraphService.queryBesidesKnowToResources(knowId); + } + + //查询知识点下资源 + @GetMapping("/queryResourcesByKnowId") + @ApiOperation(value = "查询知识点下资源") + BaseResponse> queryResourcesByKnowId(@RequestParam Long knowId){ + return resourceGraphService.queryResourcesByKnowId(knowId); + } + + + +} diff --git a/src/main/java/com/teaching/backend/controller/resource/ResourceMysqlController.java b/src/main/java/com/teaching/backend/controller/resource/ResourceMysqlController.java new file mode 100644 index 0000000..3a87e6b --- /dev/null +++ b/src/main/java/com/teaching/backend/controller/resource/ResourceMysqlController.java @@ -0,0 +1,43 @@ +package com.teaching.backend.controller.resource; + + +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.common.ResultUtils; +import com.teaching.backend.model.entity.resource.ResourceMysql; +import com.teaching.backend.service.impl.resource.ResourceMysqlServiceImpl; +import com.teaching.backend.service.impl.resource.ResourceServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 前端控制器 + *

+ * + * @author author + * @since 2024-09-02 + */ +@RestController +@RequestMapping("/resourcemysql") +@Api(tags= "数据库资源管理") +public class ResourceMysqlController { + private ResourceMysqlServiceImpl resourceMysqlService; + + private ResourceServiceImpl resourceService; + + //添加资源 + @PostMapping("/add") + @ApiOperation(value = "添加资源") + public BaseResponse addFile(@RequestPart("file") MultipartFile file, ResourceMysql resourceMysql) { + System.out.println("资源:"+ resourceMysql); + System.out.println(file); + String url = resourceService.upload(file).getData().getUrl(); + System.out.println(url); + //return ResultUtils.success("添加xx"); + return resourceMysqlService.resourceUpload(file, resourceMysql); + } + +} diff --git a/src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java b/src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java index 89f8e70..ad287f5 100644 --- a/src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java +++ b/src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java @@ -12,7 +12,7 @@ //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // -//import javax.annotation.Resource; +//import javax.annotation.ResourceMysql; // ///** // * @Author:youhang @@ -24,7 +24,7 @@ //@Slf4j //public class SeKnowThumbController { // -// @Resource +// @ResourceMysql // private SeKnowThumbService seKnowThumbService; // // diff --git a/src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java b/src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java index 3ec16fb..09d43a8 100644 --- a/src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java +++ b/src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java @@ -12,7 +12,7 @@ //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // -//import javax.annotation.Resource; +//import javax.annotation.ResourceMysql; // ///** // * @Author:youhang @@ -24,7 +24,7 @@ //@Slf4j //public class SeResourceThumbController { // -// @Resource +// @ResourceMysql // private SeResourceThumbService seResourceThumbService; // // diff --git a/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowstrMapper.java b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowstrMapper.java new file mode 100644 index 0000000..58727d0 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/Knowtemp/KnowstrMapper.java @@ -0,0 +1,23 @@ +package com.teaching.backend.mapper.Knowtemp; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.know.KnowStr; +import com.teaching.backend.model.entity.knowtmp.Knowtmp; +import io.lettuce.core.dynamic.annotation.Param; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + + +/** + * + */ +@Mapper +public interface KnowstrMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java b/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java index c1861d7..653b429 100644 --- a/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java +++ b/src/main/java/com/teaching/backend/mapper/know/KnowRepository.java @@ -23,6 +23,14 @@ import java.util.Set; public interface KnowRepository extends Neo4jRepository { + @Query("MATCH (n:Know) WHERE n.courseId = $courseId OPTIONAL MATCH p=(n)-[*0..]->() DETACH DELETE p return count(p);") + Long deleteAllByCourseId(String courseId); + + + @Query("MATCH (n:Know) WHERE ID(n)= ${id} DETACH DELETE n;") + Long deleteNode(Long id); + //============= + @Query("MATCH (p:Know)-[:FatherAndSon]->(n:Know) WHERE p.chapterId = $chapterId RETURN p.id ORDER BY ordernum;") @@ -42,15 +50,21 @@ public interface KnowRepository extends Neo4jRepository { @Query("MATCH ID(p:Know) = $id delete p RETURN count(p);") int deleteKnow(Long id); - @Query("MATCH ID(p:Know) = $id RETURN p;") - Know queryKnow(Long id); + @Query("MATCH (p:Know) where ID(p) = $id RETURN count(p);") + int queryNode(Long id); + @Query("MATCH (p:Know) where ID(p) = $id RETURN p;") + Know queryNodeT(Long id); + + + @Query("MATCH (p:Know) where p.knowId = $knowId RETURN p;") + Know queryKnowByKnowId(Long knowId); //============================= - @Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info,hour:$hour}) return ID(n) as id") + @Query("CREATE (n:Know {courseId: $courseId,name: $name,info:$info,hour:$hour}) return ID(n) as id") Long addCourse(String courseId, String name, String info, double hour); - @Query("MATCH (p:Know {courseId:$courseId }) SET p.name = $name set p.info= $info RETURN count(p);") + @Query("MATCH (p:Know {courseId:$courseId}) SET p.name = $name set p.info= $info RETURN count(p);") int updateCourse(String courseId, String name, String info); @Query("MATCH (p:Know {courseId:$courseId }) delete p RETURN count(p);") diff --git a/src/main/java/com/teaching/backend/mapper/resource/ResourceMysqlMapper.java b/src/main/java/com/teaching/backend/mapper/resource/ResourceMysqlMapper.java new file mode 100644 index 0000000..2fc88df --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/resource/ResourceMysqlMapper.java @@ -0,0 +1,17 @@ +package com.teaching.backend.mapper.resource; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.resource.ResourceMysql; + +/** + *

+ * Mapper 接口 + *

+ * + * @author author + * @since 2024-09-02 + */ +public interface ResourceMysqlMapper extends BaseMapper { + +} diff --git a/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java b/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java index 256b73c..decc5d7 100644 --- a/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java +++ b/src/main/java/com/teaching/backend/mapper/resource/ResourcesRepository.java @@ -16,37 +16,56 @@ import java.util.Set; public interface ResourcesRepository extends Neo4jRepository { + //查询资源 + @Query("MATCH (b:Resources) WHERE ID(b) = $resourceIds RETURN b") + Resources queryResourcesByIds(Long resourceIds); + + //查询资源 - 知识点 + @Query("MATCH (p:Know)<-[r:resources]-(c:Resources) WHERE ID(p) = $id AND ID(c) = $resourcesId return count(r)") + int queryExisitRel(Long id, Long resourcesId); + + //添加知识点与资源关系 + @Query("MATCH (p:Know), (c:Resources) WHERE ID(p) = $id AND ID(c) = $resourcesId CREATE (c)-[r:resources]->(p) return count(r)") + int addResourcesAndKnowById(Long id, Long resourcesId); + + + //删除资源节点 @Query("MATCH(n:Resources) where n.name = $name DETACH DELETE n RETURN COUNT(n) >0;") Boolean deleteByobjectName(String name); //添加课程与资源关系 - @Query("MATCH (p:Know), (c:Resources) WHERE p.courseId = $courseId AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)") + @Query("MATCH (p:Know), (c:Resources) WHERE p.courseId = $courseId AND ID(c) in $resourcesIds CREATE (c)-[r:resources]->(p) return count(r)") int addResourcesAndKnowByCourseId(String courseId, List resourcesIds); //添加章节与资源关系 - @Query("MATCH (p:Know), (c:Resources) WHERE p.chapterId = $chapterId AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)") + @Query("MATCH (p:Know), (c:Resources) WHERE p.chapterId = $chapterId AND ID(c) in $resourcesIds CREATE (c)-[r:resources]->(p) return count(r)") int addResourcesAndKnowByChapterId(Long chapterId, List resourcesIds); + //删除知识点与资源关系 + @Query("MATCH (c:Resources)-[r:resources]->(p:Know) WHERE ID(c) = $resourcesId AND ID(p) = $id delete r return count(r)") + int deleteResourcesAndKnowById(Long id, Long resourcesId); + + //添加知识点与资源关系 - @Query("MATCH (p:Know), (c:Resources) WHERE ID(p) = $id AND ID(c) in $resourcesIds CREATE (p)-[r:resources]->(c) return count(r)") + @Query("MATCH (p:Know), (c:Resources) WHERE ID(p) = $id AND ID(c) in $resourcesIds CREATE (c)-[r:resources]->(p) return count(r)") int addResourcesAndKnowById(Long id, List resourcesIds); //查询课程下资源 - @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE a.courseId = $courseId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b") + @Query("MATCH (a:Know)-[*]->(c:Know)<-[r:resources]-(b:Resources) WHERE a.courseId = $courseId RETURN b") Set queryResourcesByCourseId(String courseId); //查询章节下资源 - @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE a.chapterId = $chapterId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b") + @Query("MATCH (a:Know)-[*]->(c:Know)<-[r:resources]-(b:Resources) WHERE a.chapterId = $chapterId RETURN b") Set queryResourcesByChapterId(Long chapterId); //查询二级节点下资源 - @Query("MATCh (p:Know)-[*0..1]->(n:Know)-[:resources]->(m:Resources) WHERE ID(p) = $KnowId RETURN m") + @Query("MATCh (p:Know)-[*0..1]->(n:Know)<-[:resources]-(m:Resources) WHERE ID(p) = $KnowId RETURN m") Set queryBesidesKnowToResources(Long KnowId); // - @Query("MATCH (p)-[r:resources]->(c) WHERE ID(p) = $KnowId RETURN c") + @Query("MATCH (p)<-[r:resources]-(c) WHERE ID(p) = $KnowId RETURN c") Set queryResourcesByKnowId(Long KnowId); @@ -55,7 +74,7 @@ public interface ResourcesRepository extends Neo4jRepository { // // // @Query("MATCH(n:Know)-[r:resources]->(nn:Resources) where ID(nn) = $id RETURN nn") -// List queryResourceAllId(Long id); +// List queryResourceAllId(Long id); // // @Query("MATCH p = (a:Know)-[rels*]-(b:Resources) WHERE ID(a) = $KnowId and ANY(rel IN rels WHERE TYPE(rel) = 'resources') RETURN b") // Set queryCourseKnowToResources(Long KnowId); diff --git a/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java b/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java index fc5cbe7..9391cfd 100644 --- a/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java +++ b/src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java @@ -21,7 +21,6 @@ public class KnowtempAdd implements Serializable { private Long chapterid; - private Integer ordernum; private double hour; diff --git a/src/main/java/com/teaching/backend/model/entity/cms/CmsEssay.java b/src/main/java/com/teaching/backend/model/entity/cms/CmsEssay.java index 845f681..d319130 100644 --- a/src/main/java/com/teaching/backend/model/entity/cms/CmsEssay.java +++ b/src/main/java/com/teaching/backend/model/entity/cms/CmsEssay.java @@ -58,6 +58,9 @@ public class CmsEssay implements Serializable { @ApiModelProperty(value = "发布文章的用户id") private Integer userId; +// @TableField(exist = false) + private String username; + @ApiModelProperty(value = "文章文件") private String file; diff --git a/src/main/java/com/teaching/backend/model/entity/know/KnowStr.java b/src/main/java/com/teaching/backend/model/entity/know/KnowStr.java new file mode 100644 index 0000000..f648a42 --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/know/KnowStr.java @@ -0,0 +1,30 @@ +package com.teaching.backend.model.entity.know; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.xml.soap.Text; +import java.io.Serializable; + +/** + * @Author:youhang + * @Date:2024-08-23-17:29 + * @Description: + */ +@Data +@TableName("know_str") +public class KnowStr implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + private String courseId; + + private String coursestr; + private String chapterstr; + private String knowstr; + private String edgestr; + +} diff --git a/src/main/java/com/teaching/backend/model/entity/know/LinksVO.java b/src/main/java/com/teaching/backend/model/entity/know/LinksVO.java new file mode 100644 index 0000000..605a934 --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/know/LinksVO.java @@ -0,0 +1,29 @@ +package com.teaching.backend.model.entity.know; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.checkerframework.checker.units.qual.A; +import org.springframework.data.neo4j.core.schema.GeneratedValue; +import org.springframework.data.neo4j.core.schema.Id; +import org.springframework.data.neo4j.core.schema.Node; +import org.springframework.data.neo4j.core.schema.Property; + +/** + * @Author:youhang + * @Date:2024-07-21-16:32 + * @Description: + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class LinksVO { + + private Long source; + + private Long target; + + private String label; + + +} diff --git a/src/main/java/com/teaching/backend/model/entity/resource/ResourceMysql.java b/src/main/java/com/teaching/backend/model/entity/resource/ResourceMysql.java new file mode 100644 index 0000000..a6e6b26 --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/resource/ResourceMysql.java @@ -0,0 +1,65 @@ +package com.teaching.backend.model.entity.resource; + +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; + +/** + *

+ * + *

+ * + * @author wenyu + * @since 2024-09-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("resource") +@ApiModel(value="Resource对象", description="") +public class ResourceMysql implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + @ApiModelProperty(value = "课程id") + private String courseId; + + @ApiModelProperty(value = "章节id") + private String chapterId; + + @ApiModelProperty(value = "知识点id") + private String knowledgeId; + + @ApiModelProperty(value = "资源名称") + private String name; + + @ApiModelProperty(value = "资源类型") + private Integer type; + + @ApiModelProperty(value = "资源路径") + private String path; + + @ApiModelProperty(value = "资源状态") + private Integer status; + + @ApiModelProperty(value = "标签") + private String tags; + + @ApiModelProperty(value = "简介") + private String description; + + @ApiModelProperty(value = "封面") + private String img; + + +} diff --git a/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java b/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java index d19762a..a9c6324 100644 --- a/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java +++ b/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java @@ -39,6 +39,9 @@ public class SystemSetting implements Serializable { //备案号 private String recordNumber; + //备案信息 + private String recordInformation; + //QQ private String qqNumber; diff --git a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentManage.java b/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentManage.java index d45e758..7264566 100644 --- a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentManage.java +++ b/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsStudentManage.java @@ -45,7 +45,7 @@ public class UmsStudentManage implements Serializable { private LocalDateTime createTime; //账号状态 - private Integer status; + private String status; //姓名 private String name; diff --git a/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java b/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java index eb21803..6acc644 100644 --- a/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java +++ b/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java @@ -37,6 +37,9 @@ public class SystemSettingVO implements Serializable { //备案号 private String recordNumber; + //备案信息 + private String recordInformation; + //QQ private String qqNumber; diff --git a/src/main/java/com/teaching/backend/service/Know/KnowService.java b/src/main/java/com/teaching/backend/service/Know/KnowService.java index 064bbc5..d35271f 100644 --- a/src/main/java/com/teaching/backend/service/Know/KnowService.java +++ b/src/main/java/com/teaching/backend/service/Know/KnowService.java @@ -1,14 +1,16 @@ package com.teaching.backend.service.Know; import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.controller.Know.KnowPathVO; import com.teaching.backend.model.dto.Know.*; -import com.teaching.backend.model.entity.know.Know; -import com.teaching.backend.model.entity.know.KnowChapter; -import com.teaching.backend.model.entity.know.KnowCourse; +import com.teaching.backend.model.entity.know.*; +import com.teaching.backend.model.entity.knowtmp.Knowtmp; import com.teaching.backend.model.entity.resource.Resources; +import com.teaching.backend.model.vo.knowGraph.KnowVO; import com.teaching.backend.model.vo.knowGraph.KnowVO1; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; import java.util.Set; /** @@ -17,78 +19,35 @@ import java.util.Set; * @Description: */ public interface KnowService { + public BaseResponse getDepthNodeByCourseId(String CourseId,Long depth); + public BaseResponse getNodeByDepth(long id,Long depth); - BaseResponse getTwoLevelKnows(Long id); - BaseResponse getThreeLevelKnows(Long id); - BaseResponse getFourLevelKnows(Long id); + BaseResponse> knowLearnPath(String corseId); + BaseResponseknowLearnPathGraph(String corseId); - //通过courseId 显示图的JSON - BaseResponse showGraphJson(String courseId); - - - //通过courseId 添加所有节点 - BaseResponse addAllKnow(String courseId); - - BaseResponse addRelationshipWithresources(Long id, Long resourceId); - - - - //===================== - -// // 添加知识点 -// BaseResponse addKnow(KnowRequest knowRequest); - - // 修改知识点 - BaseResponse updateKnow(KnowUpdateRequest knowUpdateRequest); - - // 删除知识点 - BaseResponse deleteKnow(Long id); - - //查询知识点通过id - BaseResponse queryKnow(Long id); - - //====================================== + BaseResponse updateLinks(List linksList); + BaseResponse deleteAllByCourseId(String courseId1); + BaseResponse generateGraph(String courseId1); - // 添加课程 - BaseResponse addCourse(KnowCourseCreateRequest knowCourseCreateRequest); - // 修改课程 - BaseResponse updateCourse(KnowCourseCreateRequest knowCourseCreateRequest); - - - // 删除课程 - BaseResponse deleteCourse(String courseId); - - //查询课程通过courseid - BaseResponse queryCourse(String courseId); - - - //========================= - - // 添加章节 - BaseResponse addChapter(KnowChapterCreateRequest knowChapterCreateRequest); - - // 修改章节 - BaseResponse updateChapter(KnowChapterCreateRequest knowChapterCreateRequest); - - // 删除章节 - BaseResponse deleteChapter(Long chapterId); - - //查询章节通过chapterId - BaseResponse queryChapter(Long chapterId); + //通过courseId 显示图的JSON + BaseResponse showGraphJson(String courseId); - //===================== //获取课程下的所有知识点 BaseResponse getAllKnowByCourseId(String id); - //获取课程下的所有知识点 - BaseResponse getsecondKnowsById(Long id); + //返回课程下指定关系的知识图谱 + BaseResponse getRelsNodesByCourseId(String courseId, Integer level,Listtypes); - //获取课程下的所有资源 - BaseResponse> getAllResourcesByCourseId(String id); + //返回课程下指定关系的知识图谱 + BaseResponse getRelsNodesById(Long id,Listtypes); + //返回课程下指定关系的知识图谱 + BaseResponse getKnowGraphById(Long id); + //查询 + BaseResponse> getFontedAndBackKnows(Long id); } diff --git a/src/main/java/com/teaching/backend/service/cms/ICmsEssayService.java b/src/main/java/com/teaching/backend/service/cms/ICmsEssayService.java index 56e2bb1..49d368e 100644 --- a/src/main/java/com/teaching/backend/service/cms/ICmsEssayService.java +++ b/src/main/java/com/teaching/backend/service/cms/ICmsEssayService.java @@ -26,4 +26,8 @@ public interface ICmsEssayService extends IService { BaseResponse> queryEssay(Integer category_id); BaseResponse editStatus(CmsEssay cmsEssay); + + BaseResponse queryEssayById(Integer essayId); + + BaseResponse views(Integer id); } diff --git a/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java index 61420bf..c25153c 100644 --- a/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java @@ -6,9 +6,12 @@ import com.teaching.backend.common.BaseResponse; import com.teaching.backend.common.ResultUtils; import com.teaching.backend.mapper.cms.CmsEssayMapper; import com.teaching.backend.model.entity.cms.CmsEssay; +import com.teaching.backend.model.entity.umsAdmin.UmsUser; import com.teaching.backend.service.cms.ICmsEssayService; +import com.teaching.backend.service.impl.umsAdmin.UmsUserServiceImpl; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.time.LocalDate; import java.util.List; @@ -23,21 +26,53 @@ import java.util.List; @Service public class CmsEssayServiceImpl extends ServiceImpl implements ICmsEssayService { + @Resource + private UmsUserServiceImpl userService; + @Override public BaseResponse addEssay(CmsEssay cmsEssay) { + //设置文章发布时间 cmsEssay.setPublishTime(LocalDate.now()); + //设置发布人姓名 + String nickName = userService.getById(cmsEssay.getUserId()).getNickName(); + cmsEssay.setUsername(nickName); + //将浏览次数设置为0 + cmsEssay.setReadingNumber(0); + //如果数据库里没有文章,文章id设为2 + Long count = query().count(); + if (count == 0){ + cmsEssay.setId(2); + } save(cmsEssay); return ResultUtils.success("添加成功"); } @Override public BaseResponse deleteEssay(List ids) { + //如果要删除的文章中包含id为1的文章(就是包含关于我们)就删除失败 + if (ids.contains(1)){ + return ResultUtils.success("删除失败,不能删除关于我们!"); + } removeByIds(ids); return ResultUtils.success("删除成功"); } @Override public BaseResponse editEssay(CmsEssay cmsEssay) { + //设置发布人姓名 + String nickName = userService.getById(cmsEssay.getUserId()).getNickName(); + cmsEssay.setUsername(nickName); + //获取要修改的文章id + Integer id = cmsEssay.getId(); + //判断文章id是否为1 + if (id == 1){ + Long count = query().eq("id", id).count(); + //如果数据库里没id为的文章就先新增 + if (count == 0){ + save(cmsEssay); + return ResultUtils.success("添加成功!"); + } + } updateById(cmsEssay); return ResultUtils.success("编辑成功!"); } @@ -54,4 +89,15 @@ public class CmsEssayServiceImpl extends ServiceImpl i updateById(cmsEssay); return ResultUtils.success("修改成功"); } + + @Override + public BaseResponse queryEssayById(Integer essayId) { + return ResultUtils.success(getById(essayId)); + } + + @Override + public BaseResponse views(Integer id) { + boolean update = update().setSql("reading_number = reading_number + 1 where id = " + id).update(); + return update ? ResultUtils.success("浏览次数加1") : ResultUtils.success("error!!!"); + } } diff --git a/src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java index bed4f66..2266643 100644 --- a/src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java @@ -4,21 +4,11 @@ import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; import com.teaching.backend.common.BaseResponse; import com.teaching.backend.common.ErrorCode; import com.teaching.backend.common.ResultUtils; -import com.teaching.backend.controller.Know.Edge; -import com.teaching.backend.controller.Know.KnowJson; -import com.teaching.backend.controller.Know.KnowJsonListVO; +import com.teaching.backend.controller.Know.KnowPathVO; +import com.teaching.backend.mapper.Knowtemp.KnowstrMapper; import com.teaching.backend.mapper.Knowtemp.KnowtmpMapper; import com.teaching.backend.mapper.chapter.ChapterMapper; import com.teaching.backend.mapper.courses.CoursesMapper; @@ -26,29 +16,19 @@ import com.teaching.backend.mapper.know.KnowRepository; import com.teaching.backend.model.dto.Know.*; import com.teaching.backend.model.entity.chapter.Chapter; import com.teaching.backend.model.entity.courses.Courses; -import com.teaching.backend.model.entity.know.Know; -import com.teaching.backend.model.entity.know.KnowChapter; -import com.teaching.backend.model.entity.know.KnowCourse; -import com.teaching.backend.model.entity.know.Links; +import com.teaching.backend.model.entity.know.*; import com.teaching.backend.model.entity.knowtmp.Knowtmp; -import com.teaching.backend.model.entity.resource.Resources; import com.teaching.backend.model.vo.knowGraph.KnowVO; -import com.teaching.backend.model.vo.knowGraph.KnowVO1; import com.teaching.backend.service.Know.KnowService; import com.teaching.backend.service.knowtmp.KnowtmpService; import org.neo4j.driver.internal.InternalRelationship; import org.neo4j.driver.types.Node; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.neo4j.core.Neo4jClient; -import org.springframework.data.neo4j.core.Neo4jTemplate; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** * @Author:youhang @@ -78,211 +58,190 @@ public class knowServiceImpl implements KnowService { @Resource private Neo4jClient neo4jClient; + @Autowired + private KnowstrMapper knowstrMapper; + + final static String[] colorList = {"#91CC75", "#5470C6", "#FAC858", "#EE6666", "#73C0DE", "#EA7CCC", "#5577FF", "#5577FF", "#9DBFFF", "#78A7FF"}; + static Map colorChoose = new HashMap<>(); - public BaseResponse addRelationshipWithresources(Long id, Long resourceId) { - int f = knowRepository.addResourceResourcesKnow(id, resourceId); - if (f <= 0) { - throw new RuntimeException("添加关系失败"); + static { + for (int i = 0; i < 10; i++) { + colorChoose.put((long) i, colorList[i]); } - return ResultUtils.success("添加关系成功"); - } + } - @Override - public BaseResponse getTwoLevelKnows(Long id) { + public BaseResponse getNodeByDepth(long id, Long depth) { Collection> all = - neo4jClient.query("match(n:Know)-[r*0..2]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); + neo4jClient.query("match(n:Know)-[r:contain*0.." + depth + "]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); + Collection> all2 = + neo4jClient.query("match(n:Know)-[r*0.." + depth + "]->(p:Know) where ID(n) = " + id + " return r as `r`").fetch().all(); - Map colorChoose = new - HashMap<>(); - String color[] = new String[10]; - String[] colorList = {"#91CC75", "#5470C6", "#FAC858", "#EE6666", "#73C0DE", "#EA7CCC", "#5577FF", "#5577FF", "#9DBFFF", "#78A7FF"}; - for (int i = 0; i < 10; i++) { - colorChoose.put((long) i, colorList[i]); - } Iterator> iterator = all.iterator(); + Iterator> iterator2 = all2.iterator(); Set knowList = new HashSet<>(); Set linksList = new HashSet<>(); KnowVO knowVO; List node2 = new ArrayList<>(); Links links; int p = 0; + while (iterator.hasNext()) { Map element = iterator.next(); knowVO = new KnowVO(); Node node1 = (Node) element.get("p"); - Long group = (Long) element.get("d"); -// knowVO.setColor(colorChoose.get(group)); - - Long id1 = node1.id(); - String name1 = node1.get("name").asString(); - knowVO.setId(id1); - knowVO.setLabel(name1); - - knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + if (node1 != null) { + Long id1 = node1.id(); + String name1 = node1.get("name").asString(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + } node2 = (List) element.get("r"); - for (int i = 0; i < node2.size(); i++) { - InternalRelationship e = (InternalRelationship) node2.get(i); - links = new Links(); - links.setId(e.id()); - links.setSource(e.startNodeId()); - links.setTarget(e.endNodeId()); - if ("contain".equals(e.type())) { - links.setLabel("包含"); - } else if ("order".equals(e.type())) { - links.setLabel("顺序"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); + } + linksList.add(links); } - linksList.add(links); } } - BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); - return ResultUtils.success(baseKnowReturn); - } - - @Override - public BaseResponse getThreeLevelKnows(Long id) { - Collection> all = - neo4jClient.query("match(n:Know)-[r*0..3]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); - - Map colorChoose = new - HashMap<>(); - String color[] = new String[10]; - String[] colorList = {"#91CC75", "#5470C6", "#FAC858", "#EE6666", "#73C0DE", "#EA7CCC", "#5577FF", "#5577FF", "#9DBFFF", "#78A7FF"}; - for (int i = 0; i < 10; i++) { - colorChoose.put((long) i, colorList[i]); - } - - Iterator> iterator = all.iterator(); - Set knowList = new HashSet<>(); - Set linksList = new HashSet<>(); - KnowVO knowVO; - List node2 = new ArrayList<>(); - Links links; - int p = 0; - while (iterator.hasNext()) { - Map element = iterator.next(); - knowVO = new KnowVO(); - Node node1 = (Node) element.get("p"); - -// Long group = (Long) element.get("d"); -// knowVO.setColor(colorChoose.get(group)); - - Long id1 = node1.id(); - String name1 = node1.get("name").asString(); - knowVO.setId(id1); - knowVO.setLabel(name1); - - knowList.add(knowVO); - + while (iterator2.hasNext()) { + Map element = iterator2.next(); node2 = (List) element.get("r"); - for (int i = 0; i < node2.size(); i++) { - InternalRelationship e = (InternalRelationship) node2.get(i); - links = new Links(); - links.setId(e.id()); - links.setSource(e.startNodeId()); - links.setTarget(e.endNodeId()); - if ("contain".equals(e.type())) { - links.setLabel("包含"); - } else if ("order".equals(e.type())) { - links.setLabel("顺序"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); + } + linksList.add(links); } - linksList.add(links); } } + BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); return ResultUtils.success(baseKnowReturn); } - @Override - public BaseResponse getFourLevelKnows(Long id) { + public BaseResponse getDepthNodeByCourseId(String courseId, Long depth) { Collection> all = - neo4jClient.query("match(n:Know)-[r*0..4]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); + neo4jClient.query("match(n:Know)-[r:contain*0.." + depth + "]->(p:Know) where n.courseId = '" + courseId + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); + Collection> all2 = + neo4jClient.query("match(n:Know)-[r*0.." + depth + "]->(p:Know) where n.courseId = '" + courseId + "' return r as `r`").fetch().all(); - Map colorChoose = new - HashMap<>(); - String color[] = new String[10]; - String[] colorList = {"#91CC75", "#5470C6", "#FAC858", "#EE6666", "#73C0DE", "#EA7CCC", "#5577FF", "#5577FF", "#9DBFFF", "#78A7FF"}; - for (int i = 0; i < 10; i++) { - colorChoose.put((long) i, colorList[i]); - } Iterator> iterator = all.iterator(); + Iterator> iterator2 = all2.iterator(); Set knowList = new HashSet<>(); Set linksList = new HashSet<>(); KnowVO knowVO; List node2 = new ArrayList<>(); Links links; int p = 0; + while (iterator.hasNext()) { Map element = iterator.next(); knowVO = new KnowVO(); Node node1 = (Node) element.get("p"); - Long group = (Long) element.get("d"); -// knowVO.setColor(colorChoose.get(group)); + knowVO.setColor(colorChoose.get(group)); + if (node1 != null) { + Long id1 = node1.id(); + String name1 = node1.get("name").asString(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + } - Long id1 = node1.id(); - String name1 = node1.get("name").asString(); - knowVO.setId(id1); - knowVO.setLabel(name1); + node2 = (List) element.get("r"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); + } + linksList.add(links); + } + } - knowList.add(knowVO); + } + while (iterator2.hasNext()) { + Map element = iterator2.next(); node2 = (List) element.get("r"); - for (int i = 0; i < node2.size(); i++) { - InternalRelationship e = (InternalRelationship) node2.get(i); - links = new Links(); - links.setId(e.id()); - links.setSource(e.startNodeId()); - links.setTarget(e.endNodeId()); - if ("contain".equals(e.type())) { - links.setLabel("包含"); - } else if ("order".equals(e.type())) { - links.setLabel("顺序"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); + } + linksList.add(links); } - linksList.add(links); } } + BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); return ResultUtils.success(baseKnowReturn); } - @Override public BaseResponse showGraphJson(String courseId) { - return addInformation(courseId); - } - - @Override - public BaseResponse addAllKnow(String courseId) { - try { - addAllKnowTransation(courseId); - } catch (Exception e) { - e.printStackTrace(); - return ResultUtils.error(ErrorCode.OPERATION_ERROR, e.getMessage()); - } - //6.返回成功信息,关闭事务 - return ResultUtils.success("添加成功"); - } - - private BaseResponse addInformation(String courseId) { - // 创建 JSON 对象数组 JSONArray jsonArrayKnowNode = JSONUtil.createArray(); JSONArray jsonArrayCourseNode = JSONUtil.createArray(); JSONArray jsonArrayChapterNode = JSONUtil.createArray(); - //查询数据库-课程 Courses courses = coursesMapper.selectById(courseId); + if (courses == null) { + return ResultUtils.error(ErrorCode.PARAMS_ERROR, "课程不存在"); + } JSONObject obj1 = JSONUtil.createObj(); obj1.put("courseId", courseId); obj1.put("name", courses.getName()); @@ -293,6 +252,7 @@ public class knowServiceImpl implements KnowService { //查询数据库-章-节 List chapterList = new ArrayList<>(); List chapterListPID = chapterMapper.selectChapterPIDByCourseId(courseId); + List chapterOneIds = new ArrayList<>(); List chapterTwoIds = new ArrayList<>(); for (int i = 0; i < chapterListPID.size(); i++) { @@ -318,7 +278,7 @@ public class knowServiceImpl implements KnowService { for (int i = 0; i < chapterList.size(); i++) { Chapter chapter = chapterList.get(i); if (chapter.getPid() != 0) { - List knowlist = knowtmpService.queryByChapterId(chapter.getId()); + List knowlist = knowtmpService.queryByChapterId(chapter.getId()).getData(); for (int j = 0; j < knowlist.size(); j++) { Knowtmp knowtmp = knowlist.get(j); JSONObject obj3 = JSONUtil.createObj(); @@ -336,7 +296,6 @@ public class knowServiceImpl implements KnowService { // =======创建关系 JSONArray edgesArray = JSONUtil.createArray(); - // 创建边列表 // 课程-章节 父子 for (int i = 0; i < chapterListPID.size(); i++) { @@ -344,7 +303,7 @@ public class knowServiceImpl implements KnowService { JSONObject edge = JSONUtil.createObj(); edge.put("source", courses.getId()); edge.put("target", chapter.getId()); - edge.put("type", "FatherAndSon"); + edge.put("type", "contain"); edge.put("sta", 1); edgesArray.add(edge); } @@ -355,7 +314,7 @@ public class knowServiceImpl implements KnowService { JSONObject edge = JSONUtil.createObj(); edge.put("source", chapterListPID.get(i).getId()); edge.put("target", chapterListSecond.get(j).getId()); - edge.put("type", "FatherAndSon"); + edge.put("type", "contain"); edge.put("sta", 2); edgesArray.add(edge); } @@ -363,13 +322,13 @@ public class knowServiceImpl implements KnowService { //节与点父子 List knowIds = new ArrayList<>(); for (int i = 0; i < chapterTwoIds.size(); i++) { - List knowlist = knowtmpService.queryByChapterId(chapterTwoIds.get(i)); + List knowlist = knowtmpService.queryByChapterId(chapterTwoIds.get(i)).getData(); for (int j = 0; j < knowlist.size(); j++) { Knowtmp knowtmp = knowlist.get(j); JSONObject edge = JSONUtil.createObj(); edge.put("source", chapterTwoIds.get(i)); edge.put("target", knowtmp.getId()); - edge.put("type", "FatherAndSon"); + edge.put("type", "contain"); edge.put("sta", 3); edgesArray.add(edge); knowIds.add(knowtmp.getId()); @@ -382,7 +341,7 @@ public class knowServiceImpl implements KnowService { JSONObject edge = JSONUtil.createObj(); edge.put("source", chapterOneIds.get(i)); edge.put("target", chapterOneIds.get(i + 1)); - edge.put("type", "Subsequence"); + edge.put("type", "order"); edge.put("sta", 2); edgesArray.add(edge); } @@ -393,7 +352,7 @@ public class knowServiceImpl implements KnowService { JSONObject edge = JSONUtil.createObj(); edge.put("source", chapterTwoIds.get(i)); edge.put("target", chapterTwoIds.get(i + 1)); - edge.put("type", "Subsequence"); + edge.put("type", "order"); edge.put("sta", 2); edgesArray.add(edge); } @@ -404,7 +363,7 @@ public class knowServiceImpl implements KnowService { JSONObject edge = JSONUtil.createObj(); edge.put("source", knowIds.get(i)); edge.put("target", knowIds.get(i + 1)); - edge.put("type", "Subsequence"); + edge.put("type", "order"); edge.put("sta", 4); edgesArray.add(edge); } @@ -413,77 +372,282 @@ public class knowServiceImpl implements KnowService { String jsonNodeCourse = jsonArrayCourseNode.toString(); String jsonEdges = edgesArray.toString(); - System.out.println("json node " + jsonNodeKnow); - System.out.println("json jsonNodeChapter " + jsonNodeChapter); - System.out.println("json edge " + jsonEdges); - return generateGraph(jsonNodeCourse, jsonNodeChapter, jsonNodeKnow, jsonEdges); + + KnowStr knowStr = new KnowStr(); + knowStr.setCourseId(courseId); + knowStr.setCoursestr(jsonNodeCourse); + knowStr.setChapterstr(jsonNodeChapter); + knowStr.setKnowstr(jsonNodeKnow); + knowStr.setEdgestr(jsonEdges); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_id", courseId); + KnowStr knowStrOld = knowstrMapper.selectOne(queryWrapper); + if (knowStrOld != null) { + int f = knowstrMapper.update(knowStr, queryWrapper); + if (f > 0) { + return ResultUtils.success("修改成功"); + } + } + int f = knowstrMapper.insert(knowStr); + if (f > 0) { + return ResultUtils.success("创建成功"); + } //将json保存在mysql表中 + return ResultUtils.error(ErrorCode.OPERATION_ERROR); + } + @Override + public BaseResponse> knowLearnPath(String corseId) { + + //查询第一个知识点-最后一个知识点 + List knowIds = new ArrayList<>(); + List chapterList = chapterMapper.selectChapterPIDByCourseId(corseId); + for (int i = 0; i < chapterList.size(); i++) { + List chapterList1 = chapterMapper.selectChapterChildrenOrderByNum(chapterList.get(i).getId()); + for (int j = 0; j < chapterList1.size(); j++) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("chapterid", chapterList1.get(j).getId()); + List knowtmp = knowtmpMapper.selectList(queryWrapper); + for (int k = 0; k < knowtmp.size(); k++) { + Knowtmp knowtmp1 = knowtmp.get(k); + knowIds.add(knowtmp1.getId()); + } + } + + } + + // 生成学习路径 + String str = "MATCH p = (:Know{knowId:" + knowIds.get(0) + "})-[*]->(:Know{knowId:" + knowIds.get(knowIds.size() - 1) + "}) WITH p, REDUCE(totalWeight = 0.0, r IN relationships(p) | totalWeight + r.weight) AS pathWeight " + + "RETURN [x IN nodes(p)|x.name] AS path,pathWeight ORDER BY pathWeight desc;" ; + Collection> result = neo4jClient.query(str).fetch().all(); + Iterator> iterator = result.iterator(); + ListknowPathVOList = new ArrayList<>(); + KnowPathVO knowPathVO; + while (iterator.hasNext()) { + Map element = iterator.next(); + knowPathVO= new KnowPathVO(); + List list = new ArrayList<>(); + list = (List) element.get("path"); + knowPathVO.setNodeList(list); + Double pathWeight = (Double) element.get("pathWeight"); + knowPathVO.setWeight(pathWeight); + knowPathVOList.add(knowPathVO); + } + return ResultUtils.success(knowPathVOList); } - Long opResult( String source, String target, String type, Integer sta){ + @Override + public BaseResponse knowLearnPathGraph(String corseId) { + + //查询第一个知识点-最后一个知识点 + List knowIds = new ArrayList<>(); + List chapterList = chapterMapper.selectChapterPIDByCourseId(corseId); + for (int i = 0; i < chapterList.size(); i++) { + List chapterList1 = chapterMapper.selectChapterChildrenOrderByNum(chapterList.get(i).getId()); + for (int j = 0; j < chapterList1.size(); j++) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("chapterid", chapterList1.get(j).getId()); + List knowtmp = knowtmpMapper.selectList(queryWrapper); + for (int k = 0; k < knowtmp.size(); k++) { + Knowtmp knowtmp1 = knowtmp.get(k); + knowIds.add(knowtmp1.getId()); + } + } + + } + + // 生成学习路径 + String str = "MATCH p = (:Know{knowId:" + knowIds.get(0) + "})-[*]->(:Know{knowId:" + knowIds.get(knowIds.size() - 1) + "}) WITH p, REDUCE(totalWeight = 0.0, r IN relationships(p) | totalWeight + r.weight) AS pathWeight " + + "RETURN nodes(p) as `p`,relationships(p) as `r`,pathWeight ORDER BY pathWeight desc;" ; + Collection> result = neo4jClient.query(str).fetch().all(); + Iterator> iterator = result.iterator(); + Set knowList = new HashSet<>(); + Set linksList = new HashSet<>(); + KnowVO knowVO; + List node2 = new ArrayList<>(); + Links links; + int p = 0; + while (iterator.hasNext()) { + + Map element = iterator.next(); + List list1 = (List) element.get("p"); + for (int i = 0; i < list1.size(); i++) { + Node node1 = (Node)list1.get(i); + Long id = node1.id(); + String name = node1.get("name").asString(); + knowVO = new KnowVO(); + knowVO.setId(id); + knowVO.setLabel(name); + knowVO.setColor(colorList[0]); + knowList.add(knowVO); + } + List list2 = (List) element.get("r"); + if (!list2.isEmpty()) { + for (int i = 0; i < list2.size(); i++) { + InternalRelationship e = (InternalRelationship) list2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } else if("dependent".equals(e.type())){ + links.setLabel("依赖"); + } + linksList.add(links); + } + } + Double pathWeight = (Double) element.get("pathWeight"); + } + BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); + return ResultUtils.success(baseKnowReturn); + } + + @Override + public BaseResponse updateLinks(List linksList) { + for (int i = 0; i < linksList.size(); i++) { + LinksVO links = linksList.get(i); + Long source = links.getSource(); + Long target = links.getTarget(); + String label = links.getLabel(); + //查询source ,target是否存在 + int f = knowRepository.queryNode(source); + if (f <= 0) { + return ResultUtils.error(ErrorCode.PARAMS_ERROR, "source Id不存在"); + } + f = knowRepository.queryNode(target); + if (f <= 0) { + return ResultUtils.error(ErrorCode.PARAMS_ERROR, "source Id不存在"); + } + if (label == null || (!"order".equals(label) && "conatin".equals(label) && "dependent".equals(label))) { + return ResultUtils.error(ErrorCode.PARAMS_ERROR, "type 不存在"); + } + //判断关系是否存在 + String weight = null; + if ("contain".equals(label)) { + weight = " {weight:5}"; + } else if ("dependent".equals(label)) { + weight = " {weight:9}"; + } else if ("order".equals(label)) { + weight = " {weight: 1}"; + } + + String str = "MATCH (n:Know)-[r:" + label +weight+ "]->(p:Know)" + + "WHERE Id(n) =" + source + " AND Id(p) = " + target + + " RETURN COUNT(r) > 0 AS relationshipExists;"; + + Collection> result = neo4jClient.query(str).fetch().all(); + Iterator> iterator = result.iterator(); + while (iterator.hasNext()) { + Map element = iterator.next(); + Boolean res = (Boolean) element.get("relationshipExists"); + if (res) { + return ResultUtils.error(ErrorCode.OPERATION_ERROR, "关系已存在"); + } + } + + + + str = "MATCH (n:Know), (p:Know) where ID(n) = " + source + " and ID(p) = " + target + " CREATE (n)-[r:" + + label + weight + "]->(p) RETURN count(r) as `r`;"; + Collection> result1 = neo4jClient.query(str).fetch().all(); + Iterator> iterator1 = result1.iterator(); + while (iterator1.hasNext()) { + Map element1 = iterator1.next(); + Long res1 = (Long) element1.get("r"); + if (res1 < 0L) { + return ResultUtils.error(ErrorCode.OPERATION_ERROR, "添加关系失败"); + } + + } + } + + + return ResultUtils.success("添加成功"); + + } + + + @Override + public BaseResponse deleteAllByCourseId(String courseId) { + Long f = knowRepository.deleteAllByCourseId(courseId); + if (f > 0) { + return ResultUtils.success("删除成功"); + } + return ResultUtils.error(ErrorCode.SYSTEM_ERROR, "删除失败"); + } + + + Long opResult(String source, String target, String type, Integer sta) { Long res = -1L; String weight = null; - if("contain".equals(type)){ - weight = " {weight:5}"; - }else if("dependent".equals(type)){ - weight = " {weight:9}"; - }else if("order".equals(type)){ - weight = " {weight: 1}"; - } - if(sta != null && sta == 1){ + if ("contain".equals(type)) { + weight = " {weight:5}"; + } else if ("dependent".equals(type)) { + weight = " {weight:9}"; + } else if ("order".equals(type)) { + weight = " {weight: 1}"; + } + if (sta != null && sta == 1) { res = -1L; Long target1 = Long.parseLong(target); - res = knowRepository.addCourseRelationship(source,target1); - if (res< 0L) { + String str = "MATCH (p:Know), (j:Know) WHERE p.courseId= '" + source + "' AND j.chapterId= " + target1 + " CREATE (p)-[r: " + type + weight + " ]->(j) return count(r) as `count`;"; + Collection> result = neo4jClient.query(str).fetch().all(); + Iterator> iterator = result.iterator(); + while (iterator.hasNext()) { + Map element = iterator.next(); + res = (Long) element.get("count"); + } + if (res < 0L) { throw new RuntimeException("添加课程-章节 包含 失败"); } return res; - } - else if (sta != null && sta == 2) { + } else if (sta != null && sta == 2) { Long source1 = Long.parseLong(source); Long target1 = Long.parseLong(target); - String str = "MATCH (p:Know), (j:Know) WHERE p.chapterId= "+source1+" AND j.chapterId= "+target1+" CREATE (p)-[r: "+type+weight+" ]->(j) return count(r) as `count`;"; + String str = "MATCH (p:Know), (j:Know) WHERE p.chapterId= " + source1 + " AND j.chapterId= " + target1 + " CREATE (p)-[r: " + type + weight + " ]->(j) return count(r) as `count`;"; Collection> result = neo4jClient.query(str).fetch().all(); Iterator> iterator = result.iterator(); res = -1L; - while (iterator.hasNext()){ + while (iterator.hasNext()) { Map element = iterator.next(); res = (Long) element.get("count"); } - if (res<=0L) { - throw new RuntimeException("添加章节-章节"+type+"失败"); + if (res <= 0L) { + throw new RuntimeException("添加章节-章节" + type + "失败"); } return res; } else if (sta != null && sta == 3) { Long source1 = Long.parseLong(source); Long target1 = Long.parseLong(target); - String str = "MATCH (p:Know), (j:Know) WHERE p.chapterId= "+source1+" AND j.knowId= "+target1+" CREATE (p)-[r: "+type+weight+" ]->(j) return count(r) as `count`;"; + String str = "MATCH (p:Know), (j:Know) WHERE p.chapterId= " + source1 + " AND j.knowId= " + target1 + " CREATE (p)-[r: " + type + weight + " ]->(j) return count(r) as `count`;"; Collection> result = neo4jClient.query(str).fetch().all(); Iterator> iterator = result.iterator(); res = -1L; - while (iterator.hasNext()){ + while (iterator.hasNext()) { Map element = iterator.next(); res = (Long) element.get("count"); } if (res < 0) { - throw new RuntimeException("添加章节-知识点"+type+"失败"); + throw new RuntimeException("添加章节-知识点" + type + "失败"); } return res; } else if (sta != null && sta == 4) { Long source1 = Long.parseLong(source); Long target1 = Long.parseLong(target); - String str = "MATCH (p:Know), (j:Know) WHERE p.chapterId= "+source1+" AND j.knowId= "+target1+" CREATE (p)-[r: "+type+weight+" ]->(j) return count(r) as `count`;"; + String str = "MATCH (p:Know), (j:Know) WHERE p.knowId= " + source1 + " AND j.knowId= " + target1 + " CREATE (p)-[r: " + type + weight + " ]->(j) return count(r) as `count`;"; Collection> result = neo4jClient.query(str).fetch().all(); Iterator> iterator = result.iterator(); - res = -1L; - while (iterator.hasNext()){ + res = -1L; + while (iterator.hasNext()) { Map element = iterator.next(); res = (Long) element.get("count"); } if (res < 0L) { - throw new RuntimeException("添加知识点-知识点 关系"+type+"失败"); + throw new RuntimeException("添加知识点-知识点 关系" + type + "失败"); } return res; } else { @@ -492,8 +656,17 @@ public class knowServiceImpl implements KnowService { } - //todo 根据json串生成 图谱 保证事务 - private BaseResponse generateGraph(String jsonNodeCourse, String jsonNodeChapter, String jsonNodeKnow, String jsonEdges) { + + //根据json串生成 图谱 保证事务 + public BaseResponse generateGraph(String courseId1) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_id", courseId1); + KnowStr knowStr = knowstrMapper.selectOne(queryWrapper); + String jsonNodeCourse = knowStr.getCoursestr(); + String jsonNodeChapter = knowStr.getChapterstr(); + String jsonNodeKnow = knowStr.getKnowstr(); + String jsonEdges = knowStr.getEdgestr(); + ArrayList idLists = new ArrayList<>(); //插入图 JSONArray jsonArrayCourse = JSONUtil.parseArray(jsonNodeCourse); for (Object obj : jsonArrayCourse) { @@ -504,8 +677,9 @@ public class knowServiceImpl implements KnowService { Integer hour = jsonObject.getInt("hour"); //在图数据库中插入 Long res = knowRepository.addCourse(courseId, name, info, hour); + idLists.add(res); if (res == null) { - throw new RuntimeException("添加课程失败"); + return ResultUtils.error(ErrorCode.SYSTEM_ERROR,"添加课程失败"); } } @@ -519,8 +693,13 @@ public class knowServiceImpl implements KnowService { double hour = jsonObject.getDouble("hour"); //在图数据库中插入 Long res = knowRepository.addChapter(chapterId, name, info, hour); + idLists.add(res); if (res == null) { - throw new RuntimeException("添加章节失败"); + for (int i = 0; i < idLists.size(); i++) { + knowRepository.deleteNode(idLists.get(i)); + } + return ResultUtils.error(ErrorCode.SYSTEM_ERROR,"添加章节失败"); + } } @@ -534,8 +713,12 @@ public class knowServiceImpl implements KnowService { double hour = jsonObject.getDouble("hour"); //在图数据库中插入 Long res = knowRepository.addKnow(knowId, name, info, hour); + idLists.add(res); if (res == null) { - throw new RuntimeException("添加知识点失败"); + for (int i = 0; i < idLists.size(); i++) { + knowRepository.deleteNode(idLists.get(i)); + } + return ResultUtils.error(ErrorCode.SYSTEM_ERROR,"添加知识点失败"); } } @@ -548,243 +731,17 @@ public class knowServiceImpl implements KnowService { String type = jsonObject.getStr("type"); Integer sta = jsonObject.getInt("sta"); try { - opResult(source,target,type,sta); - }catch (Exception e){ - e.printStackTrace(); - return ResultUtils.error(ErrorCode.SYSTEM_ERROR,"添加节点关系失败"); - } - } - return ResultUtils.success("添加节点关系成功"); - } - - - @Transactional - public void addAllKnowTransation(String courseId) throws Exception { - int f; - //验证章节是否存在 - //验证知识点是否存在,避免重复添加 - //先添加节点 - //后赋值关系 - - - // 2.从课程表查出课程节点 并添加到 neo - Courses courses = coursesMapper.selectById(courseId); - Long KnowCourseId = knowRepository.addCourse(courseId, courses.getName(), courses.getDescription(), courses.getClasshours()); - - if (KnowCourseId == null) { - throw new RuntimeException("添加课程失败"); - } - // 3 从章节表查出章节节点 并添加到 neo - List chapterList = new ArrayList<>(); - List chapterListPID = chapterMapper.selectChapterPIDByCourseId(courseId); - for (int i = 0; i < chapterListPID.size(); i++) { - chapterList.add(chapterListPID.get(i)); - List chapterListSecond = chapterMapper.selectChapterChildrenOrderByNum(chapterListPID.get(i).getId()); - for (int j = 0; j < chapterListSecond.size(); j++) { - chapterList.add(chapterListSecond.get(j)); - } - } - //添加节点 - List chapterIds = new ArrayList<>(); - List chapterOneIds = new ArrayList<>(); - List chapterTwoIds = new ArrayList<>(); - for (int i = 0; i < chapterList.size(); i++) { - Chapter chapter = chapterList.get(i); - Long KnowChapterId = knowRepository.addChapter(chapter.getId(), chapter.getName(), chapter.getContent(), chapter.getTotalClassHours()); - if (chapter.getPid() == 0) { - chapterOneIds.add(KnowChapterId); - } else { - chapterTwoIds.add(KnowChapterId); - } - chapterIds.add(chapter.getId()); - if (KnowChapterId == null) { - throw new RuntimeException("添加章节失败"); - } - } - - //获取chapterId 查询知识点 返回知识点集合 - List knowIds = new ArrayList<>(); - for (int i = 0; i < chapterList.size(); i++) { - Chapter chapter = chapterList.get(i); - if (chapter.getPid() != 0) { - List knowlist = knowtmpService.queryByChapterId(chapter.getId()); - for (int j = 0; j < knowlist.size(); j++) { - Long knowId = knowRepository.addKnow(knowlist.get(j).getId(), knowlist.get(j).getName(), knowlist.get(j).getInfo(), knowlist.get(j).getHour()); - knowIds.add(knowId); - if (knowId == null) { - throw new RuntimeException("添加知识点失败"); - } - //添加知识点关系 - f = knowRepository.addContainWithKnow(knowId, chapterIds.get(i)); - if (f <= 0) { - throw new RuntimeException("添加知识点-章节失败关系失败"); - } + opResult(source, target, type, sta); + } catch (Exception e) { + for (int i = 0; i < idLists.size(); i++) { + knowRepository.deleteNode(idLists.get(i)); } + return ResultUtils.error(ErrorCode.SYSTEM_ERROR, "添加节点关系失败"); } - - } - - for (int i = 0; i < chapterList.size(); i++) { - Chapter chapter = chapterList.get(i); - if (chapter.getPid() == 0) { - f = knowRepository.addContainWithCourse(chapter.getCourseId(), chapter.getId()); - if (f <= 0) throw new RuntimeException("添加课程-章节关系失败"); - } else { - f = knowRepository.addContainWithChapter(chapter.getId(), chapter.getPid()); - if (f <= 0) throw new RuntimeException("添加章节-章节关系失败"); - } - - } - - //添加顺序关系 - - //给章添加顺序关系 - for (int i = 0; i < chapterOneIds.size() - 1; i++) { - f = knowRepository.addOrderById(chapterOneIds.get(i), chapterOneIds.get(i + 1)); - if (f <= 0) throw new RuntimeException("添加章-章 顺序关系失败"); - } - - //给节添加顺序关系 - for (int i = 0; i < chapterTwoIds.size() - 1; i++) { - f = knowRepository.addOrderById(chapterTwoIds.get(i), chapterTwoIds.get(i + 1)); - if (f <= 0) throw new RuntimeException("添加节-节 顺序关系失败"); - } - //给知识点添加顺序关系 - for (int i = 0; i < knowIds.size() - 1; i++) { - f = knowRepository.addOrderById(knowIds.get(i), knowIds.get(i + 1)); - if (f <= 0) throw new RuntimeException("添加知识点-知识点 顺序关系失败"); - } - } - -// @Override -// public BaseResponse addKnow(KnowRequest knowRequest) { -// Know know = new Know(); -// BeanUtils.copyProperties(knowRequest,know); -// Long know1 = knowRepository.addKnow(know.getName(),know.getInfo()); -// if(know1 != null){ -// return ResultUtils.success("添加知识点成功"); -// }else{ -// return ResultUtils.error(ErrorCode.OPERATION_ERROR,"添加知识点失败"); -// } -// } - - @Override - public BaseResponse updateKnow(KnowUpdateRequest knowUpdateRequest) { - Know know = new Know(); - BeanUtils.copyProperties(knowUpdateRequest, know); - int f = knowRepository.updateKnow(know.getId(), know.getName(), know.getInfo()); - if (f > 0) { - return ResultUtils.success("修改知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "修改知识点失败"); } + return ResultUtils.success("添加节点关系成功"); } - @Override - public BaseResponse deleteKnow(Long id) { - // todo 判断知识点存在否 - int f = knowRepository.deleteKnow(id); - if (f > 0) { - return ResultUtils.success("删除知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "删除知识点失败"); - } - - } - - @Override - public BaseResponse queryKnow(Long id) { - Know know = knowRepository.queryKnow(id); - return ResultUtils.success(know); - } - - //======================== - - @Override - public BaseResponse addCourse(KnowCourseCreateRequest knowCourseCreateRequest) { - KnowCourse knowCourse = new KnowCourse(); - BeanUtils.copyProperties(knowCourseCreateRequest, knowCourse); - Long knowCourse1 = knowRepository.addCourse(knowCourse.getCourseId(), knowCourse.getName(), knowCourse.getInfo(), knowCourse.getHour()); - if (knowCourse1 != null) { - return ResultUtils.success("添加知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "添加知识点失败"); - } - } - - @Override - public BaseResponse updateCourse(KnowCourseCreateRequest knowCourseCreateRequest) { - KnowCourse knowCourse = new KnowCourse(); - BeanUtils.copyProperties(knowCourseCreateRequest, knowCourse); - int f = knowRepository.updateCourse(knowCourse.getCourseId(), knowCourse.getName(), knowCourse.getInfo()); - if (f > 0) { - return ResultUtils.success("修改知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "修改知识点失败"); - } - } - - @Override - public BaseResponse deleteCourse(String courseId) { - - int f = knowRepository.deleteCourse(courseId); - if (f > 0) { - return ResultUtils.success("删除知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "删除知识点失败"); - } - } - - @Override - public BaseResponse queryCourse(String courseId) { - KnowCourse Knowcourse = knowRepository.queryCourse(courseId); - return ResultUtils.success(Knowcourse); - } - - //========================= - - - @Override - public BaseResponse addChapter(KnowChapterCreateRequest knowChapterCreateRequest) { - KnowChapter knowChapter = new KnowChapter(); - BeanUtils.copyProperties(knowChapterCreateRequest, knowChapter); - Long f = knowRepository.addChapter(knowChapter.getChapterId(), knowChapter.getName(), knowChapter.getInfo(), knowChapter.getHour()); - if (f > 0) { - return ResultUtils.success("添加章节成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "添加章节失败"); - } - } - - @Override - public BaseResponse updateChapter(KnowChapterCreateRequest knowChapterCreateRequest) { - KnowChapter knowChapter = new KnowChapter(); - BeanUtils.copyProperties(knowChapterCreateRequest, knowChapter); - int f = knowRepository.updateChapter(knowChapter.getChapterId(), knowChapter.getName(), knowChapter.getInfo()); - if (f > 0) { - return ResultUtils.success("修改知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "修改知识点失败"); - } - } - - @Override - public BaseResponse deleteChapter(Long chapterId) { - int f = knowRepository.deleteChapter(chapterId); - if (f > 0) { - return ResultUtils.success("删除知识点成功"); - } else { - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "删除知识点失败"); - } - } - - @Override - public BaseResponse queryChapter(Long chapterId) { - KnowChapter knowChapter = knowRepository.queryChapter(chapterId); - return ResultUtils.success(knowChapter); - } - - //=============== //获取课程下的所有知识点 @Override @@ -837,6 +794,8 @@ public class knowServiceImpl implements KnowService { links.setLabel("包含"); } else if ("order".equals(e.type())) { links.setLabel("顺序"); + }else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); } linksList.add(links); } @@ -858,6 +817,8 @@ public class knowServiceImpl implements KnowService { links.setLabel("包含"); } else if ("order".equals(e.type())) { links.setLabel("顺序"); + }else if ("dependent".equals(e.type())) { + links.setLabel("依赖"); } linksList.add(links); } @@ -871,16 +832,42 @@ public class knowServiceImpl implements KnowService { } @Override - public BaseResponse getsecondKnowsById(Long id) { - Collection> all = - neo4jClient.query("match(n:Know)-[r*0..2]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all(); + public BaseResponse getRelsNodesByCourseId(String courseId, Integer level,List types) { + List typesTemp = new ArrayList<>(); + String str; + if(types == null || types.size() <= 0){ + typesTemp.add("contain"); + typesTemp.add("orer"); + typesTemp.add("dependent"); + str = "match(n:Know)-[r:"; + for (int i = 0; i < typesTemp.size(); i++) { + if (i == typesTemp.size() - 1) { + str = str + typesTemp.get(i) + "*"; + } else { + str = str + typesTemp.get(i) + "|"; + } - Map colorChoose = new HashMap<>(); - String color[] = new String[10]; - String[] colorList = {"#91CC75", "#5470C6", "#FAC858", "#EE6666", "#73C0DE", "#EA7CCC", "#5577FF", "#5577FF", "#9DBFFF", "#78A7FF"}; - for (int i = 0; i < 10; i++) { - colorChoose.put((long) i, colorList[i]); + } + }else{ + str = "match(n:Know)-[r:"; + for (int i = 0; i < types.size(); i++) { + if (i == types.size() - 1) { + str = str + types.get(i) + "*"; + } else { + str = str + types.get(i) + "|"; + } + + } + } + + if(level == null || level <= 0){ + str = str +"]->(p:Know) where n.courseId = '" + courseId + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`"; + }else{ + str = str +"0.."+level+ "]->(p:Know) where n.courseId = '" + courseId + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`"; } + System.out.println(str); + Collection> all = + neo4jClient.query(str).fetch().all(); Iterator> iterator = all.iterator(); Set knowList = new HashSet<>(); @@ -893,58 +880,190 @@ public class knowServiceImpl implements KnowService { Map element = iterator.next(); knowVO = new KnowVO(); Node node1 = (Node) element.get("p"); - Long group = (Long) element.get("d"); - Long id1 = node1.id(); - - String name1 = node1.get("name").asString(); - knowVO.setId(id1); - knowVO.setLabel(name1); knowVO.setColor(colorChoose.get(group)); - + if (node1 != null) { + Long id1 = node1.id(); + String name1 = node1.get("name").asString(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + } node2 = (List) element.get("r"); - for (int i = 0; i < node2.size(); i++) { - InternalRelationship e = (InternalRelationship) node2.get(i); - links = new Links(); - links.setId(e.id()); - links.setSource(e.startNodeId()); - links.setTarget(e.endNodeId()); - if ("contain".equals(e.type())) { - links.setLabel("包含"); - } else if ("order".equals(e.type())) { - links.setLabel("顺序"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + }else if("dependent".equals(e.type())){ + links.setLabel("依赖"); + } + linksList.add(links); } - linksList.add(links); } + } + BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); + return ResultUtils.success(baseKnowReturn); + } + @Override + public BaseResponse getRelsNodesById(Long id, List types) { + String str = "match(n:Know)-[r:"; + for (int i = 0; i < types.size(); i++) { + if (i == types.size() - 1) { + str = str + types.get(i) + "*"; + } else { + str = str + types.get(i) + "|"; + } } + str = str + "]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`"; + System.out.println(str); + Collection> all = + neo4jClient.query(str).fetch().all(); + + Iterator> iterator = all.iterator(); + Set knowList = new HashSet<>(); + Set linksList = new HashSet<>(); + KnowVO knowVO; + List node2 = new ArrayList<>(); + Links links; + int p = 0; + while (iterator.hasNext()) { + Map element = iterator.next(); + knowVO = new KnowVO(); + Node node1 = (Node) element.get("p"); + Long group = (Long) element.get("d"); + knowVO.setColor(colorChoose.get(group)); + if (node1 != null) { + Long id1 = node1.id(); + String name1 = node1.get("name").asString(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + } + node2 = (List) element.get("r"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + }else if("dependent".equals(e.type())){ + links.setLabel("依赖"); + } + linksList.add(links); + } + } + } BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); return ResultUtils.success(baseKnowReturn); } - //获取课程下的所有资源 @Override - public BaseResponse> getAllResourcesByCourseId(String id) { + public BaseResponse getKnowGraphById(Long id) { + + String str = "match(n:Know)-[r*]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`"; + System.out.println(str); Collection> all = - neo4jClient.query("match(n:Know)-[r*0..]->(p:Know) where n.courseId = '" + id + "' return p as `p`").fetch().all(); + neo4jClient.query(str).fetch().all(); + Iterator> iterator = all.iterator(); - Set knowList = new HashSet<>(); - KnowVO1 knowVO; + Set knowList = new HashSet<>(); + Set linksList = new HashSet<>(); + KnowVO knowVO; + List node2 = new ArrayList<>(); + Links links; + int p = 0; while (iterator.hasNext()) { Map element = iterator.next(); - knowVO = new KnowVO1(); + knowVO = new KnowVO(); Node node1 = (Node) element.get("p"); - Long id1 = node1.id(); - String name1 = node1.get("name").asString(); + Long group = (Long) element.get("d"); + knowVO.setColor(colorChoose.get(group)); + if (node1 != null) { + Long id1 = node1.id(); + String name1 = node1.get("name").asString(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowList.add(knowVO); + knowVO.setColor(colorChoose.get(group)); + } + + node2 = (List) element.get("r"); + if (!node2.isEmpty()) { + for (int i = 0; i < node2.size(); i++) { + InternalRelationship e = (InternalRelationship) node2.get(i); + links = new Links(); + links.setId(e.id()); + links.setSource(e.startNodeId()); + links.setTarget(e.endNodeId()); + if ("contain".equals(e.type())) { + links.setLabel("包含"); + } else if ("order".equals(e.type())) { + links.setLabel("顺序"); + } + linksList.add(links); + } + } + } + BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList, linksList); + return ResultUtils.success(baseKnowReturn); + } + + @Override + public BaseResponse> getFontedAndBackKnows(Long id) { + //查询第一个知识点-最后一个知识点 + Know know = knowRepository.queryNodeT(id); + if (know == null) { + return ResultUtils.error(ErrorCode.PARAMS_ERROR, "知识点不存在"); + } + List knowVOList = new ArrayList<>(); + + String str = "match(n:Know)-[r:order]->(p:Know) where ID(p) =" + id + " return n"; + Collection> result = neo4jClient.query(str).fetch().all(); + Iterator> iterator = result.iterator(); + while (iterator.hasNext()) { + Map element = iterator.next(); + Node e = (Node) element.get("n"); + Long id1 = e.id(); + String name1 = e.get("name").asString(); + KnowVO knowVO = new KnowVO(); knowVO.setId(id1); knowVO.setLabel(name1); - knowList.add(knowVO); + knowVOList.add(knowVO); } - return ResultUtils.success(knowList); - } + String str1 = "match(n:Know)-[r:order]->(p:Know) where ID(n) =" + id + " return p"; + Collection> result1 = neo4jClient.query(str1).fetch().all(); + Iterator> iterator1 = result1.iterator(); + while (iterator1.hasNext()) { + Map element = iterator1.next(); + Node e = (Node) element.get("p"); + Long id1 = e.id(); + String name1 = e.get("name").asString(); + KnowVO knowVO = new KnowVO(); + knowVO.setId(id1); + knowVO.setLabel(name1); + knowVOList.add(knowVO); + } + + return ResultUtils.success(knowVOList); + } } diff --git a/src/main/java/com/teaching/backend/service/impl/knowtmp/KnowtmpServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/knowtmp/KnowtmpServiceImpl.java index 968c903..9e109b8 100644 --- a/src/main/java/com/teaching/backend/service/impl/knowtmp/KnowtmpServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/knowtmp/KnowtmpServiceImpl.java @@ -34,6 +34,8 @@ public class KnowtmpServiceImpl implements KnowtmpService { @Autowired private KnowtmpMapper knowtmpMapper; + + @Override public BaseResponse getAllKnows(String courseId) { // 3 从章节表查出章节节点 并添加到 neo @@ -61,6 +63,10 @@ public class KnowtmpServiceImpl implements KnowtmpService { public BaseResponse update(KnowtempUpdate knowtempUpdate) { Knowtmp knowtmp = new Knowtmp(); BeanUtils.copyProperties(knowtempUpdate,knowtmp); + Knowtmp knowtmpOld = knowtmpMapper.selectById(knowtmp.getId()); + if(knowtmpOld == null){ + return ResultUtils.error(ErrorCode.OPERATION_ERROR,"数据不存在"); + } int f = knowtmpMapper.updateById(knowtmp); if(f > 0){ return ResultUtils.success("修改成功"); @@ -71,7 +77,11 @@ public class KnowtmpServiceImpl implements KnowtmpService { @Override public BaseResponse delete(Long id) { - // todo 查询 id + + Knowtmp knowtmpOld = knowtmpMapper.selectById(id); + if(knowtmpOld == null){ + return ResultUtils.error(ErrorCode.OPERATION_ERROR,"数据不存在"); + } int f = knowtmpMapper.deleteById(id); if(f > 0){ return ResultUtils.success("删除成功"); @@ -83,13 +93,19 @@ public class KnowtmpServiceImpl implements KnowtmpService { @Override public BaseResponse query(Long id) { Knowtmp knowtmp = knowtmpMapper.selectById(id); + if(knowtmp == null){ + return ResultUtils.error(ErrorCode.OPERATION_ERROR,"数据不存在"); + } return ResultUtils.success(knowtmp); } @Override - public List queryByChapterId(Long chapterId) { + public BaseResponse> queryByChapterId(Long chapterId) { List knowtmps = knowtmpMapper.queryIdByChapterId(chapterId); - return knowtmps; + if(knowtmps == null){ + return ResultUtils.error(ErrorCode.OPERATION_ERROR,"数据不存在"); + } + return ResultUtils.success(knowtmps); } @Override diff --git a/src/main/java/com/teaching/backend/service/impl/message/MessagesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/message/MessagesServiceImpl.java index 6b7b2c4..7d1755e 100644 --- a/src/main/java/com/teaching/backend/service/impl/message/MessagesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/message/MessagesServiceImpl.java @@ -59,6 +59,13 @@ public class MessagesServiceImpl extends ServiceImpl courseIds = Arrays.stream(sysMessageDTO.getCourseId().split(",")) + .map(String::valueOf) + .collect(Collectors.toList()); + if (courseIds.size()>1){ + throw new BusinessException(ErrorCode.MOST_ONE_COURSE); + } + // 4.判断是什么用户,只有教师可以群发,学生只能单发 String roleId = umsUserMapper.selectOne(new LambdaQueryWrapper<>(UmsUser.class) .eq(UmsUser::getId, sysMessageDTO.getSenderId())).getRoleId(); diff --git a/src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java index 941991f..62d0d4f 100644 --- a/src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java @@ -53,11 +53,13 @@ public class RecordKnowledgeFinishServiceImpl extends ServiceImpl saveCoursesRecords(ResourceLearningRecord resourceLearningRecord) { + public BaseResponse saveResourceRecords(ResourceLearningRecord resourceLearningRecord) { //课程id String courseId = resourceLearningRecord.getCoursesId(); String knowledgeId = resourceLearningRecord.getKnowledgeId(); @@ -67,7 +67,7 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl getPage(int pagenum, int pagesize, String userId, String knowledgeId, String courseId) { //格式化时间 diff --git a/src/main/java/com/teaching/backend/service/impl/resource/ResourceGraphServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/resource/ResourceGraphServiceImpl.java new file mode 100644 index 0000000..0526202 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/impl/resource/ResourceGraphServiceImpl.java @@ -0,0 +1,146 @@ +package com.teaching.backend.service.impl.resource; + + +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.common.ErrorCode; +import com.teaching.backend.common.ResultUtils; +import com.teaching.backend.mapper.know.KnowRepository; +import com.teaching.backend.mapper.resource.ResourcesRepository; +import com.teaching.backend.model.dto.resource.ResourceUploadDto; +import com.teaching.backend.model.entity.know.KnowChapter; +import com.teaching.backend.model.entity.know.KnowCourse; +import com.teaching.backend.model.entity.resource.Resources; +import com.teaching.backend.service.resource.ResourceGraphService; +import com.teaching.backend.service.resource.ResourceService; +import com.teaching.backend.utils.MinioUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.InputStreamResource; +import org.springframework.data.neo4j.core.Neo4jClient; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Set; + + +/** + * @Author:youhang + * @Date:2024-07-26-13:58 + * @Description: + */ +@Service +public class ResourceGraphServiceImpl implements ResourceGraphService { + + @Autowired + private ResourcesRepository resourcesRepository; + + @Autowired + private KnowRepository knowRepository; + + + + @Override + public BaseResponse addResourcesByIdAndResourcesId(Long id,Long resourcesId) { + // 查询知识点是否存在 ,资源是否存在 + int f = knowRepository.queryNode(id); + if(f <= 0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"知识点不存在"); + } + Resources resources = resourcesRepository.queryResourcesByIds(resourcesId); + if(resources == null){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"资源不存在"); + } + //查询关系是否存在 + int g = resourcesRepository.queryExisitRel(id,resourcesId); + if(g >0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"关系已经存在"); + } + //添加关系 addResourcesAndKnowById + f = resourcesRepository.addResourcesAndKnowById(id,resourcesId); + if(f<= 0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"创建关系失败"); + } + + return ResultUtils.success("添加关系成功"); + } + + @Override + public BaseResponse deleteResourcesAndKnowById(Long id, Long resourcesId) { + // 查询知识点是否存在 ,资源是否存在 + int f = knowRepository.queryNode(id); + if(f <= 0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"知识点不存在"); + } + Resources resources = resourcesRepository.queryResourcesByIds(resourcesId); + + if(resources == null){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"资源不存在"); + } + //查询关系是否存在 + int g = resourcesRepository.queryExisitRel(id,resourcesId); + if(g < 0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"关系未存在"); + } + + //删除关系 + f = resourcesRepository.deleteResourcesAndKnowById(id,resourcesId); + if(f<= 0){ + return ResultUtils.error(ErrorCode.PARAMS_ERROR,"删除关系失败"); + } + return ResultUtils.success("删除关系成功"); + } + + @Override + //查询课程下资源 + public BaseResponse> queryResourcesByCourseId(String courseId){ + // 判空,查询 + KnowCourse knowCourse = knowRepository.queryCourse(courseId); + if(knowCourse == null){ + return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在"); + } + Set resourcesSet = resourcesRepository.queryResourcesByCourseId(courseId); + return ResultUtils.success(resourcesSet); + } + @Override + //查询章节下资源 + public BaseResponse> queryResourcesByChapterId(Long chapterId){ + // 判空,查询 + KnowChapter knowChapter = knowRepository.queryChapter(chapterId); + if(knowChapter == null){ + return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"章节不存在"); + } + SetresourcesSet ; + resourcesSet = resourcesRepository.queryResourcesByChapterId(chapterId); + return ResultUtils.success(resourcesSet); + } + + @Override + //查询二级节点下资源 + public BaseResponse> queryBesidesKnowToResources(Long knowId){ + // 判空,查询 + int i = knowRepository.queryNode(knowId); + if(i <= 0){ + return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"知识点不存在"); + } + Set resourcesSet = resourcesRepository.queryBesidesKnowToResources(knowId); + return ResultUtils.success(resourcesSet); + } + + @Override + public BaseResponse> queryResourcesByKnowId(Long knowId) { + // 判空,查询 + int i = knowRepository.queryNode(knowId); + if(i <= 0){ + return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"知识点不存在"); + } + Set resourcesSet = resourcesRepository.queryResourcesByKnowId(knowId); + return ResultUtils.success(resourcesSet); + } + + +} diff --git a/src/main/java/com/teaching/backend/service/impl/resource/ResourceMysqlServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/resource/ResourceMysqlServiceImpl.java new file mode 100644 index 0000000..7432463 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/impl/resource/ResourceMysqlServiceImpl.java @@ -0,0 +1,34 @@ +package com.teaching.backend.service.impl.resource; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.common.ResultUtils; +import com.teaching.backend.mapper.resource.ResourceMysqlMapper; +import com.teaching.backend.model.entity.resource.ResourceMysql; +import com.teaching.backend.service.resource.IResourceMysqlService; +import org.apache.ibatis.annotations.Results; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 服务实现类 + *

+ * + * @author author + * @since 2024-09-02 + */ +@Service +public class ResourceMysqlServiceImpl extends ServiceImpl implements IResourceMysqlService { + private ResourceServiceImpl resourceService; + @Override + public BaseResponse resourceUpload(MultipartFile file, ResourceMysql resourceMysql) { + System.out.println(1); + System.out.println(file); + String url = resourceService.upload(file).getData().getUrl(); + resourceMysql.setPath(url); + save(resourceMysql); + return ResultUtils.success("添加成功"); + } +} diff --git a/src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java index a8708af..08b489b 100644 --- a/src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java @@ -1,39 +1,28 @@ package com.teaching.backend.service.impl.resource; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.json.JSONUtil; import com.teaching.backend.common.BaseResponse; import com.teaching.backend.common.ErrorCode; import com.teaching.backend.common.ResultUtils; -import com.teaching.backend.constant.ViewContentTypeEnum; +import com.teaching.backend.mapper.know.KnowRepository; import com.teaching.backend.mapper.resource.ResourcesRepository; -import com.teaching.backend.model.dto.resource.BucketPolicyConfigDto; import com.teaching.backend.model.dto.resource.ResourceUploadDto; +import com.teaching.backend.model.entity.resource.ResourceMysql; import com.teaching.backend.model.entity.resource.Resources; import com.teaching.backend.service.resource.ResourceService; import com.teaching.backend.utils.MinioUtils; -import io.minio.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.InputStreamResource; import org.springframework.data.neo4j.core.Neo4jClient; -import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import java.io.InputStream; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; /** @@ -47,6 +36,10 @@ public class ResourceServiceImpl implements ResourceService { @Autowired private ResourcesRepository resourcesRepository; + @Autowired + private KnowRepository knowRepository; + + private static final Logger LOGGER = LoggerFactory.getLogger(ResourceService.class); @Autowired @@ -108,69 +101,4 @@ public class ResourceServiceImpl implements ResourceService { public ResponseEntity readFile(String filename) { return minioUtils.readFile(filename); } - @Override - public BaseResponse addResourcesAndKnowByCourseId(String courseId, List resourcesIds){ - // todo 查询课程是否存在 ,资源是否存在 - int count = resourcesRepository.addResourcesAndKnowByCourseId(courseId,resourcesIds); - if(count == resourcesIds.size()){ - return ResultUtils.success("添加关系成功"); - }else{ - return ResultUtils.error(ErrorCode.OPERATION_ERROR,"添加失败"); - } - } - @Override - public BaseResponse addResourcesAndKnowByChapterId(Long chapterId, List resourcesIds){ - // todo 查询章节是否存在 ,资源是否存在 - int count = resourcesRepository.addResourcesAndKnowByChapterId(chapterId,resourcesIds); - if(count == resourcesIds.size()){ - return ResultUtils.success("添加关系成功"); - }else{ - return ResultUtils.error(ErrorCode.OPERATION_ERROR,"添加失败"); - } - } - @Override - public BaseResponse addResourcesAndKnowById(Long id, List resourcesIds){ - // todo 查询知识点是否存在 ,资源是否存在 - int count = resourcesRepository.addResourcesAndKnowById(id,resourcesIds); - if(count == resourcesIds.size()){ - return ResultUtils.success("添加关系成功"); - }else{ - return ResultUtils.error(ErrorCode.OPERATION_ERROR,"添加失败"); - } - } - @Override - //查询课程下资源 - public BaseResponse> queryResourcesByCourseId(String courseId){ - // todo 判空,查询 - SetresourcesSet; - resourcesSet = resourcesRepository.queryResourcesByCourseId(courseId); - return ResultUtils.success(resourcesSet); - } - @Override - //查询章节下资源 - public BaseResponse> queryResourcesByChapterId(Long chapterId){ - // todo 判空,查询 - SetresourcesSet ; - resourcesSet = resourcesRepository.queryResourcesByChapterId(chapterId); - return ResultUtils.success(resourcesSet); - } - - @Override - //查询二级节点下资源 - public BaseResponse> queryBesidesKnowToResources(Long KnowId){ - // todo 判空,查询 - SetresourcesSet ; - resourcesSet = resourcesRepository.queryBesidesKnowToResources(KnowId); - return ResultUtils.success(resourcesSet); - } - - @Override - public BaseResponse> queryResourcesByKnowId(Long KnowId) { - // todo 判空,查询 - SetresourcesSet ; - resourcesSet = resourcesRepository.queryResourcesByKnowId(KnowId); - return ResultUtils.success(resourcesSet); - } - - } diff --git a/src/main/java/com/teaching/backend/service/knowtmp/KnowtmpService.java b/src/main/java/com/teaching/backend/service/knowtmp/KnowtmpService.java index 3468a16..f71223a 100644 --- a/src/main/java/com/teaching/backend/service/knowtmp/KnowtmpService.java +++ b/src/main/java/com/teaching/backend/service/knowtmp/KnowtmpService.java @@ -13,6 +13,9 @@ import java.util.List; * @Description: */ public interface KnowtmpService { + + + //查询 BaseResponse getAllKnows(String courseId); @@ -30,7 +33,7 @@ public interface KnowtmpService { BaseResponse query(Long id); //查询通过chapterId List - List queryByChapterId(Long chapterId); + BaseResponse> queryByChapterId(Long chapterId); //查询通过chapterId List List queryByChapterIdList(List chapterIdList); diff --git a/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java b/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java index 1282e23..3d3f80c 100644 --- a/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java +++ b/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java @@ -18,7 +18,7 @@ import java.util.List; */ public interface IResourceLearningRecordService extends IService { - BaseResponse saveCoursesRecords(ResourceLearningRecord resourceLearningRecord); + BaseResponse saveResourceRecords(ResourceLearningRecord resourceLearningRecord); BaseResponse getPage(int pagenum, int pagesize, String userId, String knowledgeId, String courseId); diff --git a/src/main/java/com/teaching/backend/service/resource/IResourceMysqlService.java b/src/main/java/com/teaching/backend/service/resource/IResourceMysqlService.java new file mode 100644 index 0000000..d09d09b --- /dev/null +++ b/src/main/java/com/teaching/backend/service/resource/IResourceMysqlService.java @@ -0,0 +1,19 @@ +package com.teaching.backend.service.resource; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.model.entity.resource.ResourceMysql; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 服务类 + *

+ * + * @author author + * @since 2024-09-02 + */ +public interface IResourceMysqlService extends IService { + + BaseResponse resourceUpload(MultipartFile file, ResourceMysql resourceMysql); +} diff --git a/src/main/java/com/teaching/backend/service/resource/ResourceGraphService.java b/src/main/java/com/teaching/backend/service/resource/ResourceGraphService.java new file mode 100644 index 0000000..d2f6817 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/resource/ResourceGraphService.java @@ -0,0 +1,39 @@ +package com.teaching.backend.service.resource; + + +import com.teaching.backend.common.BaseResponse; +import com.teaching.backend.model.entity.resource.Resources; +import org.springframework.core.io.InputStreamResource; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Set; + +/** + * @Author:youhang + * @Date:2024-07-26-13:55 + * @Description: + */ + +public interface ResourceGraphService { + + public BaseResponse deleteResourcesAndKnowById(Long id, Long resourcesId); + + BaseResponse addResourcesByIdAndResourcesId(Long id, Long resourcesId); + + + //查询课程下资源 + BaseResponse> queryResourcesByCourseId(String courseId); + + //查询章节下资源 + BaseResponse> queryResourcesByChapterId(Long chapterId); + + //查询二级节点下资源 + BaseResponse> queryBesidesKnowToResources(Long knowId); + + BaseResponse> queryResourcesByKnowId(Long knowId); + + +} diff --git a/src/main/java/com/teaching/backend/service/resource/ResourceService.java b/src/main/java/com/teaching/backend/service/resource/ResourceService.java index 570a74e..c788a47 100644 --- a/src/main/java/com/teaching/backend/service/resource/ResourceService.java +++ b/src/main/java/com/teaching/backend/service/resource/ResourceService.java @@ -2,16 +2,12 @@ package com.teaching.backend.service.resource; import com.teaching.backend.common.BaseResponse; -import com.teaching.backend.model.dto.resource.ResourceUploadDto; +import com.teaching.backend.model.entity.resource.ResourceMysql; import com.teaching.backend.model.entity.resource.Resources; import org.springframework.core.io.InputStreamResource; -import org.springframework.data.neo4j.repository.query.Query; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; -import java.util.List; -import java.util.Set; - /** * @Author:youhang * @Date:2024-07-26-13:55 @@ -25,22 +21,5 @@ public interface ResourceService { BaseResponse delete(String filename) ; ResponseEntity readFile(String filename); - BaseResponse addResourcesAndKnowByCourseId(String courseId, List resourcesIds); - - BaseResponse addResourcesAndKnowByChapterId(Long chapterId, List resourcesIds); - - BaseResponse addResourcesAndKnowById(Long id, List resourcesIds); - - //查询课程下资源 - BaseResponse> queryResourcesByCourseId(String courseId); - - //查询章节下资源 - BaseResponse> queryResourcesByChapterId(Long chapterId); - - //查询二级节点下资源 - BaseResponse> queryBesidesKnowToResources(Long KnowId); - - BaseResponse> queryResourcesByKnowId(Long KnowId); - } diff --git a/src/main/resources/mapper/CourseLearningRecordMapper.xml b/src/main/resources/mapper/IResourceMysqlService.xml similarity index 100% rename from src/main/resources/mapper/CourseLearningRecordMapper.xml rename to src/main/resources/mapper/IResourceMysqlService.xml diff --git a/src/main/resources/mapper/SystemSettingsMapper.xml b/src/main/resources/mapper/SystemSettingsMapper.xml index d5b2e9b..f05db74 100644 --- a/src/main/resources/mapper/SystemSettingsMapper.xml +++ b/src/main/resources/mapper/SystemSettingsMapper.xml @@ -5,6 +5,9 @@ update system_settings + + name = #{home,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, @@ -26,6 +29,9 @@ record_number = #{recordNumber,jdbcType=VARCHAR}, + + record_information = #{recordInformation,jdbcType=VARCHAR}, + qq_number = #{qqNumber,jdbcType=VARCHAR}, diff --git a/src/test/java/com/teaching/TeachingBackendApplicationTests.java b/src/test/java/com/teaching/TeachingBackendApplicationTests.java index e0d611b..13f2dfd 100644 --- a/src/test/java/com/teaching/TeachingBackendApplicationTests.java +++ b/src/test/java/com/teaching/TeachingBackendApplicationTests.java @@ -8,156 +8,7 @@ import java.util.*; @SpringBootTest class TeachingBackendApplicationTests { -// Map> userLearningRecords = new HashMap<>(); -public static void main(String[] args) { + public static void main(String[] args) { -// String[] data = {"1", "2", "3", "7", "4", "1-1", "1-5", "1-4", "1-9", "1-2", "3-1", "3-2","1-3","1-6"}; - List linkedList = new ArrayList<>(); - linkedList.add("1"); - linkedList.add("1-1"); - linkedList.add("1-2"); - linkedList.add("1-3"); - linkedList.add("2"); - linkedList.add("2-1"); - linkedList.add("2-2"); - linkedList.add("2-3"); - linkedList.add("3"); - linkedList.add("3-1"); - linkedList.add("3-2"); - linkedList.add("3-3"); - linkedList.add("4"); - linkedList.add("5"); -// String x="1"; -// String x1="1011-2456"; -// String[] split = x1.split("-"); -// System.out.println(split[0]); -// System.out.println(split[1]); -// int i = x.indexOf("-"); -// System.out.println(i); - -// for (String str : data) { -// -// insertInOrder(linkedList, str); -// } - System.out.println("9999"); - System.out.println(linkedList); -// String x="2"; - String x1="2-1"; - - - int count=0,j=0; - List list = new ArrayList<>(); - - - String[] split1 = x1.split("-"); - System.out.println(String.valueOf(Integer.parseInt(split1[0])+1)); - for (int i=0;i linkedList, String newData) { -// ListIterator iterator = linkedList.listIterator(); -// -// while (iterator.hasNext()) { -// String current = iterator.next(); -// -// if (newData.compareTo(current) <= 0) { -// iterator.previous(); // 回到插入位置 -// iterator.add(newData); -// return; -// } -// } -// -// linkedList.addLast(newData); -// } -// private static void deleteEntry(LinkedList linkedList, String target) { -// ListIterator iterator = linkedList.listIterator(); -// -// while (iterator.hasNext()) { -// String current = iterator.next(); -// -// if (current.equals(target)) { -// // 获取target的前缀和序号 -// int dashIndex = target.indexOf("-"); -// if (dashIndex != -1) { -// String prefix = target.substring(0, dashIndex); -// int number = Integer.parseInt(target.substring(dashIndex + 1)); -// -// while (iterator.hasNext()) { -// String next = iterator.next(); -// if (next.startsWith(prefix + "-")) { -// // 更新数据序号 -// int nextNumber = Integer.parseInt(next.substring(dashIndex + 1)); -// String newEntry = prefix + "-" + (nextNumber - 1); -// iterator.remove(); -// iterator.add(newEntry); -// } else { -// iterator.previous(); // 回退到上一个位置 -// break; -// } -// } -// } -// } -// } -// } -// -// private static void printList(List list) { -// for (String str : list) { -// System.out.print(str + " "); -// } -// System.out.println(); -// } - }