<?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_group.TbGroupMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, address_ids, address, detail_address, org_name, leader_id, leader_name, leader_phone, code, left_price, create_time, create_by, create_name, update_time, update_by, update_name, delete_status, is_lock, trade_area_id, trade_area_name, plat_seq_no, customs_code, shops_sccd, e_d_status, expiry, putrec_no, local_government_no, filing_status, field_code, border_list, dcl_border_list from tb_group  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_group.TbGroup"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_group 
	</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("addressIds") '> and address_ids = #{addressIds} </if>
			<if test=' this.has("address") '> and address = #{address} </if>
			<if test=' this.has("detailAddress") '> and detail_address = #{detailAddress} </if>
			<if test=' this.has("orgName") '> and org_name = #{orgName} </if>
			<if test=' this.has("leaderId") '> and leader_id = #{leaderId} </if>
			<if test=' this.has("leaderName") '> and leader_name = #{leaderName} </if>
			<if test=' this.has("leaderPhone") '> and leader_phone = #{leaderPhone} </if>
			<if test=' this.has("code") '> and code = #{code} </if>
			<if test=' this.has("leftPrice") '> and left_price = #{leftPrice} </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>
			<if test=' this.has("isLock") '> and is_lock = #{isLock} </if>
			<if test=' this.has("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>
			<if test=' this.has("tradeAreaName") '> and trade_area_name = #{tradeAreaName} </if>
			<if test=' this.has("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
			<if test=' this.has("customsCode") '> and customs_code = #{customsCode} </if>
			<if test=' this.has("shopsSccd") '> and shops_sccd = #{shopsSccd} </if>
			<if test=' this.has("eDStatus") '> and e_d_status = #{eDStatus} </if>
			<if test=' this.has("expiry") '> and expiry = #{expiry} </if>
			<if test=' this.has("putrecNo") '> and putrec_no = #{putrecNo} </if>
			<if test=' this.has("localGovernmentNo") '> and local_government_no = #{localGovernmentNo} </if>
			<if test=' this.has("filingStatus") '> and filing_status = #{filingStatus} </if>
			<if test=' this.has("fieldCode") '> and field_code = #{fieldCode} </if>
			<if test=' this.has("borderList") '> and border_list = #{borderList} </if>
			<if test=' this.has("dclBorderList") '> and dcl_border_list = #{dclBorderList} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> address_ids desc </when>
			<when test='sortType == 3'> address desc </when>
			<when test='sortType == 4'> detail_address desc </when>
			<when test='sortType == 5'> org_name desc </when>
			<when test='sortType == 6'> leader_id desc </when>
			<when test='sortType == 7'> leader_name desc </when>
			<when test='sortType == 8'> leader_phone desc </when>
			<when test='sortType == 9'> code desc </when>
			<when test='sortType == 10'> left_price desc </when>
			<when test='sortType == 11'> create_time desc </when>
			<when test='sortType == 12'> create_by desc </when>
			<when test='sortType == 13'> create_name desc </when>
			<when test='sortType == 14'> update_time desc </when>
			<when test='sortType == 15'> update_by desc </when>
			<when test='sortType == 16'> update_name desc </when>
			<when test='sortType == 17'> delete_status desc </when>
			<when test='sortType == 18'> is_lock desc </when>
			<when test='sortType == 19'> trade_area_id desc </when>
			<when test='sortType == 20'> trade_area_name desc </when>
			<when test='sortType == 21'> plat_seq_no desc </when>
			<when test='sortType == 22'> customs_code desc </when>
			<when test='sortType == 23'> shops_sccd desc </when>
			<when test='sortType == 24'> e_d_status desc </when>
			<when test='sortType == 25'> expiry desc </when>
			<when test='sortType == 26'> putrec_no desc </when>
			<when test='sortType == 27'> local_government_no desc </when>
			<when test='sortType == 28'> filing_status desc </when>
			<when test='sortType == 29'> field_code desc </when>
			<when test='sortType == 30'> border_list desc </when>
			<when test='sortType == 31'> dcl_border_list desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
