<?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_info.BankInfoMapper">




	<!-- ================================== 查询相关 ================================== -->
	<!-- select id, sn, date, organization, bankCode, operation, code, source, result, note, create_time from bank_info  -->

	<!-- 通用映射：自动模式 -->
	<resultMap id="model" autoMapping="true" type="com.pj.bank_info.BankInfo"></resultMap>

	<!-- 公共查询sql片段 -->
	<sql id="select_sql">
		select *
		from bank_info
	</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("sn") '> and sn = #{sn} </if>
			<if test=' this.has("date") '> and date = #{date} </if>
			<if test=' this.has("organization") '> and organization = #{organization} </if>
			<if test=' this.has("bankCode") '> and bankCode = #{bankCode} </if>
			<if test=' this.has("operation") '> and operation = #{operation} </if>
			<if test=' this.has("code") '> and code = #{code} </if>
			<if test=' this.has("source") '> and source = #{source} </if>
			<if test=' this.has("result") '> and result = #{result} </if>
			<if test=' this.has("note") '> and note = #{note} </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'> sn desc </when>
			<when test='sortType == 3'> date desc </when>
			<when test='sortType == 4'> organization desc </when>
			<when test='sortType == 5'> bankCode desc </when>
			<when test='sortType == 6'> operation desc </when>
			<when test='sortType == 7'> code desc </when>
			<when test='sortType == 8'> source desc </when>
			<when test='sortType == 9'> result desc </when>
			<when test='sortType == 10'> note desc </when>
			<when test='sortType == 11'> create_time desc </when>
			<otherwise> create_time desc </otherwise>
		</choose>
	</select>










</mapper>
