<?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.ym.mec.collectfee.dao.SeminaryDao">
	
	<resultMap type="com.ym.mec.collectfee.entity.Seminary" id="Seminary">
		<result column="school_id_" property="schoolId" />
		<result column="school_name_" property="schoolName" />
		<result column="level_" property="level" />
		<result column="owner_" property="owner" />
		<result column="province_" property="province" />
		<result column="city_" property="city" />
		<result column="longitude_" property="longitude" />
		<result column="latitude_" property="latitude" />
		<result column="address_" property="address" />
		<result column="branch_id_" property="branchId" />
	</resultMap>
	
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="Seminary">
		SELECT * FROM seminary
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.collectfee.entity.Seminary" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO seminary (school_id_,school_name_,level_,owner_,province_,city_,longitude_,latitude_,address_,branch_id_) VALUES(#{schoolId},#{schoolName},#{level},#{owner},#{province},#{city},#{longitude},#{latitude},#{address},#{branchId})
	</insert>

	<insert id="batchInsert" parameterType="java.util.List">
		INSERT INTO seminary (school_id_,school_name_,level_,owner_,province_,city_,longitude_,latitude_,address_,branch_id_) VALUES
		<foreach collection="seminaries" item="item" index="index" separator=",">
			(#{item.schoolId},#{item.schoolName},#{item.level},#{item.owner},#{item.province},#{item.city},#{item.longitude},#{latitude},#{item.address},#{item.branchId})
		</foreach>
	</insert>
	
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="Seminary" parameterType="map">
		SELECT * FROM seminary <include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="findCount" resultType="int">
		SELECT COUNT(*) FROM seminary
	</select>
	<select id="findByBranchId" resultType="com.ym.mec.collectfee.entity.Seminary">
		SELECT * FROM seminary WHERE branch_id_ = #{branchId} LIMIT 1
	</select>
</mapper>
