<?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.bank_byte.BankByteMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, message_id, body, queue_name, finish_status, create_time from bank_byte  -->
	
	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.bank_byte.BankByte"></resultMap>
	
	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select * 
		from bank_byte 
	</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("messageId") '> and message_id = #{messageId} </if>
			<if test=' this.has("body") '> and body = #{body} </if>
			<if test=' this.has("queueName") '> and queue_name = #{queueName} </if>
			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
		</where>
		order by
		<choose>
			<when test='sortType == 1'> id desc </when>
			<when test='sortType == 2'> message_id desc </when>
			<when test='sortType == 3'> body desc </when>
			<when test='sortType == 4'> queue_name desc </when>
			<when test='sortType == 5'> finish_status desc </when>
			<when test='sortType == 6'> create_time desc </when>
			<otherwise> id desc </otherwise>
		</choose>
	</select>
	
	
	
	
	
	
	
	
	

</mapper>
