<?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.xxfc.platform.vehicle.mapper.VehicleCountRecordMapper" >
  <resultMap id="BaseResultMap" type="com.xxfc.platform.vehicle.entity.VehicleCountRecord" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="departure_num" property="departureNum" jdbcType="INTEGER" />
    <result column="actual_departure_num" property="actualDepartureNum" jdbcType="INTEGER" />
    <result column="after_departure_num" property="afterDepartureNum" jdbcType="INTEGER" />
    <result column="before_departure_num" property="beforeDepartureNum" jdbcType="INTEGER" />
    <result column="arrival_num" property="arrivalNum" jdbcType="INTEGER" />
    <result column="actual_arrival_num" property="actualArrivalNum" jdbcType="INTEGER" />
    <result column="after_arrival_num" property="afterArrivalNum" jdbcType="INTEGER" />
    <result column="before_arrival_num" property="beforeArrivalNum" jdbcType="INTEGER" />
    <result column="count_date" property="countDate" jdbcType="DATE"/>
  </resultMap>

  <select id = "countDepartureVehicle" parameterType = "com.xxfc.platform.vehicle.entity.VehicleCountRecord" resultMap = "BaseResultMap">
    select * from vehicle_count_record where count_date = #{time}
  </select>

  <select id="selectByTypeAndTime" parameterType = "Map" resultType="com.xxfc.platform.vehicle.entity.VehicleCountRecord">
    select * from vehicle_count_record
    <where>
      <if test="type != null">
          and type = #{type}
      </if>
      <if test="startTime != null">
          and count_date &gt;= #{startTime} and count_date &lt;= #{endTime}
      </if>
    </where>
    order by id DESC
  </select>

</mapper>