<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.system.mapper.StudentInfoMapper">

    <resultMap type="org.dromara.system.domain.vo.StudentInfoVo" id="StudentInfoResult">
        <result property="id"    column="id"    />
        <result property="studentId"    column="student_id"    />
        <result property="name"    column="name"    />
        <result property="sex"    column="sex"    />
        <result property="age"    column="age"    />
        <result property="school"    column="school"    />
        <result property="studentNumber"    column="student_number"    />
        <result property="idCard"    column="id_card"    />
        <result property="height"    column="height"    />
        <result property="weight"    column="weight"    />
        <result property="bloodType"    column="blood_type"    />
        <result property="politicalStatus"    column="political_status"    />
        <result property="identificationPhoto"    column="identification_photo"    />
        <result property="entrancePermit"    column="entrance_permit"    />
        <result property="fatherName"    column="father_name"    />
        <result property="fatherTelephone"    column="father_telephone"    />
        <result property="motherName"    column="mother_name"    />
        <result property="motherTelephone"    column="mother_telephone"    />
        <result property="address"    column="address"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />

        <result property="isNearsightedness"    column="is_nearsightedness"    />
        <result property="degreeMyopia"    column="degree_myopia"    />
        <result property="health"    column="health"    />
        <result property="mind"    column="mind"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />

        <result property="isMedicalHistory"    column="is_medical_history"    />
        <result property="medicalDescription"    column="medical_description"    />
        <result property="psychologicalDescription"    column="psychological_description"    />


        <result property="isLset"    column="is_lset"    />
        <result property="isPoverty"    column="is_poverty"    />

        <result property="emergencyContact"    column="emergency_contact"    />
        <result property="emergencyContactTelephone"    column="emergency_contact_telephone"    />

        <result property="familyName"    column="family_name"    />
        <result property="isFarsightedness"    column="is_farsightedness"    />
        <result property="farsightedness"    column="farsightedness"    />


       <!-- <result property="classId"    column="classId"    />
        <result property="parentsId"    column="parentsId"    />-->

    </resultMap>

    <sql id="selectStudentInfoVo">
        select id, student_id, name, sex, age, school, student_number, id_card, height, weight, blood_type, political_status, identification_photo,
               entrance_permit, father_name, father_telephone, mother_name, mother_telephone, address, create_by, create_time, update_by, update_time,
               remark,is_nearsightedness,degree_myopia,health,mind,longitude,latitude,is_medical_history,medical_description,psychological_description,
               is_lset,is_poverty,emergency_contact,emergency_contact_telephone,family_name,is_farsightedness,farsightedness from student_info
    </sql>

    <select id="selectStudentInfoPage" resultMap="StudentInfoResult">
        select s.id, s.student_id, s.name, s.sex, s.age, s.school, s.student_number, s.id_card, s.height, s.weight, s.blood_type, s.political_status, s.identification_photo,
               s.entrance_permit, s.father_name, s.father_telephone, s.mother_name, s.mother_telephone, s.address, s.create_by, s.create_time, s.update_by, s.update_time, s.remark,
               s.is_nearsightedness,s.degree_myopia,s.health,mind,s.longitude,s.latitude,s.is_medical_history,s.medical_description,s.psychological_description, s.is_lset,s.is_poverty,
               s.emergency_contact,s.emergency_contact_telephone,s.family_name,s.is_farsightedness,s.farsightedness
        from student_info s
        left join formal_parents_student f on s.student_id = f.id
        ${ew.getCustomSqlSegment}
    </select>
    <select id="selectStudentInfoByStudentId" resultMap="StudentInfoResult">
        <include refid="selectStudentInfoVo"/>
        where student_id = #{studentId}
    </select>
    <select id="selectStudentInfo" resultMap="StudentInfoResult">
        select s.id, s.student_id, s.name, s.sex, s.age, s.school, s.student_number, s.id_card, s.height, s.weight, s.blood_type, s.political_status, s.identification_photo,
               s.entrance_permit, s.father_name, s.father_telephone, s.mother_name, s.mother_telephone, s.address, s.create_by, s.create_time, s.update_by, s.update_time, s.remark,
               s.is_nearsightedness,s.degree_myopia,s.health,mind,s.longitude,s.latitude,s.is_medical_history,s.medical_description,s.psychological_description, s.is_lset,s.is_poverty,
               s.emergency_contact,s.emergency_contact_telephone,s.family_name,s.is_farsightedness,s.farsightedness
        from student_info s
        left join formal_parents_student f on s.student_id = f.id
        ${ew.getCustomSqlSegment}
    </select>


</mapper>
