<?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_enterprise.TbEnterpriseMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, owner_name, nationality, type, sex, legal_person, id_card, owner_tel, business_license, shop_id, shop_name, bank_no, bank, bank_account, age, duty_paragraph, address_ids, address, detail, agreement, judge_status, judge_content, judge_time, register_time, judge_by, 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, owner_idtype, e_d_status from tb_enterprise  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_enterprise.TbEnterprise"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_enterprise 
	</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("ownerName") '> and owner_name = #{ownerName} </if>
			<if test=' this.has("nationality") '> and nationality = #{nationality} </if>
			<if test=' this.has("type") '> and type = #{type} </if>
			<if test=' this.has("sex") '> and sex = #{sex} </if>
			<if test=' this.has("legalPerson") '> and legal_person = #{legalPerson} </if>
			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>
			<if test=' this.has("ownerTel") '> and owner_tel = #{ownerTel} </if>
			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
			<if test=' this.has("bankNo") '> and bank_no = #{bankNo} </if>
			<if test=' this.has("bank") '> and bank = #{bank} </if>
			<if test=' this.has("bankAccount") '> and bank_account = #{bankAccount} </if>
			<if test=' this.has("age") '> and age = #{age} </if>
			<if test=' this.has("dutyParagraph") '> and duty_paragraph = #{dutyParagraph} </if>
			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
			<if test=' this.has("address") '> and address = #{address} </if>
			<if test=' this.has("detail") '> and detail = #{detail} </if>
			<if test=' this.has("agreement") '> and agreement = #{agreement} </if>
			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>
			<if test=' this.has("judgeBy") '> and judge_by = #{judgeBy} </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("ownerIdtype") '> and owner_idtype = #{ownerIdtype} </if>
			<if test=' this.has("eDStatus") '> and e_d_status = #{eDStatus} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> owner_name desc </when>
			<when test='sortType == 3'> nationality desc </when>
			<when test='sortType == 4'> type desc </when>
			<when test='sortType == 5'> sex desc </when>
			<when test='sortType == 6'> legal_person desc </when>
			<when test='sortType == 7'> id_card desc </when>
			<when test='sortType == 8'> owner_tel desc </when>
			<when test='sortType == 9'> shop_id desc </when>
			<when test='sortType == 10'> shop_name desc </when>
			<when test='sortType == 11'> bank_no desc </when>
			<when test='sortType == 12'> bank desc </when>
			<when test='sortType == 13'> bank_account desc </when>
			<when test='sortType == 14'> age desc </when>
			<when test='sortType == 15'> duty_paragraph desc </when>
			<when test='sortType == 16'> address_ids desc </when>
			<when test='sortType == 17'> address desc </when>
			<when test='sortType == 18'> detail desc </when>
			<when test='sortType == 19'> agreement desc </when>
			<when test='sortType == 20'> judge_status desc </when>
			<when test='sortType == 21'> judge_content desc </when>
			<when test='sortType == 22'> judge_time desc </when>
			<when test='sortType == 23'> register_time desc </when>
			<when test='sortType == 24'> judge_by desc </when>
			<when test='sortType == 25'> create_time desc </when>
			<when test='sortType == 26'> create_by desc </when>
			<when test='sortType == 27'> create_name desc </when>
			<when test='sortType == 28'> update_time desc </when>
			<when test='sortType == 29'> update_by desc </when>
			<when test='sortType == 30'> update_name desc </when>
			<when test='sortType == 31'> delete_status desc </when>
			<when test='sortType == 32'> is_lock desc </when>
			<when test='sortType == 33'> trade_area_id desc </when>
			<when test='sortType == 34'> trade_area_name desc </when>
			<when test='sortType == 35'> plat_seq_no desc </when>
			<when test='sortType == 36'> owner_idtype desc </when>
			<when test='sortType == 37'> e_d_status desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
