<?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="cn.superdesk.uniorder.dao.mapper.invoice.common.InvoiceBankInfoMapperEx">

	<update id="setAllNormal">
	  update invoice_bank_info
		set
			param1 = 'n',
			is_default = 0
		<where>

		</where>
	</update>

	<select id="findAll" resultMap="cn.superdesk.uniorder.dao.mapper.invoice.common.InvoiceBankInfoMapper.BaseResultMap">
		select
			<include refid="cn.superdesk.uniorder.dao.mapper.invoice.common.InvoiceBankInfoMapper.Base_Column_List"/>
		from
			invoice_bank_info
		<where>
			and 1 = 1
		<if test="invoiceBankInfoId != null and invoiceBankInfoId != '' ">
			and id = #{invoiceBankInfoId}
		</if>
		<if test="invoiceBankInfoIdNotIn != null and invoiceBankInfoIdNotIn != ''">
			and id not in
			<foreach collection="invoiceBankInfoIdNotIn" index="index" item="id" open="(" close=")" separator=",">
				#{id}
			</foreach>
		</if>
		<if test="companyName != null and companyName != '' ">
			and company_name like CONCAT('%',#{companyName},'%')
		</if>
		<if test="companyNameEq != null and companyNameEq != '' ">
			and company_name = #{companyNameEq}
		</if>

		<choose>
			<when test="enabled != null">
				and enabled = #{enabled,jdbcType=TINYINT}
			</when>
			<otherwise>
				<!-- and enabled = 1 -->
			</otherwise>
		</choose>
		<choose>
			<when test="deleted != null">
				and deleted = #{deleted,jdbcType=TINYINT}
			</when>
			<otherwise>
				<!-- and deleted = 0 -->
			</otherwise>
		</choose>

		<choose>
			<when test="orderBy != null and orderBy != '' ">
				order by ${orderBy}
			</when>
			<otherwise>
				order by is_default desc, create_time asc
			</otherwise>
		</choose>
		</where>
	</select>

</mapper>
