<?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.tb_collage_orders.TbCollageOrdersMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, trade_area_id, trade_area_name, order_no, cooperative_id, cooperative_name, total_price, entry_people_status, entry_leader_status, entry_customs_status, entry_no, entry_time, entry_result, entry_fail_reason, people_confirm_status, people_confirm_time, import_leader_time, import_people_time, import_leader_status, import_people_status, import_no, import_time, is_delivery, order_finish, driver_id, driver_name, driver_phone, car_id, car_type, vehicle_plate, loading_address, unloading_address, create_by, create_name, create_time, update_by, update_name, update_time, delete_status, plat_seq_no, declare_id, declare_type, declare_name, idno, shop_no, shop_name, org_putrec_no, org_name, org_scc, ve_no, btrnb_biz_modecd, g_flow, i_e_flag, field_code, field_name, customs_code, car_pool, sum_amt, sum_gross_wt, sum_net_wt, traf_mode, curr_code, pack_no, decl_time, bill_no, voyage_no, goods_names, borders_list, border_buy_goods_list, sell_goods_list, finish_status from tb_collage_orders  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_collage_orders.TbCollageOrders"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_collage_orders 
	</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("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>
			<if test=' this.has("tradeAreaName") '> and trade_area_name = #{tradeAreaName} </if>
			<if test=' this.has("orderNo") '> and order_no = #{orderNo} </if>
			<if test=' this.has("cooperativeId") '> and cooperative_id = #{cooperativeId} </if>
			<if test=' this.has("cooperativeName") '> and cooperative_name = #{cooperativeName} </if>
			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>
			<if test=' this.has("entryPeopleStatus") '> and entry_people_status = #{entryPeopleStatus} </if>
			<if test=' this.has("entryLeaderStatus") '> and entry_leader_status = #{entryLeaderStatus} </if>
			<if test=' this.has("entryCustomsStatus") '> and entry_customs_status = #{entryCustomsStatus} </if>
			<if test=' this.has("entryNo") '> and entry_no = #{entryNo} </if>
			<if test=' this.has("entryTime") '> and entry_time = #{entryTime} </if>
			<if test=' this.has("entryResult") '> and entry_result = #{entryResult} </if>
			<if test=' this.has("entryFailReason") '> and entry_fail_reason = #{entryFailReason} </if>
			<if test=' this.has("peopleConfirmStatus") '> and people_confirm_status = #{peopleConfirmStatus} </if>
			<if test=' this.has("peopleConfirmTime") '> and people_confirm_time = #{peopleConfirmTime} </if>
			<if test=' this.has("importLeaderTime") '> and import_leader_time = #{importLeaderTime} </if>
			<if test=' this.has("importPeopleTime") '> and import_people_time = #{importPeopleTime} </if>
			<if test=' this.has("importLeaderStatus") '> and import_leader_status = #{importLeaderStatus} </if>
			<if test=' this.has("importPeopleStatus") '> and import_people_status = #{importPeopleStatus} </if>
			<if test=' this.has("importNo") '> and import_no = #{importNo} </if>
			<if test=' this.has("importTime") '> and import_time = #{importTime} </if>
			<if test=' this.has("isDelivery") '> and is_delivery = #{isDelivery} </if>
			<if test=' this.has("orderFinish") '> and order_finish = #{orderFinish} </if>
			<if test=' this.has("driverId") '> and driver_id = #{driverId} </if>
			<if test=' this.has("driverName") '> and driver_name = #{driverName} </if>
			<if test=' this.has("driverPhone") '> and driver_phone = #{driverPhone} </if>
			<if test=' this.has("carId") '> and car_id = #{carId} </if>
			<if test=' this.has("carType") '> and car_type = #{carType} </if>
			<if test=' this.has("vehiclePlate") '> and vehicle_plate = #{vehiclePlate} </if>
			<if test=' this.has("loadingAddress") '> and loading_address = #{loadingAddress} </if>
			<if test=' this.has("unloadingAddress") '> and unloading_address = #{unloadingAddress} </if>
			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
			<if test=' this.has("createName") '> and create_name = #{createName} </if>
			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
			<if test=' this.has("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
			<if test=' this.has("declareId") '> and declare_id = #{declareId} </if>
			<if test=' this.has("declareType") '> and declare_type = #{declareType} </if>
			<if test=' this.has("declareName") '> and declare_name = #{declareName} </if>
			<if test=' this.has("idno") '> and idno = #{idno} </if>
			<if test=' this.has("shopNo") '> and shop_no = #{shopNo} </if>
			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
			<if test=' this.has("orgPutrecNo") '> and org_putrec_no = #{orgPutrecNo} </if>
			<if test=' this.has("orgName") '> and org_name = #{orgName} </if>
			<if test=' this.has("orgScc") '> and org_scc = #{orgScc} </if>
			<if test=' this.has("veNo") '> and ve_no = #{veNo} </if>
			<if test=' this.has("btrnbBizModecd") '> and btrnb_biz_modecd = #{btrnbBizModecd} </if>
			<if test=' this.has("gFlow") '> and g_flow = #{gFlow} </if>
			<if test=' this.has("iEFlag") '> and i_e_flag = #{iEFlag} </if>
			<if test=' this.has("fieldCode") '> and field_code = #{fieldCode} </if>
			<if test=' this.has("fieldName") '> and field_name = #{fieldName} </if>
			<if test=' this.has("customsCode") '> and customs_code = #{customsCode} </if>
			<if test=' this.has("carPool") '> and car_pool = #{carPool} </if>
			<if test=' this.has("sumAmt") '> and sum_amt = #{sumAmt} </if>
			<if test=' this.has("sumGrossWt") '> and sum_gross_wt = #{sumGrossWt} </if>
			<if test=' this.has("sumNetWt") '> and sum_net_wt = #{sumNetWt} </if>
			<if test=' this.has("trafMode") '> and traf_mode = #{trafMode} </if>
			<if test=' this.has("currCode") '> and curr_code = #{currCode} </if>
			<if test=' this.has("packNo") '> and pack_no = #{packNo} </if>
			<if test=' this.has("declTime") '> and decl_time = #{declTime} </if>
			<if test=' this.has("billNo") '> and bill_no = #{billNo} </if>
			<if test=' this.has("voyageNo") '> and voyage_no = #{voyageNo} </if>
			<if test=' this.has("goodsNames") '> and goods_names = #{goodsNames} </if>
			<if test=' this.has("bordersList") '> and borders_list = #{bordersList} </if>
			<if test=' this.has("borderBuyGoodsList") '> and border_buy_goods_list = #{borderBuyGoodsList} </if>
			<if test=' this.has("sellGoodsList") '> and sell_goods_list = #{sellGoodsList} </if>
			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> trade_area_id desc </when>
			<when test='sortType == 3'> trade_area_name desc </when>
			<when test='sortType == 4'> order_no desc </when>
			<when test='sortType == 5'> cooperative_id desc </when>
			<when test='sortType == 6'> cooperative_name desc </when>
			<when test='sortType == 7'> total_price desc </when>
			<when test='sortType == 8'> entry_people_status desc </when>
			<when test='sortType == 9'> entry_leader_status desc </when>
			<when test='sortType == 10'> entry_customs_status desc </when>
			<when test='sortType == 11'> entry_no desc </when>
			<when test='sortType == 12'> entry_time desc </when>
			<when test='sortType == 13'> entry_result desc </when>
			<when test='sortType == 14'> entry_fail_reason desc </when>
			<when test='sortType == 15'> people_confirm_status desc </when>
			<when test='sortType == 16'> people_confirm_time desc </when>
			<when test='sortType == 17'> import_leader_time desc </when>
			<when test='sortType == 18'> import_people_time desc </when>
			<when test='sortType == 19'> import_leader_status desc </when>
			<when test='sortType == 20'> import_people_status desc </when>
			<when test='sortType == 21'> import_no desc </when>
			<when test='sortType == 22'> import_time desc </when>
			<when test='sortType == 23'> is_delivery desc </when>
			<when test='sortType == 24'> order_finish desc </when>
			<when test='sortType == 25'> driver_id desc </when>
			<when test='sortType == 26'> driver_name desc </when>
			<when test='sortType == 27'> driver_phone desc </when>
			<when test='sortType == 28'> car_id desc </when>
			<when test='sortType == 29'> car_type desc </when>
			<when test='sortType == 30'> vehicle_plate desc </when>
			<when test='sortType == 31'> loading_address desc </when>
			<when test='sortType == 32'> unloading_address desc </when>
			<when test='sortType == 33'> create_by desc </when>
			<when test='sortType == 34'> create_name desc </when>
			<when test='sortType == 35'> create_time desc </when>
			<when test='sortType == 36'> update_by desc </when>
			<when test='sortType == 37'> update_name desc </when>
			<when test='sortType == 38'> update_time desc </when>
			<when test='sortType == 39'> delete_status desc </when>
			<when test='sortType == 40'> plat_seq_no desc </when>
			<when test='sortType == 41'> declare_id desc </when>
			<when test='sortType == 42'> declare_type desc </when>
			<when test='sortType == 43'> declare_name desc </when>
			<when test='sortType == 44'> idno desc </when>
			<when test='sortType == 45'> shop_no desc </when>
			<when test='sortType == 46'> shop_name desc </when>
			<when test='sortType == 47'> org_putrec_no desc </when>
			<when test='sortType == 48'> org_name desc </when>
			<when test='sortType == 49'> org_scc desc </when>
			<when test='sortType == 50'> ve_no desc </when>
			<when test='sortType == 51'> btrnb_biz_modecd desc </when>
			<when test='sortType == 52'> g_flow desc </when>
			<when test='sortType == 53'> i_e_flag desc </when>
			<when test='sortType == 54'> field_code desc </when>
			<when test='sortType == 55'> field_name desc </when>
			<when test='sortType == 56'> customs_code desc </when>
			<when test='sortType == 57'> car_pool desc </when>
			<when test='sortType == 58'> sum_amt desc </when>
			<when test='sortType == 59'> sum_gross_wt desc </when>
			<when test='sortType == 60'> sum_net_wt desc </when>
			<when test='sortType == 61'> traf_mode desc </when>
			<when test='sortType == 62'> curr_code desc </when>
			<when test='sortType == 63'> pack_no desc </when>
			<when test='sortType == 64'> decl_time desc </when>
			<when test='sortType == 65'> bill_no desc </when>
			<when test='sortType == 66'> voyage_no desc </when>
			<when test='sortType == 67'> goods_names desc </when>
			<when test='sortType == 68'> borders_list desc </when>
			<when test='sortType == 69'> border_buy_goods_list desc </when>
			<when test='sortType == 70'> sell_goods_list desc </when>
			<when test='sortType == 71'> finish_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
