SAMS/sql/mysql-2025_05_06_16_04_19-d...

292 lines
12 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- MySQL dump 10.13 Distrib 8.0.41, for Linux (x86_64)
--
-- Host: 127.0.0.1 Database: SAMS-R
-- ------------------------------------------------------
-- Server version 8.0.41-0ubuntu0.22.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 */;
--
-- Table structure for table `ams_comment`
--
DROP TABLE IF EXISTS `ams_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_comment` (
`comment_id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论ID',
`activity_id` bigint NOT NULL COMMENT '活动ID',
`user_id` bigint NOT NULL COMMENT '评论人ID',
`content` text NOT NULL COMMENT '评论内容',
`parent_id` bigint DEFAULT NULL COMMENT '父评论ID',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '评论时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动评论表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_comment`
--
LOCK TABLES `ams_comment` WRITE;
/*!40000 ALTER TABLE `ams_comment` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_comment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_approval_log`
--
DROP TABLE IF EXISTS `ams_approval_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_approval_log` (
`log_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`activity_id` bigint NOT NULL COMMENT '活动ID',
`approver_id` bigint NOT NULL COMMENT '审批人用户ID',
`role_key` varchar(50) DEFAULT NULL COMMENT '审批人角色标识(如 CLUB_ADMIN',
`result` varchar(20) NOT NULL COMMENT '审批结果approved / rejected',
`comment` text COMMENT '审批意见',
`step` int NOT NULL COMMENT '审批阶段0=社团1=院级2=校级)',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '审批时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动审批记录表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_approval_log`
--
LOCK TABLES `ams_approval_log` WRITE;
/*!40000 ALTER TABLE `ams_approval_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_approval_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_activity`
--
DROP TABLE IF EXISTS `ams_activity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_activity` (
`activity_id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动ID',
`title` varchar(100) NOT NULL COMMENT '活动标题',
`description` text COMMENT '活动描述',
`location` varchar(255) DEFAULT NULL COMMENT '活动地点',
`start_time` datetime NOT NULL COMMENT '开始时间',
`end_time` datetime NOT NULL COMMENT '结束时间',
`club_id` bigint DEFAULT NULL COMMENT '所属社团ID',
`created_by` bigint DEFAULT NULL COMMENT '创建人用户ID',
`status` varchar(20) DEFAULT 'pending' COMMENT '审批状态pending/rejected/approved',
`level` varchar(20) DEFAULT NULL COMMENT '活动级别internal/department/college',
`approval_step` int DEFAULT '0' COMMENT '当前审批阶段0=待社团审批1=院级2=校级3=通过)',
`is_deleted` tinyint DEFAULT '0' COMMENT '是否逻辑删除',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`activity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动信息表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_activity`
--
LOCK TABLES `ams_activity` WRITE;
/*!40000 ALTER TABLE `ams_activity` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_activity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_registration`
--
DROP TABLE IF EXISTS `ams_registration`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_registration` (
`registration_id` bigint NOT NULL AUTO_INCREMENT COMMENT '报名ID',
`activity_id` bigint NOT NULL COMMENT '活动ID',
`user_id` bigint NOT NULL COMMENT '报名用户ID',
`status` varchar(20) DEFAULT 'registered' COMMENT '状态registered/withdrawn/approved/rejected',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '报名时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`registration_id`),
UNIQUE KEY `uk_activity_user` (`activity_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动报名表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_registration`
--
LOCK TABLES `ams_registration` WRITE;
/*!40000 ALTER TABLE `ams_registration` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_registration` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_reaction`
--
DROP TABLE IF EXISTS `ams_reaction`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_reaction` (
`reaction_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`activity_id` bigint NOT NULL COMMENT '活动ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`type` tinyint NOT NULL COMMENT '类型1=点赞,-1=点踩)',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`reaction_id`),
UNIQUE KEY `uk_user_activity` (`activity_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动点赞/点踩表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_reaction`
--
LOCK TABLES `ams_reaction` WRITE;
/*!40000 ALTER TABLE `ams_reaction` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_reaction` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_club`
--
DROP TABLE IF EXISTS `sms_club`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_club` (
`club_id` bigint NOT NULL AUTO_INCREMENT COMMENT '社团ID',
`club_name` varchar(100) NOT NULL COMMENT '社团名称',
`dept_id` bigint NOT NULL COMMENT '所属院系关联sys_dept',
`category_id` bigint NOT NULL COMMENT '社团类型ID',
`leader_id` bigint DEFAULT NULL COMMENT '负责人用户IDsys_user',
`description` text COMMENT '社团简介',
`logo` varchar(255) DEFAULT '' COMMENT '社团Logo',
`status` char(1) DEFAULT '0' COMMENT '状态0正常 1停用',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`club_id`),
KEY `fk_club_dept` (`dept_id`),
KEY `fk_club_category` (`category_id`),
KEY `fk_club_leader` (`leader_id`),
CONSTRAINT `fk_club_dept` FOREIGN KEY (`dept_id`) REFERENCES `sys_dept` (`dept_id`),
CONSTRAINT `fk_club_leader` FOREIGN KEY (`leader_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社团表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_club`
--
LOCK TABLES `sms_club` WRITE;
/*!40000 ALTER TABLE `sms_club` DISABLE KEYS */;
INSERT INTO `sms_club` VALUES (3,'学生会',200,1,1,'111','/profile/upload/2025/05/06/b_1cdbf07b1138c7636b5e9ad7380e8f76_20250506111008A001.jpg','0','2025-05-06 11:07:12'),(4,'学生会',201,1,NULL,NULL,'','0','2025-05-06 12:20:56'),(5,'篮球社',202,4,NULL,NULL,'','0','2025-05-06 12:21:09');
/*!40000 ALTER TABLE `sms_club` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_club_student`
--
DROP TABLE IF EXISTS `sms_club_student`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_club_student` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`club_id` bigint NOT NULL COMMENT '社团ID',
`user_id` bigint NOT NULL COMMENT '学生ID',
`join_date` date DEFAULT NULL COMMENT '加入日期',
`role` varchar(50) DEFAULT NULL COMMENT '在社团中的角色',
`status` varchar(20) DEFAULT 'active' COMMENT '状态active, inactive',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uq_club_student` (`club_id`,`user_id`),
KEY `idx_student_id` (`user_id`),
KEY `idx_club_id` (`club_id`),
CONSTRAINT `sms_club_student_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `sms_club` (`club_id`),
CONSTRAINT `sms_club_student_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社团与学生关系表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_club_student`
--
LOCK TABLES `sms_club_student` WRITE;
/*!40000 ALTER TABLE `sms_club_student` DISABLE KEYS */;
INSERT INTO `sms_club_student` VALUES (2,3,103,'2025-05-13','chairman','0','2025-05-06 14:49:01','2025-05-06 15:04:50');
/*!40000 ALTER TABLE `sms_club_student` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_student`
--
DROP TABLE IF EXISTS `sms_student`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_student` (
`student_id` bigint NOT NULL AUTO_INCREMENT COMMENT '学生ID',
`user_id` bigint NOT NULL COMMENT '关联的系统用户ID',
`student_number` varchar(12) NOT NULL COMMENT '学号',
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
PRIMARY KEY (`student_id`),
UNIQUE KEY `user_id` (`user_id`),
UNIQUE KEY `student_number` (`student_number`),
CONSTRAINT `sms_student_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生用户表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_student`
--
LOCK TABLES `sms_student` WRITE;
/*!40000 ALTER TABLE `sms_student` DISABLE KEYS */;
INSERT INTO `sms_student` VALUES (1,103,'202111111111','网络212');
/*!40000 ALTER TABLE `sms_student` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-05-06 16:04:19