<?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.elephant.framework.galaxy.aroad.module.traffic.mapper.TrafficRouteMapper">

	<resultMap id="trafficRouteMap" type="com.elephant.framework.galaxy.aroad.module.traffic.entity.TrafficRoute">
		<id property="id" column="id"/>
		<result property="roadCode" column="road_code"/>
		<result property="roadName" column="road_name"/>
		<result property="spotLength" column="spot_length"/>
		<result property="jdcCurrentAmount" column="JDC_current_amount"/>
		<result property="jdcNaturalAmount" column="JDC_natural_amount"/>
		<result property="qcCurrentAmount" column="QC_current_amount"/>
		<result property="qcNaturalAmount" column="QC_natural_amount"/>
		<result property="qcSTruck" column="QC_s_truck"/>
		<result property="qcMTruck" column="QC_m_truck"/>
		<result property="qcLTruck" column="QC_l_truck"/>
		<result property="qcXlTruck" column="QC_xl_truck"/>
		<result property="qcJzxTruck" column="QC_jzx_truck"/>
		<result property="qcSmBus" column="QC_sm_bus"/>
		<result property="qcLBus" column="QC_l_bus"/>
		<result property="motor" column="motor"/>
		<result property="tljCurrentAmount" column="TLJ_current_amount"/>
		<result property="tljNaturalAmount" column="TLJ_natural_amount"/>
		<result property="driveAmount" column="drive_amount"/>
		<result property="adaptAmount" column="adapt_amount"/>
		<result property="crowd" column="crowd"/>
		<result property="year" column="year"/>
	</resultMap>

	<select id="getTrafficRoutePage" resultMap="trafficRouteMap"
	        parameterType="com.elephant.framework.galaxy.aroad.module.traffic.entity.TrafficRoute">
		select * from t_lwjc_gsd_lxjtl
		<where>
			<if test="trafficRoute.roadName != null">
				road_name like CONCAT('%',#{trafficRoute.roadName},'%')
				or
				road_code like CONCAT('%',#{trafficRoute.roadName},'%')
			</if>
		</where>
		ORDER BY crowd desc
	</select>
</mapper>
