Files
SharedClassManager/sql/upgrades/v2.1.sql
canglan 124d7f645e feat: 多班级版班级管理系统 v2.0
技术栈:Go (Gin + GORM) + PHP + MySQL 5.7 + Redis

主要功能:
- 多班级完全隔离(class_id 贯穿全系统)
- 后端从 Python FastAPI 重写为 Go Gin(端口 56789)
- 超级管理员独立登录(env 配置路径,默认账密 admin/Admin123)
- 科任老师/课代表新角色
- 课代表作业管理页面
- 排行榜分项排行(操行分/考勤/作业)
- 角色加减分上下限由班主任配置
- 家长改密功能(可开关)
- 班级角色按需开关
- 宿舍号格式:南0-000
- 周度/月度重置功能
- MySQL 5.7 兼容
- Nginx 反向代理部署

开发者: Canglan
版权归属: Sea Network Technology Studio
许可证: Apache License 2.0
2026-06-22 10:21:52 +08:00

54 lines
1.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ===========================================
-- 多班级版班级管理系统 - v2.1 升级脚本
-- 修复 review-report-v14 中发现的安全和逻辑问题
--
-- 开发者: Canglan
-- 联系方式: admin@sea-studio.top
-- 版权归属: Sea Network Technology Studio
-- 许可证: Apache License 2.0
--
-- 版权所有 © Sea Network Technology Studio
--
-- 升级说明:
-- 1. 为 super_admins 表添加 need_change_password 字段
-- 2. 为 existing 超级管理员设置默认值(首次登录强制改密)
-- ===========================================
USE `classmanagerdb`;
-- 为 super_admins 表添加 need_change_password 字段
-- 已存在则跳过(使用存储过程检测)
DROP PROCEDURE IF EXISTS `add_column_if_not_exists`;
DELIMITER //
CREATE PROCEDURE `add_column_if_not_exists`(
IN p_table VARCHAR(64),
IN p_column VARCHAR(64),
IN p_definition VARCHAR(512)
)
BEGIN
DECLARE col_count INT DEFAULT 0;
SELECT COUNT(*) INTO col_count
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = p_table
AND column_name = p_column;
IF col_count = 0 THEN
SET @sql = CONCAT('ALTER TABLE `', p_table, '` ADD COLUMN `', p_column, '` ', p_definition);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END //
DELIMITER ;
CALL `add_column_if_not_exists`('super_admins', 'need_change_password', 'TINYINT DEFAULT 1 COMMENT \'1=0=\' AFTER `status`');
DROP PROCEDURE IF EXISTS `add_column_if_not_exists`;
-- 更新系统版本号
INSERT INTO `system_settings` (`setting_key`, `setting_value`)
VALUES ('db_version', '2.1')
ON DUPLICATE KEY UPDATE `setting_value` = '2.1';
SELECT '升级完成!版本: v2.1' AS message;