<?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.project.tb_logistics.TbLogisticsMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, orders_id, declaration_number, prepare, prepare_time, loading, loading_time, delivery, delivery_time, cleared_custom, cleared_custom_time, make_cargo, make_cargo_time, confirm_receipt, confirm_receipt_time, order_finish, create_time, create_by, create_name, update_time, update_by, update_name, delete_status, level_one_order_id from tb_logistics  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.project.tb_logistics.TbLogistics"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_logistics 
	</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("ordersId") '> and orders_id = #{ordersId} </if>
			<if test=' this.has("driverId") '> and driver_id = #{driverId} </if>
			<if test=' this.has("declarationNumber") '> and declaration_number = #{declarationNumber} </if>
			<if test=' this.has("prepare") '> and prepare = #{prepare} </if>
			<if test=' this.has("prepareTime") '> and prepare_time = #{prepareTime} </if>
			<if test=' this.has("loading") '> and loading = #{loading} </if>
			<if test=' this.has("loadingTime") '> and loading_time = #{loadingTime} </if>
			<if test=' this.has("delivery") '> and delivery = #{delivery} </if>
			<if test=' this.has("deliveryTime") '> and delivery_time = #{deliveryTime} </if>
			<if test=' this.has("clearedCustom") '> and cleared_custom = #{clearedCustom} </if>
			<if test=' this.has("clearedCustomTime") '> and cleared_custom_time = #{clearedCustomTime} </if>
			<if test=' this.has("makeCargo") '> and make_cargo = #{makeCargo} </if>
			<if test=' this.has("makeCargoTime") '> and make_cargo_time = #{makeCargoTime} </if>
			<if test=' this.has("confirmReceipt") '> and confirm_receipt = #{confirmReceipt} </if>
			<if test=' this.has("confirmReceiptTime") '> and confirm_receipt_time = #{confirmReceiptTime} </if>
			<if test=' this.has("orderFinish") '> and order_finish = #{orderFinish} </if>
			<if test=' this.has("createTime") '> and create_time = #{createTime} </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("updateTime") '> and update_time = #{updateTime} </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("deleteStatus") '> and delete_status = #{deleteStatus} </if>
			<if test=' this.has("levelOneOrderId") '> and level_one_order_id = #{levelOneOrderId} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> orders_id desc </when>
			<when test='sortType == 3'> declaration_number desc </when>
			<when test='sortType == 4'> prepare desc </when>
			<when test='sortType == 5'> prepare_time desc </when>
			<when test='sortType == 6'> loading desc </when>
			<when test='sortType == 7'> loading_time desc </when>
			<when test='sortType == 8'> delivery desc </when>
			<when test='sortType == 9'> delivery_time desc </when>
			<when test='sortType == 10'> cleared_custom desc </when>
			<when test='sortType == 11'> cleared_custom_time desc </when>
			<when test='sortType == 12'> make_cargo desc </when>
			<when test='sortType == 13'> make_cargo_time desc </when>
			<when test='sortType == 14'> confirm_receipt desc </when>
			<when test='sortType == 15'> confirm_receipt_time desc </when>
			<when test='sortType == 16'> order_finish desc </when>
			<when test='sortType == 17'> create_time desc </when>
			<when test='sortType == 18'> create_by desc </when>
			<when test='sortType == 19'> create_name desc </when>
			<when test='sortType == 20'> update_time desc </when>
			<when test='sortType == 21'> update_by desc </when>
			<when test='sortType == 22'> update_name desc </when>
			<when test='sortType == 23'> delete_status desc </when>
			<when test='sortType == 24'> level_one_order_id desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
