TeacherClassMapper.xml
4.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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.jevon.mapper.TeacherClassMapper" >
<resultMap id="BaseResultMap" type="com.jevon.model.TeacherClass" >
<id column="t_class_id" property="tClassId" jdbcType="INTEGER" />
<result column="teacher_id" property="teacherId" jdbcType="INTEGER" />
<result column="teacher_name" property="teacherName" jdbcType="VARCHAR" />
<result column="school_id" property="schoolId" jdbcType="INTEGER" />
<result column="grade" property="grade" jdbcType="INTEGER" />
<result column="class_id" property="classId" jdbcType="INTEGER" />
<result column="course_name" property="courseName" jdbcType="VARCHAR" />
<result column="times" property="times" jdbcType="INTEGER" />
<result column="join_times" property="joinTimes" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="team" property="team" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
</resultMap>
<insert id="insert" parameterType="com.jevon.model.TeacherClass" >
insert into sz_sch_teacher_class (teacher_id, teacher_name,
school_id, grade, class_id,
course_name, times, join_times,
create_time team,status)
values ( #{teacherId,jdbcType=INTEGER}, #{teacherName,jdbcType=VARCHAR},
#{schoolId,jdbcType=INTEGER}, #{grade,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER},
#{courseName,jdbcType=VARCHAR}, #{times,jdbcType=INTEGER}, #{joinTimes,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},#{team,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertBatch" parameterType="java.util.List" >
insert into sz_sch_teacher_class ( teacher_id, teacher_name,
school_id, grade, class_id,
course_name, times, join_times,
create_time,team,status)
values
<foreach collection="list" item="emp" separator=",">
( #{emp.teacherId,jdbcType=INTEGER}, #{emp.teacherName,jdbcType=VARCHAR},
#{emp.schoolId,jdbcType=INTEGER}, #{emp.grade,jdbcType=INTEGER}, #{emp.classId,jdbcType=INTEGER},
#{emp.courseName,jdbcType=VARCHAR}, #{emp.times,jdbcType=INTEGER}, #{emp.joinTimes,jdbcType=INTEGER},
#{emp.createTime,jdbcType=TIMESTAMP},#{emp.team,jdbcType=VARCHAR}, #{emp.status,jdbcType=INTEGER})
</foreach>
</insert>
<select id="selectHasSchedule" parameterType="com.jevon.model.TeacherClass" resultType="java.lang.Integer">
select count(status) from sz_sch_teacher_class where school_id = #{schoolId} and team = #{team} and status=1
</select>
<update id="updateSchedule" parameterType="java.lang.Integer">
update sz_sch_teacher_class set status = 1 where t_class_id =#{tClassId}
</update>
<update id="recallTeacherClass" parameterType="java.lang.Integer">
update sz_sch_teacher_class set status = 0 where t_class_id =#{tClassId}
</update>
<delete id="deleteBySchoolAndTeam" parameterType="com.jevon.model.TeacherClass">
delete from sz_sch_teacher_class where team =#{team} and school_id = #{schoolId}
</delete>
<select id="selectByTeacherClass" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select * from sz_sch_teacher_class
<where>
<if test="tClassId != null and tClassId != 0">
and t_class_id =#{tClassId}
</if>
<if test="schoolId != null">
and school_id = #{schoolId}
</if>
<if test="team != null">
and team =#{team}
</if>
<if test="courseName != null">
and course_name = #{courseName}
</if>
<if test="teacherName != null">
and teacher_name = #{teacherName}
</if>
<if test="grade != null">
and grade = #{grade}
</if>
<if test="classId != null">
and class_id =#{classId}
</if>
</where>
</select>
<update id="updateByPrimaryKey" parameterType="com.jevon.model.TeacherClass" >
update sz_sch_teacher_class
set teacher_id = #{teacherId,jdbcType=INTEGER},
teacher_name = #{teacherName,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=INTEGER},
grade = #{grade,jdbcType=INTEGER},
class_id = #{classId,jdbcType=INTEGER},
course_name = #{courseName,jdbcType=VARCHAR},
times = #{times,jdbcType=INTEGER},
join_times = #{joinTimes,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where t_class_id = #{tClassId,jdbcType=INTEGER}
</update>
</mapper>