<?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_border_buy_goods_list.HtBorderBuyGoodsListMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, plat_seq_no, idno, buy_amount, net_wt, gross_wt, buy_qty, buy_qty1, buy_qty2, code_ts, goods_name, border_putrec_no, finish_status from ht_border_buy_goods_list  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.ht_border_buy_goods_list.HtBorderBuyGoodsList"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from ht_border_buy_goods_list 
	</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("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
			<if test=' this.has("idno") '> and idno = #{idno} </if>
			<if test=' this.has("buyAmount") '> and buy_amount = #{buyAmount} </if>
			<if test=' this.has("netWt") '> and net_wt = #{netWt} </if>
			<if test=' this.has("grossWt") '> and gross_wt = #{grossWt} </if>
			<if test=' this.has("buyQty") '> and buy_qty = #{buyQty} </if>
			<if test=' this.has("buyQty1") '> and buy_qty1 = #{buyQty1} </if>
			<if test=' this.has("buyQty2") '> and buy_qty2 = #{buyQty2} </if>
			<if test=' this.has("codeTs") '> and code_ts = #{codeTs} </if>
			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
			<if test=' this.has("borderPutrecNo") '> and border_putrec_no = #{borderPutrecNo} </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'> plat_seq_no desc </when>
			<when test='sortType == 3'> idno desc </when>
			<when test='sortType == 4'> buy_amount desc </when>
			<when test='sortType == 5'> net_wt desc </when>
			<when test='sortType == 6'> gross_wt desc </when>
			<when test='sortType == 7'> buy_qty desc </when>
			<when test='sortType == 8'> buy_qty1 desc </when>
			<when test='sortType == 9'> buy_qty2 desc </when>
			<when test='sortType == 10'> code_ts desc </when>
			<when test='sortType == 11'> goods_name desc </when>
			<when test='sortType == 12'> border_putrec_no desc </when>
			<when test='sortType == 13'> finish_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
