<?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_demand_quotation.TbDemandQuotationMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, leader_id, group_name, demand_id, quotation, create_by, create_name, create_time, delete_status from tb_demand_quotation  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_demand_quotation.TbDemandQuotation"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_demand_quotation 
	</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("leaderId") '> and leader_id = #{leaderId} </if>
			<if test=' this.has("groupName") '> and group_name = #{groupName} </if>
			<if test=' this.has("demandId") '> and demand_id = #{demandId} </if>
			<if test=' this.has("quotation") '> and quotation = #{quotation} </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("deleteStatus") '> and delete_status = #{deleteStatus} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> leader_id desc </when>
			<when test='sortType == 3'> group_name desc </when>
			<when test='sortType == 4'> demand_id desc </when>
			<when test='sortType == 5'> quotation desc </when>
			<when test='sortType == 6'> create_by desc </when>
			<when test='sortType == 7'> create_name desc </when>
			<when test='sortType == 8'> create_time desc </when>
			<when test='sortType == 9'> delete_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
