<?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_iport_order.TbIportOrderMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, idno, border_putrec_no, border_name, settle_bill_no, pre_ieport_no, buy_confirm_status, pay_status, cooper_entrust_status, cooper_entrust_time, apply_confirm_status, apply_confirm_time from tb_iport_order  -->

	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_iport_order.TbIportOrder"></resultMap>

	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select *
		from tb_iport_order
	</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("idno") '> and idno = #{idno} </if>
			<if test=' this.has("borderPutrecNo") '> and border_putrec_no = #{borderPutrecNo} </if>
			<if test=' this.has("borderName") '> and border_name = #{borderName} </if>
			<if test=' this.has("settleBillNo") '> and settle_bill_no = #{settleBillNo} </if>
			<if test=' this.has("preIeportNo") '> and pre_ieport_no = #{preIeportNo} </if>
			<if test=' this.has("buyConfirmStatus") '> and buy_confirm_status = #{buyConfirmStatus} </if>
			<if test=' this.has("payStatus") '> and pay_status = #{payStatus} </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>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> idno desc </when>
			<when test='sortType == 3'> border_putrec_no desc </when>
			<when test='sortType == 4'> border_name desc </when>
			<when test='sortType == 5'> settle_bill_no desc </when>
			<when test='sortType == 6'> pre_ieport_no desc </when>
			<when test='sortType == 7'> buy_confirm_status desc </when>
			<when test='sortType == 8'> pay_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>










</mapper>
