<?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_sell_goods_list.HtSellGoodsListMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, plat_seq_no, g_no, code_ts, g_name, g_model, storage_envm, use_to, gross_wt, net_wt, origin_country, g_qty, qty1, qty2, g_unit, unit1, unit2, decl_price, decl_total, finish_status, create_time from ht_sell_goods_list  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.ht_sell_goods_list.HtSellGoodsList"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from ht_sell_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("gNo") '> and g_no = #{gNo} </if>
			<if test=' this.has("codeTs") '> and code_ts = #{codeTs} </if>
			<if test=' this.has("gName") '> and g_name = #{gName} </if>
			<if test=' this.has("gModel") '> and g_model = #{gModel} </if>
			<if test=' this.has("storageEnvm") '> and storage_envm = #{storageEnvm} </if>
			<if test=' this.has("useTo") '> and use_to = #{useTo} </if>
			<if test=' this.has("grossWt") '> and gross_wt = #{grossWt} </if>
			<if test=' this.has("netWt") '> and net_wt = #{netWt} </if>
			<if test=' this.has("originCountry") '> and origin_country = #{originCountry} </if>
			<if test=' this.has("gQty") '> and g_qty = #{gQty} </if>
			<if test=' this.has("qty1") '> and qty1 = #{qty1} </if>
			<if test=' this.has("qty2") '> and qty2 = #{qty2} </if>
			<if test=' this.has("gUnit") '> and g_unit = #{gUnit} </if>
			<if test=' this.has("unit1") '> and unit1 = #{unit1} </if>
			<if test=' this.has("unit2") '> and unit2 = #{unit2} </if>
			<if test=' this.has("declPrice") '> and decl_price = #{declPrice} </if>
			<if test=' this.has("declTotal") '> and decl_total = #{declTotal} </if>
			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
			<if test=' this.has("createTime") '> and create_time = #{createTime} </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'> g_no desc </when>
			<when test='sortType == 4'> code_ts desc </when>
			<when test='sortType == 5'> g_name desc </when>
			<when test='sortType == 6'> g_model desc </when>
			<when test='sortType == 7'> storage_envm desc </when>
			<when test='sortType == 8'> use_to desc </when>
			<when test='sortType == 9'> gross_wt desc </when>
			<when test='sortType == 10'> net_wt desc </when>
			<when test='sortType == 11'> origin_country desc </when>
			<when test='sortType == 12'> g_qty desc </when>
			<when test='sortType == 13'> qty1 desc </when>
			<when test='sortType == 14'> qty2 desc </when>
			<when test='sortType == 15'> g_unit desc </when>
			<when test='sortType == 16'> unit1 desc </when>
			<when test='sortType == 17'> unit2 desc </when>
			<when test='sortType == 18'> decl_price desc </when>
			<when test='sortType == 19'> decl_total desc </when>
			<when test='sortType == 20'> finish_status desc </when>
			<when test='sortType == 21'> create_time desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
