-- 家庭信息父母信息和特殊情况字段录入问题排查脚本 -- 问题:新增学生信息时,家庭信息填了,但父母信息和特殊情况没有录入数据库 -- 1. 检查数据库表结构,确认父母信息和特殊情况字段存在 SHOW COLUMNS FROM hzdyjs_xg.xg_student_info WHERE Field LIKE '%father%' OR Field LIKE '%mother%' OR Field LIKE '%is_%'; -- 2. 检查数据库中是否有父母信息数据 SELECT student_no, name, father_name, father_phone, mother_name, mother_phone FROM hzdyjs_xg.xg_student_info WHERE (father_name IS NOT NULL AND father_name != '') OR (mother_name IS NOT NULL AND mother_name != '') LIMIT 10; -- 3. 检查数据库中是否有特殊情况数据 SELECT student_no, name, is_poor_student, is_minority, is_disabled, is_orphan, is_left_behind_child, is_single_child FROM hzdyjs_xg.xg_student_info WHERE is_poor_student = 1 OR is_minority = 1 OR is_disabled = 1 OR is_orphan = 1 OR is_left_behind_child = 1 OR is_single_child = 1 LIMIT 10; -- 4. 检查所有学生的父母信息和特殊情况字段分布 SELECT COUNT(*) as total_students, COUNT(father_name) as has_father_name, COUNT(mother_name) as has_mother_name, COUNT(CASE WHEN father_name IS NOT NULL AND father_name != '' THEN 1 END) as has_valid_father_name, COUNT(CASE WHEN mother_name IS NOT NULL AND mother_name != '' THEN 1 END) as has_valid_mother_name, SUM(is_poor_student) as poor_students, SUM(is_minority) as minority_students, SUM(is_disabled) as disabled_students, SUM(is_orphan) as orphan_students, SUM(is_left_behind_child) as left_behind_students, SUM(is_single_child) as single_child_students FROM hzdyjs_xg.xg_student_info WHERE deleted = 0; -- 5. 检查最近创建的学生记录的父母信息和特殊情况 SELECT id, student_no, name, father_name, father_phone, father_work_unit, mother_name, mother_phone, mother_work_unit, is_poor_student, is_minority, is_disabled, is_orphan, is_left_behind_child, is_single_child, create_time FROM hzdyjs_xg.xg_student_info WHERE deleted = 0 ORDER BY create_time DESC LIMIT 10; -- 6. 检查特定学生的完整家庭信息 SELECT id, student_no, name, -- 父母信息 father_name, father_phone, father_work_unit, mother_name, mother_phone, mother_work_unit, -- 家庭情况 family_income, family_members, -- 特殊情况 is_poor_student, is_minority, is_disabled, is_orphan, is_left_behind_child, is_single_child, -- 紧急联系人 emergency_contact_name, emergency_contact_phone, emergency_contact_relation FROM hzdyjs_xg.xg_student_info WHERE student_no = '2024001' OR student_no = '2024002' OR student_no = '2024003' ORDER BY student_no; -- 问题分析: -- 1. 前端表单字段:fatherName, motherName, isPoorStudent, isMinority 等正确绑定 -- 2. 数据库字段:father_name, mother_name, is_poor_student, is_minority 等存在 -- 3. 实体类映射:@TableField注解正确映射 -- 4. ResultMap映射:正确映射了所有字段 -- 5. selectVoPage查询:缺少大部分父母信息和特殊情况字段 -- -- 结论:问题在于 XgStudentInfoMapper.xml 的 selectVoPage 查询语句中缺少以下字段: -- - father_name, father_phone, father_work_unit -- - mother_name, mother_phone, mother_work_unit -- - is_minority, is_disabled, is_orphan, is_left_behind_child, is_single_child -- -- 只包含了 is_poor_student,其他字段都缺失!