pangu-user-platform/sql/pangu_student.sql

48 lines
2.7 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.

-- ============================================================
-- 学生管理模块 - 数据库脚本
-- 作者pangu
-- 创建时间2026-01-31
-- ============================================================
-- ----------------------------
-- 学生表
-- ----------------------------
DROP TABLE IF EXISTS `pg_student`;
CREATE TABLE `pg_student` (
`student_id` bigint NOT NULL AUTO_INCREMENT COMMENT '学生ID',
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
`student_no` varchar(32) DEFAULT NULL COMMENT '学号',
`gender` char(1) DEFAULT '0' COMMENT '性别0未知 1男 2女',
`birthday` date DEFAULT NULL COMMENT '出生年月',
`region_id` bigint NOT NULL COMMENT '所属区域ID',
`region_path` varchar(200) DEFAULT NULL COMMENT '区域路径',
`school_id` bigint NOT NULL COMMENT '所属学校ID',
`school_grade_id` bigint NOT NULL COMMENT '所属学校年级ID',
`school_class_id` bigint NOT NULL COMMENT '所属学校班级ID',
`subject_id` bigint DEFAULT NULL COMMENT '学科ID',
`member_id` bigint NOT NULL COMMENT '归属会员ID',
`status` char(1) DEFAULT '0' COMMENT '状态0正常 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 '更新时间',
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志0存在 1删除',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`student_id`),
UNIQUE KEY `uk_student_no` (`student_no`),
KEY `idx_member_id` (`member_id`),
KEY `idx_school_id` (`school_id`),
KEY `idx_school_class_id` (`school_class_id`),
KEY `idx_student_name` (`student_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生表';
-- ----------------------------
-- 初始化学生示例数据
-- ----------------------------
INSERT INTO pg_student (student_name, student_no, gender, birthday, region_id, region_path, school_id, school_grade_id, school_class_id, member_id, status, create_by, create_time, del_flag) VALUES
('张小明', 'STU20260001', '1', '2015-03-15', 111, '湖北省-武汉市-武昌区', 1, 1, 1, 1, '0', 'admin', NOW(), '0'),
('张小红', 'STU20260002', '2', '2017-06-20', 111, '湖北省-武汉市-武昌区', 1, 1, 2, 1, '0', 'admin', NOW(), '0'),
('李明明', 'STU20260003', '1', '2015-09-10', 111, '湖北省-武汉市-武昌区', 1, 2, 3, 2, '0', 'admin', NOW(), '0'),
('王小丽', 'STU20260004', '2', '2016-12-05', 111, '湖北省-武汉市-武昌区', 1, 2, 4, 2, '0', 'admin', NOW(), '0'),
('刘大壮', 'STU20260005', '1', '2015-08-20', 111, '湖北省-武汉市-武昌区', 1, 1, 1, 1, '0', 'admin', NOW(), '0');