From 905d7d21c53e05855e1e09a8cb4e576565d64df9 Mon Sep 17 00:00:00 2001 From: bruce Date: Wed, 19 Feb 2025 17:26:05 +0800 Subject: [PATCH] =?UTF-8?q?v0.2.0=20=E9=87=8D=E6=9E=84=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - readme.md | 142 ++++++ ...AMS_localhost-2025_02_19_17_25_12-dump.sql | 462 ++++++++++++++++++ 3 files changed, 604 insertions(+), 1 deletion(-) create mode 100644 readme.md create mode 100644 sql/SAMS_localhost-2025_02_19_17_25_12-dump.sql diff --git a/.gitignore b/.gitignore index a83d8137..7ed0d6b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -readme.md target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ diff --git a/readme.md b/readme.md new file mode 100644 index 00000000..83583548 --- /dev/null +++ b/readme.md @@ -0,0 +1,142 @@ +# 校园社团活动管理系统 + +[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.4.2-green)](https://spring.io/) +[![Vue.js](https://img.shields.io/badge/Vue.js-3.2.0-brightgreen)](https://vuejs.org/) +[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE) + +> 基于SpringBoot + Vue的校园社团活动全流程管理平台 +> 毕业设计项目 | 山东建筑大学 | 2025届 + +--- + +## 项目简介 +本系统旨在解决传统校园社团活动管理的痛点,提供数字化全流程解决方案: +- **角色分层管理**:支持管理员、组织者、参与者三级权限体系 +- **活动全生命周期管理**:覆盖活动申请、审核、执行到归档全流程 +- **数据可视化**:实时统计活动参与度与社团活跃度 +- **安全可靠**:采用JWT鉴权+BCrypt加密+操作日志审计 + +[//]: # ([👉 **在线演示**](https://demo.club-manager.com) | [📚 需求文档](/docs/需求分析说明书1.4.docx)) + +--- + +## 功能特性 + +### 🎯 核心功能 +| 模块 | 功能描述 | +|--------------|--------------------------------------------------------------------------| +| **社团管理** | 社团信息维护/成员审核/权限分级/数据统计 | +| **活动管理** | 在线申请-审核-发布全流程/扫码签到/评论互动/实时通知推送 | +| **用户中心** | 多角色视图切换/我的活动追踪/消息通知中心 | + +### 🚀 特色功能 +- **智能推荐**:基于用户兴趣的活动推送 +- **扫码签到**:动态二维码防作弊机制 +- **数据看板**:社团活跃度排行榜 + +--- + +## 技术栈 + +### 前端技术 +| 技术 | 说明 | 版本 | +|------------------|--------------------------------|--------| +| Vue.js | 渐进式JavaScript框架 | 3.2.0 | +| Element-Plus | UI组件库 | 2.2.0 | +| Axios | HTTP客户端 | 1.1.3 | +| ECharts | 数据可视化 | 5.4.0 | + +### 后端技术 +| 技术 | 说明 | 版本 | +|------------------|--------------------------------|--------| +| Spring Boot | Java开发框架 | 2.7.0 | +| MyBatis-Plus | ORM框架 | 3.5.2 | +| JWT | 身份认证 | 0.11.2 | +| Redis | 缓存管理 | 6.2.6 | +| Swagger | API文档生成 | 3.0.0 | + +### 基础设施 +| 组件 | 用途 | +|--------------|--------------------------------| +| MySQL 8.0 | 主数据库 | +| Nginx | 反向代理/负载均衡 | +| Docker | 容器化部署 | + +--- + +## 快速开始 + +### 环境要求 +- JDK 17+ +- Node.js 16.x +- MySQL 8.0+ +- Redis 6.x + +### 本地部署 + +[//]: # ( todo 完善本地部署方法) + +**初始化数据库** + 执行 [/sql/init.sql](/sql/init.sql) 脚本 + +--- + +## 项目结构 +```text +campus-club-system/ +├── server/ # 后端服务 +│ ├── src/ +│ │ ├── main/ +│ │ │ ├── java/com/bruce/sams/ +│ │ │ │ ├── controller # API接口层 +│ │ │ │ ├── service # 业务逻辑层 +│ │ │ │ ├── mapper # 数据访问层 +│ │ │ │ └── config # 安全/缓存配置 +│ │ │ └── resources/ # 配置文件 +│ └── pom.xml +│ +├── client/ # 前端应用 +│ ├── src/ +│ │ ├── api/ # 接口封装 +│ │ ├── router/ # 路由配置 +│ │ ├── views/ # 页面组件 +│ │ └── store/ # 状态管理 +│ └── package.json +│ +├── docs/ # 文档资料 +│ ├── 需求分析说明书.docx +│ └── 数据库设计.md +│ +└── sql/ # 数据库脚本 + ├── init.sql # 初始化脚本 + └── sample_data.sql # 测试数据 +``` + +--- + +## 数据库设计 + +[//]: # (![ER Diagram](/docs/er-diagram.png)) + +关键数据表说明: +- **用户表(user)**:存储用户基础信息与角色权限 +- **活动表(activity)**:记录活动全生命周期状态 +- **报名表(signup_record)**:管理用户报名与签到信息 +- **操作日志(admin_log)**:审计所有管理操作 + +[//]: # ([🔍 查看完整数据库设计](/docs/数据库设计.md)) + +--- + +## 贡献指南 +欢迎通过Issue或PR参与改进! +1. Fork本仓库 +2. 创建特性分支 (`git checkout -b feature/your-feature`) +3. 提交修改 (`git commit -m 'Add some feature'`) +4. 推送到分支 (`git push origin feature/your-feature`) +5. 创建Pull Request + +--- + +## 许可证 +[MIT License](LICENSE) © 2025 孙之烨 | 山东建筑大学 diff --git a/sql/SAMS_localhost-2025_02_19_17_25_12-dump.sql b/sql/SAMS_localhost-2025_02_19_17_25_12-dump.sql new file mode 100644 index 00000000..9bf40a19 --- /dev/null +++ b/sql/SAMS_localhost-2025_02_19_17_25_12-dump.sql @@ -0,0 +1,462 @@ +-- MySQL dump 10.13 Distrib 8.0.41, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: SAMS +-- ------------------------------------------------------ +-- 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_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` ( + `act_id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动ID', + `title` varchar(100) NOT NULL COMMENT '活动标题', + `description` text COMMENT '活动描述', + `start_time` datetime NOT NULL COMMENT '开始时间', + `end_time` datetime NOT NULL COMMENT '结束时间', + `location` varchar(255) DEFAULT NULL COMMENT '地点', + `budget` decimal(10,2) DEFAULT '0.00' COMMENT '预算', + `max_participants` int DEFAULT NULL COMMENT '最大参与人数', + `creator_id` bigint NOT NULL COMMENT '创建者ID', + `college_id` bigint DEFAULT NULL COMMENT '所属院系ID', + `club_id` bigint DEFAULT NULL COMMENT '所属社团ID', + `visibility` enum('public','private') DEFAULT 'public' COMMENT '是否公开', + `status` enum('draft','pending_approval','approved','ongoing','completed','cancelled') DEFAULT 'draft' COMMENT '活动状态', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + PRIMARY KEY (`act_id`), + KEY `creator_id` (`creator_id`), + KEY `club_id` (`club_id`), + KEY `ams_activity_ibfk_3` (`college_id`), + CONSTRAINT `ams_activity_ibfk_1` FOREIGN KEY (`creator_id`) REFERENCES `sys_user` (`user_id`), + CONSTRAINT `ams_activity_ibfk_2` FOREIGN KEY (`club_id`) REFERENCES `sms_club` (`club_id`), + CONSTRAINT `ams_activity_ibfk_3` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`) ON DELETE SET NULL +) 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_approval` +-- + +DROP TABLE IF EXISTS `ams_approval`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `ams_approval` ( + `appr_id` bigint NOT NULL AUTO_INCREMENT COMMENT '审批ID', + `act_id` bigint NOT NULL COMMENT '活动ID', + `user_id` bigint NOT NULL COMMENT '发起者ID', + `approver_id` bigint NOT NULL COMMENT '审批人ID', + `status` tinyint(1) DEFAULT '0' COMMENT '审批状态 (0: 待审批, 1: 通过, 2: 拒绝)', + `reason` text COMMENT '拒绝原因(如果适用)', + `approved_at` datetime DEFAULT NULL COMMENT '审批时间', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`appr_id`), + KEY `act_id` (`act_id`), + KEY `user_id` (`user_id`), + KEY `approver_id` (`approver_id`), + CONSTRAINT `ams_approval_ibfk_1` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`), + CONSTRAINT `ams_approval_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`), + CONSTRAINT `ams_approval_ibfk_3` FOREIGN KEY (`approver_id`) REFERENCES `sys_user` (`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_approval` +-- + +LOCK TABLES `ams_approval` WRITE; +/*!40000 ALTER TABLE `ams_approval` DISABLE KEYS */; +/*!40000 ALTER TABLE `ams_approval` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- 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', + `user_id` bigint NOT NULL COMMENT '用户ID', + `act_id` bigint NOT NULL COMMENT '活动ID', + `parent_comment_id` bigint DEFAULT NULL COMMENT '父评论ID(为空表示是顶级评论)', + `content` text NOT NULL COMMENT '评论内容', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '评论时间', + PRIMARY KEY (`comment_id`), + KEY `user_id` (`user_id`), + KEY `act_id` (`act_id`), + KEY `ams_comment_ibfk_3` (`parent_comment_id`), + CONSTRAINT `ams_comment_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE, + CONSTRAINT `ams_comment_ibfk_2` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`) ON DELETE CASCADE, + CONSTRAINT `ams_comment_ibfk_3` FOREIGN KEY (`parent_comment_id`) REFERENCES `ams_comment` (`comment_id`) ON DELETE CASCADE +) 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_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', + `user_id` bigint NOT NULL COMMENT '用户ID', + `act_id` bigint NOT NULL COMMENT '活动ID', + `reaction_type` enum('like','dislike') NOT NULL COMMENT '反应类型(like: 点赞, dislike: 点踩)', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '反应时间', + PRIMARY KEY (`reaction_id`), + UNIQUE KEY `uniq_user_activity_reaction` (`user_id`,`act_id`), + KEY `act_id` (`act_id`), + CONSTRAINT `ams_reaction_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE, + CONSTRAINT `ams_reaction_ibfk_2` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`) ON DELETE CASCADE +) 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 `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` ( + `reg_id` bigint NOT NULL AUTO_INCREMENT COMMENT '报名ID', + `act_id` bigint NOT NULL COMMENT '活动ID', + `user_id` bigint NOT NULL COMMENT '用户ID', + `role` enum('organizer','participant') DEFAULT 'participant' COMMENT '角色(organizer: 组织者, participant: 参与者)', + `status` enum('registered','cancelled','attended','absent') DEFAULT 'registered' COMMENT '报名状态', + `register_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '报名时间', + `attend_time` datetime DEFAULT NULL COMMENT '参与时间', + PRIMARY KEY (`reg_id`), + KEY `act_id` (`act_id`), + KEY `user_id` (`user_id`), + CONSTRAINT `ams_registration_ibfk_1` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`), + CONSTRAINT `ams_registration_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`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 `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(50) NOT NULL COMMENT '社团名称', + `description` text COMMENT '社团简介', + `category` enum('文化艺术','学术科技','社会公益','其他') NOT NULL COMMENT '社团类型', + `college_id` bigint NOT NULL COMMENT '所属院系', + `leader_id` bigint DEFAULT NULL COMMENT '负责人ID', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`club_id`), + KEY `college_id` (`college_id`), + KEY `leader_id` (`leader_id`), + CONSTRAINT `sms_club_ibfk_1` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`), + CONSTRAINT `sms_club_ibfk_2` FOREIGN KEY (`leader_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` +-- + +LOCK TABLES `sms_club` WRITE; +/*!40000 ALTER TABLE `sms_club` DISABLE KEYS */; +INSERT INTO `sms_club` VALUES (1,'编程爱好者协会','学习编程、算法与开发','学术科技',2,2,'2025-02-13 11:43:50'),(2,'篮球社','喜欢打篮球的同学们','其他',3,3,'2025-02-13 11:43:50'); +/*!40000 ALTER TABLE `sms_club` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sms_college` +-- + +DROP TABLE IF EXISTS `sms_college`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sms_college` ( + `college_id` bigint NOT NULL AUTO_INCREMENT COMMENT '院系ID', + `college_name` varchar(255) NOT NULL COMMENT '名称(高校或院系)', + `parent_id` bigint DEFAULT NULL COMMENT '父院系ID(高校此值为空)', + `email` varchar(50) DEFAULT '' COMMENT '邮箱', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`college_id`), + KEY `parent_id` (`parent_id`), + CONSTRAINT `sms_college_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `sms_college` (`college_id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='高校及院系表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sms_college` +-- + +LOCK TABLES `sms_college` WRITE; +/*!40000 ALTER TABLE `sms_college` DISABLE KEYS */; +INSERT INTO `sms_college` VALUES (1,'山东建筑大学',NULL,'contact@sdu.edu.cn','2025-02-13 11:40:45'),(2,'计算机科学与技术学院',1,'cs@sdu.edu.cn','2025-02-13 11:40:45'),(3,'土木工程学院',1,'civil@sdu.edu.cn','2025-02-13 11:40:45'),(4,'管理工程学院',1,'contact4@sdu.edu.cn','2025-02-13 11:51:12'),(5,'热能工程学院',1,'contact5@sdu.edu.cn','2025-02-13 11:51:12'),(6,'市政与环境工程学院',1,'contact6@sdu.edu.cn','2025-02-13 11:51:12'),(7,'机电工程学院',1,'contact7@sdu.edu.cn','2025-02-13 11:51:12'),(8,'理学院',1,'contact8@sdu.edu.cn','2025-02-13 11:51:12'),(9,'商学院',1,'contact9@sdu.edu.cn','2025-02-13 11:51:12'),(10,'交通工程学院',1,'contact10@sdu.edu.cn','2025-02-13 11:51:12'),(11,'艺术学院',1,'contact11@sdu.edu.cn','2025-02-13 11:51:12'),(12,'法学院',1,'contact12@sdu.edu.cn','2025-02-13 11:51:12'),(13,'外国语学院',1,'contact13@sdu.edu.cn','2025-02-13 11:51:12'),(20,'山东大学',NULL,'contact@su.edu.cn','2025-02-13 11:52:27'),(21,'计算机科学与技术学院',2,'cs@sdu.edu.cn','2025-02-13 11:52:48'),(22,'土木工程学院',2,'civil@sdu.edu.cn','2025-02-13 11:52:48'),(23,'管理工程学院',2,'contact4@sdu.edu.cn','2025-02-13 11:52:48'),(24,'热能工程学院',2,'contact5@sdu.edu.cn','2025-02-13 11:52:48'),(25,'市政与环境工程学院',2,'contact6@sdu.edu.cn','2025-02-13 11:52:48'),(26,'机电工程学院',2,'contact7@sdu.edu.cn','2025-02-13 11:52:48'),(27,'理学院',2,'contact8@sdu.edu.cn','2025-02-13 11:52:48'),(28,'商学院',2,'contact9@sdu.edu.cn','2025-02-13 11:52:48'),(29,'交通工程学院',2,'contact10@sdu.edu.cn','2025-02-13 11:52:48'),(30,'艺术学院',2,'contact11@sdu.edu.cn','2025-02-13 11:52:48'),(31,'法学院',2,'contact12@sdu.edu.cn','2025-02-13 11:52:48'),(32,'外国语学院',2,'contact13@sdu.edu.cn','2025-02-13 11:52:48'); +/*!40000 ALTER TABLE `sms_college` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sms_college_leader` +-- + +DROP TABLE IF EXISTS `sms_college_leader`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sms_college_leader` ( + `college_id` bigint NOT NULL COMMENT '院系ID', + `user_id` bigint NOT NULL COMMENT '负责人ID', + `assigned_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '指派时间', + PRIMARY KEY (`college_id`,`user_id`), + KEY `user_id` (`user_id`), + CONSTRAINT `sms_college_leader_ibfk_1` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`) ON DELETE CASCADE, + CONSTRAINT `sms_college_leader_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='院系负责人表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sms_college_leader` +-- + +LOCK TABLES `sms_college_leader` WRITE; +/*!40000 ALTER TABLE `sms_college_leader` DISABLE KEYS */; +/*!40000 ALTER TABLE `sms_college_leader` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sms_user_club` +-- + +DROP TABLE IF EXISTS `sms_user_club`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sms_user_club` ( + `suc_id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', + `user_id` bigint NOT NULL COMMENT '用户ID', + `club_id` bigint NOT NULL COMMENT '社团ID', + `role_id` bigint NOT NULL COMMENT '角色ID', + `is_active` tinyint(1) DEFAULT '1' COMMENT '是否活跃', + `join_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '加入日期', + PRIMARY KEY (`suc_id`), + UNIQUE KEY `uniq_user_club` (`user_id`,`club_id`), + KEY `club_id` (`club_id`), + KEY `role_id` (`role_id`), + CONSTRAINT `sms_user_club_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`), + CONSTRAINT `sms_user_club_ibfk_2` FOREIGN KEY (`club_id`) REFERENCES `sms_club` (`club_id`), + CONSTRAINT `sms_user_club_ibfk_3` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`role_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户社团关系表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sms_user_club` +-- + +LOCK TABLES `sms_user_club` WRITE; +/*!40000 ALTER TABLE `sms_user_club` DISABLE KEYS */; +/*!40000 ALTER TABLE `sms_user_club` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sys_logs` +-- + +DROP TABLE IF EXISTS `sys_logs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sys_logs` ( + `log_id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志ID', + `user_id` bigint NOT NULL COMMENT '用户ID', + `action` varchar(255) NOT NULL COMMENT '操作类型', + `description` text COMMENT '描述', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', + PRIMARY KEY (`log_id`), + KEY `idx_user_id` (`user_id`), + CONSTRAINT `sys_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`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 `sys_logs` +-- + +LOCK TABLES `sys_logs` WRITE; +/*!40000 ALTER TABLE `sys_logs` DISABLE KEYS */; +/*!40000 ALTER TABLE `sys_logs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sys_notification` +-- + +DROP TABLE IF EXISTS `sys_notification`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sys_notification` ( + `notification_id` bigint NOT NULL AUTO_INCREMENT COMMENT '通知ID', + `title` varchar(255) NOT NULL COMMENT '通知标题', + `content` text NOT NULL COMMENT '通知内容', + `receiver_id` bigint NOT NULL COMMENT '接收者ID', + `is_read` tinyint(1) DEFAULT '0' COMMENT '是否已读', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`notification_id`), + KEY `idx_receiver_id` (`receiver_id`), + CONSTRAINT `sys_notification_ibfk_1` FOREIGN KEY (`receiver_id`) REFERENCES `sys_user` (`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 `sys_notification` +-- + +LOCK TABLES `sys_notification` WRITE; +/*!40000 ALTER TABLE `sys_notification` DISABLE KEYS */; +/*!40000 ALTER TABLE `sys_notification` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sys_role` +-- + +DROP TABLE IF EXISTS `sys_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sys_role` ( + `role_id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', + `role_name` varchar(30) NOT NULL COMMENT '角色名称', + `role_key` varchar(64) NOT NULL COMMENT '角色标识', + `role_desc` varchar(255) DEFAULT NULL COMMENT '角色描述', + `status` enum('active','inactive') DEFAULT 'active' COMMENT '状态', + PRIMARY KEY (`role_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 `sys_role` +-- + +LOCK TABLES `sys_role` WRITE; +/*!40000 ALTER TABLE `sys_role` DISABLE KEYS */; +INSERT INTO `sys_role` VALUES (0,'系统管理员','admin','最高权限,管理所有用户与活动','active'),(1,'参与者','participant','普通用户,可以报名活动、评论、点赞','active'),(2,'校级管理员','college_admin','管理校级活动及院系','active'),(3,'院级管理员','department_admin','管理院系活动','active'),(4,'社团管理员','club_admin','管理社团活动','active'); +/*!40000 ALTER TABLE `sys_role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sys_user` +-- + +DROP TABLE IF EXISTS `sys_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sys_user` ( + `user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `role_id` bigint NOT NULL COMMENT '用户角色', + `nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称', + `user_name` varchar(30) NOT NULL COMMENT '真实姓名', + `password` varchar(100) NOT NULL COMMENT '用户密码', + `school_id` char(12) NOT NULL COMMENT '学号/教职工号', + `college_id` bigint DEFAULT NULL COMMENT '所属院系', + `email` varchar(50) DEFAULT '' COMMENT '用户邮箱', + `avatar` varchar(100) DEFAULT '' COMMENT '头像地址', + `status` enum('active','inactive','banned') DEFAULT 'active' COMMENT '账号状态', + PRIMARY KEY (`user_id`), + KEY `role_id` (`role_id`), + CONSTRAINT `sys_user_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`role_id`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统用户表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sys_user` +-- + +LOCK TABLES `sys_user` WRITE; +/*!40000 ALTER TABLE `sys_user` DISABLE KEYS */; +INSERT INTO `sys_user` VALUES (1,2,'张三','zhangsan','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202511110001',2,'zhangsan@example.com','avatar1.jpg','active'),(2,3,'李四','lisi','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202511110002',2,'lisi@example.com','avatar2.jpg','active'),(3,4,'王五','wangwu','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202511110003',2,'wangwu@example.com','avatar3.jpg','active'),(4,1,'赵六','zhaoliu','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202511110004',3,'zhaoliu@example.com','avatar4.jpg','active'),(6,1,'用户6','user6','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202588456301',4,'user6@example.com','avatar6.jpg','active'),(7,1,'用户7','user7','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202598705123',5,'user7@example.com','avatar7.jpg','active'),(8,1,'用户8','user8','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202556098765',6,'user8@example.com','avatar8.jpg','active'),(9,1,'用户9','user9','$2a$10$e/hB5Ps/op5jkDtMZXyRo.53CKoXUkOLVvCvlqGktaMqKspJo0WGW','202512340987',7,'user9@example.com','avatar9.jpg','active'); +/*!40000 ALTER TABLE `sys_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sys_user_role` +-- + +DROP TABLE IF EXISTS `sys_user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `sys_user_role` ( + `user_id` bigint NOT NULL COMMENT '用户ID', + `role_id` bigint NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`,`role_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户和角色关联表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sys_user_role` +-- + +LOCK TABLES `sys_user_role` WRITE; +/*!40000 ALTER TABLE `sys_user_role` DISABLE KEYS */; +/*!40000 ALTER TABLE `sys_user_role` 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-02-19 17:25:10