Blame view

resources/mybatis1/sunvote/HeadmasterMapper.xml 4.5 KB
be2f84a1   孙向锦   添加课后作业基础模块数据
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <?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="HeadmasterMapper">
  	
  	<!--表名 -->
  	<sql id="tableName">
  		SV_HEADMASTER
  	</sql>
  	
  	<!-- 字段 -->
  	<sql id="Field">
  		NAME,	
  		USERNAME,	
  		PASSWORD,	
  		SCHOOL_ID,	
  		PERMISSION,	
  		PHONE,	
48d44272   孙向锦   添加一些action
18
  		KEYPAD_ID,	
be2f84a1   孙向锦   添加课后作业基础模块数据
19
20
21
22
23
24
25
26
27
28
29
  		HEADMASTER_ID
  	</sql>
  	
  	<!-- 字段值 -->
  	<sql id="FieldValue">
  		#{NAME},	
  		#{USERNAME},	
  		#{PASSWORD},	
  		#{SCHOOL_ID},	
  		#{PERMISSION},	
  		#{PHONE},	
48d44272   孙向锦   添加一些action
30
  		#{KEYPAD_ID},	
be2f84a1   孙向锦   添加课后作业基础模块数据
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
  		#{HEADMASTER_ID}
  	</sql>
  	
  	<!-- 新增-->
  	<insert id="save" parameterType="pd">
  		insert into 
  	<include refid="tableName"></include>
  		(
  	<include refid="Field"></include>
  		) values (
  	<include refid="FieldValue"></include>
  		)
  	</insert>
  	
  	<!-- 删除-->
  	<delete id="delete" parameterType="pd">
  		delete from
  		<include refid="tableName"></include>
  		where 
  			HEADMASTER_ID = #{HEADMASTER_ID}
  	</delete>
  	
  	<!-- 修改 -->
  	<update id="edit" parameterType="pd">
  		update
  		<include refid="tableName"></include>
  		set 
  			NAME = #{NAME},
  			USERNAME = #{USERNAME},
  			PASSWORD = #{PASSWORD},
  			SCHOOL_ID = #{SCHOOL_ID},
  			PERMISSION = #{PERMISSION},
  			PHONE = #{PHONE},
48d44272   孙向锦   添加一些action
64
  			KEYPAD_ID = #{KEYPAD_ID},
be2f84a1   孙向锦   添加课后作业基础模块数据
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  		HEADMASTER_ID = HEADMASTER_ID
  		where 
  		HEADMASTER_ID = #{HEADMASTER_ID}
  	</update>
  	
  	<!-- 通过ID获取数据 -->
  	<select id="findById" parameterType="pd" resultType="pd">
  		select 
  		<include refid="Field"></include>
  		from 
  		<include refid="tableName"></include>
  		where 
  			HEADMASTER_ID = #{HEADMASTER_ID}
  	</select>
  	
48d44272   孙向锦   添加一些action
80
  	<!-- 通过ID获取数据 -->
68056c63   孙向锦   添加学生人数
81
82
83
84
85
86
87
88
89
90
  	<select id="findClassByHeaderId" parameterType="pd" resultType="pd">
  		select 
  		 *
  		from 
  		 sv_sclass
  		where 
  			HEADMASTER_ID = #{HEADMASTER_ID}
  	</select>
  	
  	<!-- 通过ID获取数据 -->
48d44272   孙向锦   添加一些action
91
92
93
94
95
96
  	<select id="findByUsenameAndPassword" parameterType="pd" resultType="pd">
  		select 
  		<include refid="Field"></include>
  		from 
  		<include refid="tableName"></include>
  		where 
a479f295   孙向锦   添加了报表逻辑
97
  			<if test="KEYPAD_ID != null and KEYPAD_ID != ''">
48d44272   孙向锦   添加一些action
98
99
  				KEYPAD_ID = #{KEYPAD_ID}
  			</if>
a479f295   孙向锦   添加了报表逻辑
100
  			<if test="KEYPAD_ID == null or KEYPAD_ID == ''">
48d44272   孙向锦   添加一些action
101
102
103
104
105
  				USERNAME = #{USERNAME} and
  				PASSWORD = #{PASSWORD}
  			</if>
  	</select>
  	
be2f84a1   孙向锦   添加课后作业基础模块数据
106
107
108
109
110
111
112
  	<!-- 列表 -->
  	<select id="datalistPage" parameterType="page" resultType="pd">
  		select
  		<include refid="Field"></include>
  		from 
  		<include refid="tableName"></include>
  		where 1=1
837ae11d   孙向锦   添加班長管理
113
114
  		<if test="pd.SCHOOL_ID != null and pd.SCHOOL_ID != ''">
  			and SCHOOL_ID = #{pd.SCHOOL_ID}
be2f84a1   孙向锦   添加课后作业基础模块数据
115
116
117
  		</if>
  	</select>
  	
68056c63   孙向锦   添加学生人数
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  	<!-- 列表 -->
  	<select id="dataClasslistPage" parameterType="page" resultType="pd">
  		select
  		NAME,
  		USERNAME,
  		PASSWORD,
  		sv_headmaster.SCHOOL_ID,
  		PERMISSION,
  		PHONE,
  		KEYPAD_ID,
  		sv_headmaster.HEADMASTER_ID,
  		sv_sclass.CLASS_NAME,
  		sv_sclass.ID
  		from 
  		<include refid="tableName"></include>
  		INNER JOIN sv_sclass ON sv_sclass.HEADMASTER_ID = sv_headmaster.HEADMASTER_ID
  		where 1=1
  		<if test="pd.SCHOOL_ID != null and pd.SCHOOL_ID != ''">
  			and sv_headmaster.SCHOOL_ID = #{pd.SCHOOL_ID}
  		</if>
  	</select>
  	
be2f84a1   孙向锦   添加课后作业基础模块数据
140
141
142
143
144
145
  	<!-- 列表(全部) -->
  	<select id="listAll" parameterType="pd" resultType="pd">
  		select
  		<include refid="Field"></include>
  		from 
  		<include refid="tableName"></include>
837ae11d   孙向锦   添加班長管理
146
147
148
149
  		where 1 = 1
  		<if test="SCHOOL_ID != null and SCHOOL_ID != ''">
  			and SCHOOL_ID = #{SCHOOL_ID}
  		</if>
be2f84a1   孙向锦   添加课后作业基础模块数据
150
151
  	</select>
  	
68056c63   孙向锦   添加学生人数
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  	<!-- 列表(全部) -->
  	<select id="listNoHeaderClass" parameterType="pd" resultType="pd">
  		select
  			ID,CLASS_NAME
  		from 
  		 sv_sclass
  		where 1 = 1
  		<if test="SCHOOL_ID != null and SCHOOL_ID != ''">
  			and SCHOOL_ID = #{SCHOOL_ID}
  		</if>
  		and HEADMASTER_ID is NULL
  	</select>
  	
  	<!-- 修改 -->
  	<update id="updateHeaderMaster" parameterType="pd">
  		update
  			sv_sclass
  		set 
  			HEADMASTER_ID = #{HEADMASTER_ID}
  		where 
  		 		ID = #{ID}
  	</update>
  	
76263c7c   孙向锦   添加报表百分比数据
175
176
177
178
179
180
181
182
183
  	<update id="deleteCLassHeaderMaster" parameterType="pd">
  		update
  			sv_sclass
  		set 
  			HEADMASTER_ID = NULL
  		where 
  		 		HEADMASTER_ID = #{HEADMASTER_ID}
  	</update>
  	
68056c63   孙向锦   添加学生人数
184
  	
be2f84a1   孙向锦   添加课后作业基础模块数据
185
186
187
188
189
190
191
192
193
194
195
  	<!-- 批量删除 -->
  	<delete id="deleteAll" parameterType="String">
  		delete from
  		<include refid="tableName"></include>
  		where 
  			HEADMASTER_ID in
  		<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
                   #{item}
  		</foreach>
  	</delete>
  	
76263c7c   孙向锦   添加报表百分比数据
196
197
198
199
200
201
202
203
204
205
206
207
  	<update id="deleteAllCLassHeaderMaster" parameterType="String">
  		update
  			sv_sclass
  		set 
  			HEADMASTER_ID = NULL
  		where 
  		 		HEADMASTER_ID in 
   		<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
                 #{item}
  		</foreach>
  	</update>
  	
be2f84a1   孙向锦   添加课后作业基础模块数据
208
209
  	<!-- fh313596790qq(青苔) -->
  </mapper>