<?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_fee_item_record.TbFeeItemRecordMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, order_no, item_id, fee_type, fee_num, item_name, item_price, company_name, company_id, level_two_order_id, level_two_order_no, create_time, pay_time, pay_status, pay_remark from tb_fee_item_record  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_fee_item_record.TbFeeItemRecord"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_fee_item_record 
	</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("orderNo") '> and order_no = #{orderNo} </if>
			<if test=' this.has("itemId") '> and item_id = #{itemId} </if>
			<if test=' this.has("feeType") '> and fee_type = #{feeType} </if>
			<if test=' this.has("feeNum") '> and fee_num = #{feeNum} </if>
			<if test=' this.has("itemName") '> and item_name = #{itemName} </if>
			<if test=' this.has("itemPrice") '> and item_price = #{itemPrice} </if>
			<if test=' this.has("companyName") '> and company_name = #{companyName} </if>
			<if test=' this.has("companyId") '> and company_id = #{companyId} </if>
			<if test=' this.has("levelTwoOrderId") '> and level_two_order_id = #{levelTwoOrderId} </if>
			<if test=' this.has("levelTwoOrderNo") '> and level_two_order_no = #{levelTwoOrderNo} </if>
			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
			<if test=' this.has("payTime") '> and pay_time = #{payTime} </if>
			<if test=' this.has("payStatus") '> and pay_status = #{payStatus} </if>
			<if test=' this.has("payRemark") '> and pay_remark = #{payRemark} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> order_no desc </when>
			<when test='sortType == 3'> item_id desc </when>
			<when test='sortType == 4'> fee_type desc </when>
			<when test='sortType == 5'> fee_num desc </when>
			<when test='sortType == 6'> item_name desc </when>
			<when test='sortType == 7'> item_price desc </when>
			<when test='sortType == 8'> company_name desc </when>
			<when test='sortType == 9'> company_id desc </when>
			<when test='sortType == 10'> level_two_order_id desc </when>
			<when test='sortType == 11'> level_two_order_no desc </when>
			<when test='sortType == 12'> create_time desc </when>
			<when test='sortType == 13'> pay_time desc </when>
			<when test='sortType == 14'> pay_status desc </when>
			<when test='sortType == 15'> pay_remark desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
