<?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.pj.ht_pass_card_record.HtPassCardRecordMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, area_no, i_e_flag, area_name, channel_no, channel_name, ve_no, cross_weight, channel_type, check_result, manifest_id, bill_code, check_time from ht_pass_card_record  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.ht_pass_card_record.HtPassCardRecord"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from ht_pass_card_record 
	</sql>

	
	<!-- 查集合 - 根据条件（参数为空时代表忽略指定条件） [G] -->
	<select id="getList" resultMap="model">
		<include refid="select_sql"></include>
		<where>
			<if test=' this.has("id") '> and id = #{id} </if>
			<if test=' this.has("areaNo") '> and area_no = #{areaNo} </if>
			<if test=' this.has("iEFlag") '> and i_e_flag = #{iEFlag} </if>
			<if test=' this.has("areaName") '> and area_name = #{areaName} </if>
			<if test=' this.has("channelNo") '> and channel_no = #{channelNo} </if>
			<if test=' this.has("channelName") '> and channel_name = #{channelName} </if>
			<if test=' this.has("veNo") '> and ve_no = #{veNo} </if>
			<if test=' this.has("crossWeight") '> and cross_weight = #{crossWeight} </if>
			<if test=' this.has("channelType") '> and channel_type = #{channelType} </if>
			<if test=' this.has("checkResult") '> and check_result = #{checkResult} </if>
			<if test=' this.has("manifestId") '> and manifest_id = #{manifestId} </if>
			<if test=' this.has("billCode") '> and bill_code = #{billCode} </if>
			<if test=' this.has("checkTime") '> and check_time = #{checkTime} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> area_no desc </when>
			<when test='sortType == 3'> i_e_flag desc </when>
			<when test='sortType == 4'> area_name desc </when>
			<when test='sortType == 5'> channel_no desc </when>
			<when test='sortType == 6'> channel_name desc </when>
			<when test='sortType == 7'> ve_no desc </when>
			<when test='sortType == 8'> cross_weight desc </when>
			<when test='sortType == 9'> channel_type desc </when>
			<when test='sortType == 10'> check_result desc </when>
			<when test='sortType == 11'> manifest_id desc </when>
			<when test='sortType == 12'> bill_code desc </when>
			<when test='sortType == 13'> check_time desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
