<?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_people_profit_record.TbPeopleProfitRecordMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, people_id, people_name, level_two_order_id, level_two_order_no, price, profit_type, profit_num, create_time, pay_time, pay_status, pay_remark from tb_people_profit_record  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_people_profit_record.TbPeopleProfitRecord"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_people_profit_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("peopleId") '> and people_id = #{peopleId} </if>
			<if test=' this.has("peopleName") '> and people_name = #{peopleName} </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("price") '> and price = #{price} </if>
			<if test=' this.has("profitType") '> and profit_type = #{profitType} </if>
			<if test=' this.has("profitNum") '> and profit_num = #{profitNum} </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'> people_id desc </when>
			<when test='sortType == 3'> people_name desc </when>
			<when test='sortType == 4'> level_two_order_id desc </when>
			<when test='sortType == 5'> level_two_order_no desc </when>
			<when test='sortType == 6'> price desc </when>
			<when test='sortType == 7'> profit_type desc </when>
			<when test='sortType == 8'> profit_num desc </when>
			<when test='sortType == 9'> create_time desc </when>
			<when test='sortType == 10'> pay_time desc </when>
			<when test='sortType == 11'> pay_status desc </when>
			<when test='sortType == 12'> pay_remark desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
