<?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.ruoyi.system.mapper.RecordDataMapper">
    
    <resultMap type="RecordData" id="RecordDataResult">
    	<id     property="id"      column="id"      />
        <result property="parkSyscode"    column="park_syscode"    />
        <result property="parkName"     column="park_name"     />
        <result property="entranceSyscode"   column="entrance_syscode"   />
        <result property="entranceName"    column="entrance_name"    />
        <result property="roadwaySyscode"      column="roadway_syscode"      />
        <result property="roadwayName"    column="roadway_name"    />
        <result property="vehicleOut"      column="vehicle_out"      />
        <result property="releaseMode"    column="release_mode"    />
        <result property="plateNo"    column="plate_no"    />
        <result property="cardNo"    column="card_no"    />
        <result property="crossTime"    column="cross_time"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
    
    <sql id="recordDataVo">
        select id, park_syscode, park_name, entrance_syscode, entrance_name, roadway_syscode, roadway_name, vehicle_out, release_mode, plate_no, card_no, cross_time, create_time
		from record_data
    </sql>

    
    <select id="selectList" parameterType="RecordData" resultMap="RecordDataResult">
        <include refid="recordDataVo"/>
        <where>
			<if test="plateNo != null and plateNo != ''">
				AND plate_no like concat('%', #{plateNo}, '%')
			</if>
			<if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
				and date_format(cross_time,'%y%m%d %H:%i:%S') &gt;= date_format(#{startTime},'%y%m%d %H:%i:%S')
			</if>
			<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
				and date_format(cross_time,'%y%m%d %H:%i:%S') &lt;= date_format(#{endTime},'%y%m%d %H:%i:%S')
			</if>
		</where>
    </select>

    
    <insert id="insertRecordData" parameterType="RecordData">
        insert into record_data (
			<if test="id != null and id != '' ">id,</if>
		    <if test="parkName != null and parkName != '' ">park_name,</if>
			<if test="parkSyscode != null and parkSyscode != '' ">park_syscode,</if>
			<if test="entranceSyscode != null and entranceSyscode != '' ">entrance_syscode,</if>
			<if test="entranceName != null and entranceName != '' ">entrance_name,</if>
			<if test="roadwaySyscode != null and roadwaySyscode != ''">roadway_syscode,</if>
			<if test="roadwayName != null and roadwayName != ''">roadway_name,</if>
			<if test="vehicleOut != null and vehicleOut != ''">vehicle_out,</if>
			<if test="releaseMode != null and releaseMode != ''">release_mode,</if>
			<if test="plateNo != null and plateNo != ''">plate_no,</if>
			<if test="cardNo != null and cardNo != ''">card_no,</if>
			<if test="crossTime != null and crossTime != ''">cross_time,</if>
 			create_time
        )values(
			<if test="id != null and id != '' ">#{id},</if>
			<if test="parkName != null and parkName != '' ">#{parkName},</if>
			<if test="parkSyscode != null and parkSyscode != '' ">#{parkSyscode},</if>
			<if test="entranceSyscode != null and entranceSyscode != '' ">#{entranceSyscode},</if>
			<if test="entranceName != null and entranceName != '' ">#{entranceName},</if>
			<if test="roadwaySyscode != null and roadwaySyscode != ''">#{roadwaySyscode},</if>
			<if test="roadwayName != null and roadwayName != ''">#{roadwayName},</if>
			<if test="vehicleOut != null and vehicleOut != ''">#{vehicleOut},</if>
			<if test="releaseMode != null and releaseMode != ''">#{releaseMode},</if>
			<if test="plateNo != null and plateNo != ''">#{plateNo},</if>
			<if test="cardNo != null and cardNo != ''">#{cardNo},</if>
			<if test="crossTime != null and crossTime != ''">#{crossTime},</if>
 			sysdate()
		)
    </insert>



    
</mapper>