CRegisterSchoolMapper.xml 2.5 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.CRegisterSchoolMapper">

    <resultMap type="com.example.client.domain.CRegisterSchool" id="CRegisterSchoolResult">
        <result property="schoolId" column="school_id"/>
        <result property="userId" column="user_id"/>
        <result property="sysId" column="sys_id"/>
        <result property="schoolName" column="school_name"/>
        <result property="schoolEmail" column="school_email"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="schoolInformation" column="school_information"/>
        <result property="officialAccounts" column="official_accounts"/>
        <result property="schoolType" column="school_type"/>
    </resultMap>


    <select id="getSchool" parameterType="com.example.client.domain.bo.CRelationshipStudentSgcBo" resultType="com.example.client.domain.vo.MySchoolVo">
         SELECT r.start_date,r.end_date,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}

              <if test="gardeType != null">
                  and  r.garde_type = #{gardeType}
              </if>

          </where>
    </select>

    <select id="getSchoolByTeacher" parameterType="com.example.client.domain.bo.CRelationshipStudentSgcBo" resultType="com.example.client.domain.vo.MySchoolVo">
        SELECT s.school_name  FROM c_teacher t
        LEFT JOIN c_grade g on t.grade_id = g.id
        LEFT JOIN c_register_school s on s.school_id = g.school_id
        <where>
            t.user_id = #{userId}

            <if test="gardeType != null">
                and  r.garde_type = #{gardeType}
            </if>

        </where>
    </select>

    <select id="getSchoolByClass" parameterType="com.example.client.domain.bo.CRelationshipStudentSgcBo" resultType="com.example.client.domain.vo.MyClassVO">
        SELECT s.school_name ,g.grade_name  ,g.id FROM c_teacher t
        LEFT JOIN c_grade g on t.grade_id = g.id
        LEFT JOIN c_register_school s on s.school_id = g.school_id
        <where>
            t.user_id = #{userId}
            <if test="gardeType != null">
                and  r.garde_type = #{gardeType}
            </if>
        </where>
    </select>
</mapper>