edu/sql/student_tables_final_struct...

98 lines
5.5 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.

drop table if exists `la_student_base_info`;
create table `la_student_base_info` (
`student_base_id` bigint unsigned not null auto_increment comment '学生基本信息主键id',
`student_id` bigint null comment '学生学业信息表主键id',
-- 身份信息
`name` varchar(100) null comment '姓名',
`gender` tinyint unsigned null default '0' comment '性别1-男 0-女',
`id_card` varchar(20) null default '' comment '身份证号',
`birthday` date null comment '出生日期',
`nationality` varchar(50) null default '汉族' comment '民族',
`political_status` tinyint unsigned null default '0' comment '政治面貌0-群众 1-团员 2-党员 3-其他',
-- 联系信息
`phone` varchar(20) null default '' comment '手机号码',
`email` varchar(100) null default '' comment '邮箱',
`emergency_contact` varchar(100) null default '' comment '紧急联系人',
`emergency_phone` varchar(20) null default '' comment '紧急联系电话',
`relationship` varchar(20) null default '' comment '与紧急联系人关系',
`home_address` varchar(200) null default '' comment '家庭住址',
`native_place` varchar(100) null default '' comment '籍贯',
`postal_code` varchar(10) null default '' comment '邮政编码',
-- 教育背景
`previous_school` varchar(200) null default '' comment '毕业学校',
`school_type` tinyint unsigned null default '0' comment '学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他',
`graduation_year` int unsigned null default '0' comment '毕业年份',
`academic_qualification` tinyint unsigned null default '0' comment '学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士',
`major_studied` varchar(100) null default '' comment '原所学专业',
-- 身体信息
`height` decimal(5,2) default null comment '身高cm',
`weight` decimal(5,2) default null comment '体重kg',
`shoe_size` tinyint unsigned default null comment '鞋码',
-- 系统信息
`create_time` datetime not null default CURRENT_TIMESTAMP comment '创建时间',
`update_time` datetime null comment '更新时间',
`delete_time` datetime null comment '删除时间',
primary key (`student_base_id`),
key `idx_name` (`name`) comment '姓名索引',
key `idx_phone` (`phone`) comment '手机号索引'
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='学生基本信息表';
drop table if exists `la_student_info`;
create table `la_student_info` (
`student_id` int unsigned not null auto_increment comment '学生学业信息表主键id',
-- 学校信息
`student_number` varchar(32) character set utf8mb4 collate utf8mb4_0900_ai_ci null comment '学号',
`college_id` int unsigned null comment '学院id',
`major_id` int unsigned null comment '专业id',
`class_id` int unsigned null comment '班级id',
`grade` tinyint unsigned null comment '年级',
`enrollment_year` int unsigned null default '0' comment '入学年份',
`expected_graduation_year` int unsigned null default '0' comment '预计毕业年份',
`student_status` tinyint unsigned null default '2' comment '学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]',
-- 住宿信息
`dormitory` varchar(50) null default '' comment '宿舍号',
-- 辅导员信息
`counselor_id` int unsigned null default '0' comment '辅导员用户id',
-- 学业信息
`total_credits` decimal(5,2) unsigned null default '0.00' comment '总学分',
`gpa` decimal(3,2) unsigned null default '0.00' comment '平均绩点',
`academic_warnings` tinyint unsigned null default '0' comment '学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]',
-- 预报名信息
`high_school_score` decimal(5,2) default null comment '中考成绩',
`pre_registration_amount` decimal(10,2) default null comment '预报名金额',
`recruitment_teacher_id` int unsigned default null comment '招生老师id关联la_teacher表',
`reception_teacher_id` int unsigned default null comment '接待老师id关联la_teacher表',
`pre_registration_time` bigint unsigned null default '0' comment '预报名时间',
`invitation_code` varchar(50) default null comment '邀请码',
-- 认证信息
`is_verified` tinyint unsigned null default '0' comment '是否认证: [0=未认证, 1=已认证]',
`verified_by` int unsigned null default '0' comment '认证人id',
`verified_time` int unsigned null default '0' comment '认证时间',
-- 系统信息
`create_time` datetime not null default CURRENT_TIMESTAMP comment '创建时间',
`update_time` datetime null comment '更新时间',
`delete_time` datetime null comment '删除时间',
primary key (`student_id`) using btree,
key `college_major` (`college_id`,`major_id`) using btree comment '学院专业索引',
key `class_name` (`class_id`) using btree comment '班级索引',
key `enrollment_year` (`enrollment_year`) using btree comment '入学年份索引',
key `idx_recruitment_teacher_info` (`recruitment_teacher_id`) comment '招生老师索引',
key `idx_reception_teacher_info` (`reception_teacher_id`) comment '接待老师索引',
key `idx_pre_registration_time` (`pre_registration_time`) comment '预报名时间索引',
key `idx_invitation_code` (`invitation_code`) comment '邀请码索引'
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='学生学业信息表';