CRegisterSchoolMapper.xml
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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 s.school_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>