<?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_order_goods.TbOrderGoodsMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, plat_seq_no, border_putrec_no, idno, order_id, goods_id, goods_code, goods_name, avatar, buy_amount, net_wt, gross_wt, buy_qty, buy_qty1, buy_qty2, buy_unit, num_unit, create_by, create_name, create_time, update_by, update_name, update_time, delete_status from tb_order_goods  -->

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

	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select *
		from tb_order_goods
	</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("borderPutrecNo") '> and border_putrec_no = #{borderPutrecNo} </if>
			<if test=' this.has("idno") '> and idno = #{idno} </if>
			<if test=' this.has("orderId") '> and order_id = #{orderId} </if>
			<if test=' this.has("goodsId") '> and goods_id = #{goodsId} </if>
			<if test=' this.has("goodsCode") '> and goods_code = #{goodsCode} </if>
			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
			<if test=' this.has("avatar") '> and avatar = #{avatar} </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("buyUnit") '> and buy_unit = #{buyUnit} </if>
			<if test=' this.has("numUnit") '> and num_unit = #{numUnit} </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>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> plat_seq_no desc </when>
			<when test='sortType == 3'> border_putrec_no desc </when>
			<when test='sortType == 4'> idno desc </when>
			<when test='sortType == 5'> order_id desc </when>
			<when test='sortType == 6'> goods_id desc </when>
			<when test='sortType == 7'> goods_code desc </when>
			<when test='sortType == 8'> goods_name desc </when>
			<when test='sortType == 9'> avatar desc </when>
			<when test='sortType == 10'> buy_amount desc </when>
			<when test='sortType == 11'> net_wt desc </when>
			<when test='sortType == 12'> gross_wt desc </when>
			<when test='sortType == 13'> buy_qty desc </when>
			<when test='sortType == 14'> buy_qty1 desc </when>
			<when test='sortType == 15'> buy_qty2 desc </when>
			<when test='sortType == 16'> buy_unit desc </when>
			<when test='sortType == 17'> num_unit desc </when>
			<when test='sortType == 18'> create_by desc </when>
			<when test='sortType == 19'> create_name desc </when>
			<when test='sortType == 20'> create_time desc </when>
			<when test='sortType == 21'> update_by desc </when>
			<when test='sortType == 22'> update_name desc </when>
			<when test='sortType == 23'> update_time desc </when>
			<when test='sortType == 24'> delete_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>










</mapper>
