CRelationshipStudentSgcMapper.xml 2.8 KB
<?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="com.example.client.mapper.CRelationshipStudentSgcMapper">

    <resultMap type="com.example.client.domain.CRelationshipStudentSgc" id="CRelationshipStudentSgcResult">
        <result property="id" column="id"/>
        <result property="gerdeId" column="gerde_id"/>
        <result property="userId" column="user_id"/>
        <result property="creatorTime" column="creator_time"/>
        <result property="startDate" column="start_date"/>
        <result property="endDate" column="end_date"/>
        <result property="gardeType" column="garde_type"/>
    </resultMap>

    <resultMap type="com.example.client.domain.vo.MySchoolVo" id="MySchoolVoResult">
        <result property="id" column="id"/>
        <result property="schoolName" column="school_name"/>
        <result property="startDate" column="start_date"/>
        <result property="endDate" column="end_date"/>
        <result property="gardeType" column="garde_type"/>
    </resultMap>

    <select id="getSchool"  resultMap="MySchoolVoResult">
        SELECT
            c_relationship_student_sgc.id,
            c_relationship_student_sgc.start_date,
            c_relationship_student_sgc.end_date,
            c_relationship_student_sgc.garde_type,
            c_register_school.school_name
        FROM
            c_relationship_student_sgc
                LEFT JOIN c_register_school ON c_register_school.school_id = c_relationship_student_sgc.school_id
        WHERE
            c_relationship_student_sgc.user_id = #{uid}
          AND c_relationship_student_sgc.audit = 3
          AND c_register_school.school_type = #{type}
        ORDER BY
            create_time DESC;
    </select>

    <select id="getTraining"  resultMap="MySchoolVoResult">
        SELECT
            c_relationship_student_sgc.id,
            c_relationship_student_sgc.start_date,
            c_relationship_student_sgc.end_date,
            c_relationship_student_sgc.garde_type,
            c_register_school.school_name
        FROM
            c_relationship_student_sgc
                LEFT JOIN c_register_school ON c_register_school.school_id = c_relationship_student_sgc.school_id
        WHERE
            c_relationship_student_sgc.user_id = #{uid}
          AND c_relationship_student_sgc.audit = 3
          AND c_register_school.school_type = 2
        ORDER BY
            create_time DESC;
    </select>

    <select id="getMyCassl" resultType="com.example.client.domain.vo.MyTeacherVO" parameterType="long">

        SELECT  r.gerde_id, s.school_name FROM  c_relationship_student_sgc r
        LEFT JOIN  c_register_school s on s.school_id =r.school_id

        WHERE r.user_id = #{userId}

    </select>

</mapper>