<?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_after_sale.TbOrderAfterSaleMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, order_id, user_id, user_phone, time, apply_type, remark, after_sale_status, goods_img, goods_name, goods_num from tb_order_after_sale  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_order_after_sale.TbOrderAfterSale"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_order_after_sale 
	</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("orderId") '> and order_id = #{orderId} </if>
			<if test=' this.has("userId") '> and user_id = #{userId} </if>
			<if test=' this.has("userPhone") '> and user_phone = #{userPhone} </if>
			<if test=' this.has("time") '> and time = #{time} </if>
			<if test=' this.has("applyType") '> and apply_type = #{applyType} </if>
			<if test=' this.has("remark") '> and remark = #{remark} </if>
			<if test=' this.has("afterSaleStatus") '> and after_sale_status = #{afterSaleStatus} </if>
			<if test=' this.has("goodsImg") '> and goods_img = #{goodsImg} </if>
			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
			<if test=' this.has("goodsNum") '> and goods_num = #{goodsNum} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> order_id desc </when>
			<when test='sortType == 3'> user_id desc </when>
			<when test='sortType == 4'> user_phone desc </when>
			<when test='sortType == 5'> time desc </when>
			<when test='sortType == 6'> apply_type desc </when>
			<when test='sortType == 7'> remark desc </when>
			<when test='sortType == 8'> after_sale_status desc </when>
			<when test='sortType == 9'> goods_img desc </when>
			<when test='sortType == 10'> goods_name desc </when>
			<when test='sortType == 11'> goods_num desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
