<?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.TbFeeItemMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, company_id, company_name, name, fee_type, percent, fee_money, status, create_time, update_by, update_by_name, update_time, update_by_id from tb_fee_item  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.tb_fee_item.TbFeeItem"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from tb_fee_item 
	</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("companyId") '> and company_id = #{companyId} </if>
			<if test=' this.has("companyName") '> and company_name = #{companyName} </if>
			<if test=' this.has("name") '> and name like concat('%',#{name},'%') </if>
			<if test=' this.has("feeType") '> and fee_type = #{feeType} </if>
			<if test=' this.has("percent") '> and percent = #{percent} </if>
			<if test=' this.has("feeMoney") '> and fee_money = #{feeMoney} </if>
			<if test=' this.has("status") '> and status = #{status} </if>
			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
			<if test=' this.has("updateByName") '> and update_by_name = #{updateByName} </if>
			<if test=' this.has("updateById") '> and update_by_id = #{updateById} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> company_id desc </when>
			<when test='sortType == 3'> company_name desc </when>
			<when test='sortType == 4'> name desc </when>
			<when test='sortType == 5'> fee_type desc </when>
			<when test='sortType == 6'> percent desc </when>
			<when test='sortType == 7'> fee_money desc </when>
			<when test='sortType == 8'> status desc </when>
			<when test='sortType == 9'> create_time desc </when>
			<when test='sortType == 10'> update_by desc </when>
			<when test='sortType == 11'> update_by_name desc </when>
			<when test='sortType == 12'> update_time desc </when>
			<when test='sortType == 13'> update_by_id desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
