1. <!--查询id字段的最大值-->
<select id="queryMaxId" resultType="Integer"> select COALESCE (Max(gid),0) as gid from t25175_grade </select></mapper>
2.<!--批量删除-->Boolean deleteMany(String[] str);
<delete id="deleteMany"> delete from t25175_student where studentid in
<foreach collection="array" item="studentid" open="(" separator="," close=")"> #{studentid}
</foreach></delete>
3.<!--多条件框模糊查询-->
<select id="findLike" resultMap="BaseResultMap"> select* from t25175_student
<where> <!--添加if条件如果参数为空则不拼接sql-->
<if test="studentid != null and studentid != '' "> studentid like concat('%',#{studentid},'%')
</if> <if test="gid != null and gid != '' "> and gid like concat('%',#{gid},'%')
</if> <if test="cid != null and cid.size > 0 "> and cid in
<foreach item="cid" index="index" collection="cid"
open="(" separator="," close=" )">#{cid}
</foreach> </if>
</where>order by studentid
</select>
4.<!--根据grade和studenclass查找所有的学生信息-->
<select id="selectAllByStudentclass" resultMap="BaseResultMap"> select* from t25175_student
<where> <foreach item="grade" index="index" collection="grade"
separator="or"> <foreach item="studentclass" index="index" collection="studentclass"
separator="or" > (grade=#{grade} and studentclass=#{studentclass})
</foreach> </foreach> </where></select>
5.<!--根据cid查找所有的学生信息-->
<select id="selectAllByCid" parameterType="java.util.List" resultMap="BaseResultMap"> select* from t25175_student
<where>cid in
<foreach item="cid" index="index" collection="list"
open="(" separator="," close=" )">#{cid}
</foreach></where></select>