<?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_goods_cart.TbGoodsCartMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, enterprise_id, shop_id, trade_area_id, buy_user_id, total_price, sale_goods_info_id, buy_weight, buy_user_type, buy_type, distribution, publish_goods_id, create_time, create_by, create_name, update_time, update_by, update_name, delete_status from tb_goods_cart  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_goods_cart.TbGoodsCart"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_goods_cart 
	</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("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>
			<if test=' this.has("goodsIsorderStatus") '> and goods_isorder_status = #{goodsIsorderStatus} </if>
			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
			<if test=' this.has("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>
			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
			<if test=' this.has("buyUserId") '> and buy_user_id = #{buyUserId} </if>
			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>
			<if test=' this.has("saleGoodsInfoId") '> and sale_goods_info_id = #{saleGoodsInfoId} </if>
			<if test=' this.has("buyWeight") '> and buy_weight = #{buyWeight} </if>
			<if test=' this.has("buyUserType") '> and buy_user_type = #{buyUserType} </if>
			<if test=' this.has("buyType") '> and buy_type = #{buyType} </if>
			<if test=' this.has("distribution") '> and distribution = #{distribution} </if>
			<if test=' this.has("publishGoodsId") '> and publish_goods_id = #{publishGoodsId} </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'> enterprise_id desc </when>
			<when test='sortType == 3'> shop_id desc </when>
			<when test='sortType == 4'> trade_area_id desc </when>
			<when test='sortType == 5'> buy_user_id desc </when>
			<when test='sortType == 6'> total_price desc </when>
			<when test='sortType == 7'> sale_goods_info_id desc </when>
			<when test='sortType == 8'> buy_weight desc </when>
			<when test='sortType == 9'> buy_user_type desc </when>
			<when test='sortType == 10'> buy_type desc </when>
			<when test='sortType == 11'> distribution desc </when>
			<when test='sortType == 12'> publish_goods_id desc </when>
			<when test='sortType == 13'> create_time desc </when>
			<when test='sortType == 14'> create_by desc </when>
			<when test='sortType == 15'> create_name desc </when>
			<when test='sortType == 16'> update_time desc </when>
			<when test='sortType == 17'> update_by desc </when>
			<when test='sortType == 18'> update_name desc </when>
			<when test='sortType == 19'> delete_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
