<?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.hzya.frame.plugin.lets.dao.impl.BdBankdocDaoImpl">

    <resultMap id="get-BdBankdocEntity-result" type="com.hzya.frame.plugin.lets.entity.BdBankdocEntity" >
       <result property="address" column="address" jdbcType="VARCHAR"/>
           <result property="amcode" column="amcode" jdbcType="VARCHAR"/>
           <result property="bankdoccode" column="bankdoccode" jdbcType="VARCHAR"/>
           <result property="bankdocname" column="bankdocname" jdbcType="VARCHAR"/>
           <result property="city" column="city" jdbcType="VARCHAR"/>
           <result property="createtime" column="createtime" jdbcType="VARCHAR"/>
           <result property="creator" column="creator" jdbcType="VARCHAR"/>
           <result property="def1" column="def1" jdbcType="VARCHAR"/>
           <result property="def2" column="def2" jdbcType="VARCHAR"/>
           <result property="def3" column="def3" jdbcType="VARCHAR"/>
           <result property="def4" column="def4" jdbcType="VARCHAR"/>
           <result property="def5" column="def5" jdbcType="VARCHAR"/>
           <result property="dr" column="dr" jdbcType="INTEGER"/>
           <result property="iscustbank" column="iscustbank" jdbcType="VARCHAR"/>
           <result property="linkman1" column="linkman1" jdbcType="VARCHAR"/>
           <result property="linkman2" column="linkman2" jdbcType="VARCHAR"/>
           <result property="linkman3" column="linkman3" jdbcType="VARCHAR"/>
           <result property="modifier" column="modifier" jdbcType="VARCHAR"/>
           <result property="modifytime" column="modifytime" jdbcType="VARCHAR"/>
           <result property="pcombinename" column="pcombinename" jdbcType="VARCHAR"/>
           <result property="pcombinenum" column="pcombinenum" jdbcType="VARCHAR"/>
           <result property="phone1" column="phone1" jdbcType="VARCHAR"/>
           <result property="phone2" column="phone2" jdbcType="VARCHAR"/>
           <result property="phone3" column="phone3" jdbcType="VARCHAR"/>
           <result property="pkBankdoc" column="pk_bankdoc" jdbcType="VARCHAR"/>
           <result property="pkBanktype" column="pk_banktype" jdbcType="VARCHAR"/>
           <result property="pkCorp" column="pk_corp" jdbcType="VARCHAR"/>
           <result property="pkFatherbank" column="pk_fatherbank" jdbcType="VARCHAR"/>
           <result property="pkPcombine" column="pk_pcombine" jdbcType="VARCHAR"/>
           <result property="pkSettlecenter" column="pk_settlecenter" jdbcType="VARCHAR"/>
           <result property="province" column="province" jdbcType="VARCHAR"/>
           <result property="sealflag" column="sealflag" jdbcType="VARCHAR"/>
           <result property="shortname" column="shortname" jdbcType="VARCHAR"/>
           <result property="swiftnum" column="swiftnum" jdbcType="VARCHAR"/>
           <result property="ts" column="ts" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "BdBankdocEntity_Base_Column_List">
        address
       ,amcode 
        ,bankdoccode 
        ,bankdocname 
        ,city 
        ,createtime 
        ,creator 
        ,def1 
        ,def2 
        ,def3 
        ,def4 
        ,def5 
        ,dr 
        ,iscustbank 
        ,linkman1 
        ,linkman2 
        ,linkman3 
        ,modifier 
        ,modifytime 
        ,pcombinename 
        ,pcombinenum 
        ,phone1 
        ,phone2 
        ,phone3 
        ,pk_bankdoc 
        ,pk_banktype 
        ,pk_corp 
        ,pk_fatherbank 
        ,pk_pcombine 
        ,pk_settlecenter 
        ,province 
        ,sealflag 
        ,shortname 
        ,swiftnum 
        ,ts 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-BdBankdocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity">
    select
    <include refid="BdBankdocEntity_Base_Column_List" />
    from bd_bankdoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="address != null and address != ''"> and address = #{address} </if>
            <if test="amcode != null and amcode != ''"> and amcode = #{amcode} </if>
            <if test="bankdoccode != null and bankdoccode != ''"> and bankdoccode = #{bankdoccode} </if>
            <if test="bankdocname != null and bankdocname != ''"> and bankdocname = #{bankdocname} </if>
            <if test="city != null and city != ''"> and city = #{city} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="iscustbank != null and iscustbank != ''"> and iscustbank = #{iscustbank} </if>
            <if test="linkman1 != null and linkman1 != ''"> and linkman1 = #{linkman1} </if>
            <if test="linkman2 != null and linkman2 != ''"> and linkman2 = #{linkman2} </if>
            <if test="linkman3 != null and linkman3 != ''"> and linkman3 = #{linkman3} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="pcombinename != null and pcombinename != ''"> and pcombinename = #{pcombinename} </if>
            <if test="pcombinenum != null and pcombinenum != ''"> and pcombinenum = #{pcombinenum} </if>
            <if test="phone1 != null and phone1 != ''"> and phone1 = #{phone1} </if>
            <if test="phone2 != null and phone2 != ''"> and phone2 = #{phone2} </if>
            <if test="phone3 != null and phone3 != ''"> and phone3 = #{phone3} </if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> and pk_bankdoc = #{pkBankdoc} </if>
            <if test="pkBanktype != null and pkBanktype != ''"> and pk_banktype = #{pkBanktype} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> and pk_fatherbank = #{pkFatherbank} </if>
            <if test="pkPcombine != null and pkPcombine != ''"> and pk_pcombine = #{pkPcombine} </if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> and pk_settlecenter = #{pkSettlecenter} </if>
            <if test="province != null and province != ''"> and province = #{province} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="shortname != null and shortname != ''"> and shortname = #{shortname} </if>
            <if test="swiftnum != null and swiftnum != ''"> and swiftnum = #{swiftnum} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
--             and sts='Y'
    </trim>
<!--    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity">
        select  count(1)   from bd_bankdoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="address != null and address != ''"> and address = #{address} </if>
            <if test="amcode != null and amcode != ''"> and amcode = #{amcode} </if>
            <if test="bankdoccode != null and bankdoccode != ''"> and bankdoccode = #{bankdoccode} </if>
            <if test="bankdocname != null and bankdocname != ''"> and bankdocname = #{bankdocname} </if>
            <if test="city != null and city != ''"> and city = #{city} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="iscustbank != null and iscustbank != ''"> and iscustbank = #{iscustbank} </if>
            <if test="linkman1 != null and linkman1 != ''"> and linkman1 = #{linkman1} </if>
            <if test="linkman2 != null and linkman2 != ''"> and linkman2 = #{linkman2} </if>
            <if test="linkman3 != null and linkman3 != ''"> and linkman3 = #{linkman3} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="pcombinename != null and pcombinename != ''"> and pcombinename = #{pcombinename} </if>
            <if test="pcombinenum != null and pcombinenum != ''"> and pcombinenum = #{pcombinenum} </if>
            <if test="phone1 != null and phone1 != ''"> and phone1 = #{phone1} </if>
            <if test="phone2 != null and phone2 != ''"> and phone2 = #{phone2} </if>
            <if test="phone3 != null and phone3 != ''"> and phone3 = #{phone3} </if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> and pk_bankdoc = #{pkBankdoc} </if>
            <if test="pkBanktype != null and pkBanktype != ''"> and pk_banktype = #{pkBanktype} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> and pk_fatherbank = #{pkFatherbank} </if>
            <if test="pkPcombine != null and pkPcombine != ''"> and pk_pcombine = #{pkPcombine} </if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> and pk_settlecenter = #{pkSettlecenter} </if>
            <if test="province != null and province != ''"> and province = #{province} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="shortname != null and shortname != ''"> and shortname = #{shortname} </if>
            <if test="swiftnum != null and swiftnum != ''"> and swiftnum = #{swiftnum} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-BdBankdocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity">
    select
    <include refid="BdBankdocEntity_Base_Column_List" />
    from bd_bankdoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="address != null and address != ''"> and address like concat('%',#{address},'%') </if>
            <if test="amcode != null and amcode != ''"> and amcode like concat('%',#{amcode},'%') </if>
            <if test="bankdoccode != null and bankdoccode != ''"> and bankdoccode like concat('%',#{bankdoccode},'%') </if>
            <if test="bankdocname != null and bankdocname != ''"> and bankdocname like concat('%',#{bankdocname},'%') </if>
            <if test="city != null and city != ''"> and city like concat('%',#{city},'%') </if>
            <if test="createtime != null and createtime != ''"> and createtime like concat('%',#{createtime},'%') </if>
            <if test="creator != null and creator != ''"> and creator like concat('%',#{creator},'%') </if>
            <if test="def1 != null and def1 != ''"> and def1 like concat('%',#{def1},'%') </if>
            <if test="def2 != null and def2 != ''"> and def2 like concat('%',#{def2},'%') </if>
            <if test="def3 != null and def3 != ''"> and def3 like concat('%',#{def3},'%') </if>
            <if test="def4 != null and def4 != ''"> and def4 like concat('%',#{def4},'%') </if>
            <if test="def5 != null and def5 != ''"> and def5 like concat('%',#{def5},'%') </if>
            <if test="dr != null"> and dr like concat('%',#{dr},'%') </if>
            <if test="iscustbank != null and iscustbank != ''"> and iscustbank like concat('%',#{iscustbank},'%') </if>
            <if test="linkman1 != null and linkman1 != ''"> and linkman1 like concat('%',#{linkman1},'%') </if>
            <if test="linkman2 != null and linkman2 != ''"> and linkman2 like concat('%',#{linkman2},'%') </if>
            <if test="linkman3 != null and linkman3 != ''"> and linkman3 like concat('%',#{linkman3},'%') </if>
            <if test="modifier != null and modifier != ''"> and modifier like concat('%',#{modifier},'%') </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime like concat('%',#{modifytime},'%') </if>
            <if test="pcombinename != null and pcombinename != ''"> and pcombinename like concat('%',#{pcombinename},'%') </if>
            <if test="pcombinenum != null and pcombinenum != ''"> and pcombinenum like concat('%',#{pcombinenum},'%') </if>
            <if test="phone1 != null and phone1 != ''"> and phone1 like concat('%',#{phone1},'%') </if>
            <if test="phone2 != null and phone2 != ''"> and phone2 like concat('%',#{phone2},'%') </if>
            <if test="phone3 != null and phone3 != ''"> and phone3 like concat('%',#{phone3},'%') </if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> and pk_bankdoc like concat('%',#{pkBankdoc},'%') </if>
            <if test="pkBanktype != null and pkBanktype != ''"> and pk_banktype like concat('%',#{pkBanktype},'%') </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp like concat('%',#{pkCorp},'%') </if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> and pk_fatherbank like concat('%',#{pkFatherbank},'%') </if>
            <if test="pkPcombine != null and pkPcombine != ''"> and pk_pcombine like concat('%',#{pkPcombine},'%') </if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> and pk_settlecenter like concat('%',#{pkSettlecenter},'%') </if>
            <if test="province != null and province != ''"> and province like concat('%',#{province},'%') </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag like concat('%',#{sealflag},'%') </if>
            <if test="shortname != null and shortname != ''"> and shortname like concat('%',#{shortname},'%') </if>
            <if test="swiftnum != null and swiftnum != ''"> and swiftnum like concat('%',#{swiftnum},'%') </if>
            <if test="ts != null and ts != ''"> and ts like concat('%',#{ts},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="BdBankdocentity_list_or" resultMap="get-BdBankdocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity">
    select
    <include refid="BdBankdocEntity_Base_Column_List" />
    from bd_bankdoc
    <trim prefix="where" prefixOverrides="and"> 
         <if test="address != null and address != ''"> or address = #{address} </if>
             <if test="amcode != null and amcode != ''"> or amcode = #{amcode} </if>
             <if test="bankdoccode != null and bankdoccode != ''"> or bankdoccode = #{bankdoccode} </if>
             <if test="bankdocname != null and bankdocname != ''"> or bankdocname = #{bankdocname} </if>
             <if test="city != null and city != ''"> or city = #{city} </if>
             <if test="createtime != null and createtime != ''"> or createtime = #{createtime} </if>
             <if test="creator != null and creator != ''"> or creator = #{creator} </if>
             <if test="def1 != null and def1 != ''"> or def1 = #{def1} </if>
             <if test="def2 != null and def2 != ''"> or def2 = #{def2} </if>
             <if test="def3 != null and def3 != ''"> or def3 = #{def3} </if>
             <if test="def4 != null and def4 != ''"> or def4 = #{def4} </if>
             <if test="def5 != null and def5 != ''"> or def5 = #{def5} </if>
             <if test="dr != null"> or dr = #{dr} </if>
             <if test="iscustbank != null and iscustbank != ''"> or iscustbank = #{iscustbank} </if>
             <if test="linkman1 != null and linkman1 != ''"> or linkman1 = #{linkman1} </if>
             <if test="linkman2 != null and linkman2 != ''"> or linkman2 = #{linkman2} </if>
             <if test="linkman3 != null and linkman3 != ''"> or linkman3 = #{linkman3} </if>
             <if test="modifier != null and modifier != ''"> or modifier = #{modifier} </if>
             <if test="modifytime != null and modifytime != ''"> or modifytime = #{modifytime} </if>
             <if test="pcombinename != null and pcombinename != ''"> or pcombinename = #{pcombinename} </if>
             <if test="pcombinenum != null and pcombinenum != ''"> or pcombinenum = #{pcombinenum} </if>
             <if test="phone1 != null and phone1 != ''"> or phone1 = #{phone1} </if>
             <if test="phone2 != null and phone2 != ''"> or phone2 = #{phone2} </if>
             <if test="phone3 != null and phone3 != ''"> or phone3 = #{phone3} </if>
             <if test="pkBankdoc != null and pkBankdoc != ''"> or pk_bankdoc = #{pkBankdoc} </if>
             <if test="pkBanktype != null and pkBanktype != ''"> or pk_banktype = #{pkBanktype} </if>
             <if test="pkCorp != null and pkCorp != ''"> or pk_corp = #{pkCorp} </if>
             <if test="pkFatherbank != null and pkFatherbank != ''"> or pk_fatherbank = #{pkFatherbank} </if>
             <if test="pkPcombine != null and pkPcombine != ''"> or pk_pcombine = #{pkPcombine} </if>
             <if test="pkSettlecenter != null and pkSettlecenter != ''"> or pk_settlecenter = #{pkSettlecenter} </if>
             <if test="province != null and province != ''"> or province = #{province} </if>
             <if test="sealflag != null and sealflag != ''"> or sealflag = #{sealflag} </if>
             <if test="shortname != null and shortname != ''"> or shortname = #{shortname} </if>
             <if test="swiftnum != null and swiftnum != ''"> or swiftnum = #{swiftnum} </if>
             <if test="ts != null and ts != ''"> or ts = #{ts} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity" keyProperty="pkBankdoc" useGeneratedKeys="true">
    insert into bd_bankdoc(
  <trim suffix="" suffixOverrides=",">
       <if test="address != null and address != ''"> address , </if>
            <if test="amcode != null and amcode != ''"> amcode , </if>
            <if test="bankdoccode != null and bankdoccode != ''"> bankdoccode , </if>
            <if test="bankdocname != null and bankdocname != ''"> bankdocname , </if>
            <if test="city != null and city != ''"> city , </if>
            <if test="createtime != null and createtime != ''"> createtime , </if>
            <if test="creator != null and creator != ''"> creator , </if>
            <if test="def1 != null and def1 != ''"> def1 , </if>
            <if test="def2 != null and def2 != ''"> def2 , </if>
            <if test="def3 != null and def3 != ''"> def3 , </if>
            <if test="def4 != null and def4 != ''"> def4 , </if>
            <if test="def5 != null and def5 != ''"> def5 , </if>
            <if test="dr != null"> dr , </if>
            <if test="iscustbank != null and iscustbank != ''"> iscustbank , </if>
            <if test="linkman1 != null and linkman1 != ''"> linkman1 , </if>
            <if test="linkman2 != null and linkman2 != ''"> linkman2 , </if>
            <if test="linkman3 != null and linkman3 != ''"> linkman3 , </if>
            <if test="modifier != null and modifier != ''"> modifier , </if>
            <if test="modifytime != null and modifytime != ''"> modifytime , </if>
            <if test="pcombinename != null and pcombinename != ''"> pcombinename , </if>
            <if test="pcombinenum != null and pcombinenum != ''"> pcombinenum , </if>
            <if test="phone1 != null and phone1 != ''"> phone1 , </if>
            <if test="phone2 != null and phone2 != ''"> phone2 , </if>
            <if test="phone3 != null and phone3 != ''"> phone3 , </if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> pk_bankdoc , </if>
            <if test="pkBanktype != null and pkBanktype != ''"> pk_banktype , </if>
            <if test="pkCorp != null and pkCorp != ''"> pk_corp , </if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> pk_fatherbank , </if>
            <if test="pkPcombine != null and pkPcombine != ''"> pk_pcombine , </if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> pk_settlecenter , </if>
            <if test="province != null and province != ''"> province , </if>
            <if test="sealflag != null and sealflag != ''"> sealflag , </if>
            <if test="shortname != null and shortname != ''"> shortname , </if>
            <if test="swiftnum != null and swiftnum != ''"> swiftnum , </if>
            <if test="ts != null and ts != ''"> ts , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="address != null and address != ''"> #{address} ,</if>
            <if test="amcode != null and amcode != ''"> #{amcode} ,</if>
            <if test="bankdoccode != null and bankdoccode != ''"> #{bankdoccode} ,</if>
            <if test="bankdocname != null and bankdocname != ''"> #{bankdocname} ,</if>
            <if test="city != null and city != ''"> #{city} ,</if>
            <if test="createtime != null and createtime != ''"> #{createtime} ,</if>
            <if test="creator != null and creator != ''"> #{creator} ,</if>
            <if test="def1 != null and def1 != ''"> #{def1} ,</if>
            <if test="def2 != null and def2 != ''"> #{def2} ,</if>
            <if test="def3 != null and def3 != ''"> #{def3} ,</if>
            <if test="def4 != null and def4 != ''"> #{def4} ,</if>
            <if test="def5 != null and def5 != ''"> #{def5} ,</if>
            <if test="dr != null"> #{dr} ,</if>
            <if test="iscustbank != null and iscustbank != ''"> #{iscustbank} ,</if>
            <if test="linkman1 != null and linkman1 != ''"> #{linkman1} ,</if>
            <if test="linkman2 != null and linkman2 != ''"> #{linkman2} ,</if>
            <if test="linkman3 != null and linkman3 != ''"> #{linkman3} ,</if>
            <if test="modifier != null and modifier != ''"> #{modifier} ,</if>
            <if test="modifytime != null and modifytime != ''"> #{modifytime} ,</if>
            <if test="pcombinename != null and pcombinename != ''"> #{pcombinename} ,</if>
            <if test="pcombinenum != null and pcombinenum != ''"> #{pcombinenum} ,</if>
            <if test="phone1 != null and phone1 != ''"> #{phone1} ,</if>
            <if test="phone2 != null and phone2 != ''"> #{phone2} ,</if>
            <if test="phone3 != null and phone3 != ''"> #{phone3} ,</if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> #{pkBankdoc} ,</if>
            <if test="pkBanktype != null and pkBanktype != ''"> #{pkBanktype} ,</if>
            <if test="pkCorp != null and pkCorp != ''"> #{pkCorp} ,</if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> #{pkFatherbank} ,</if>
            <if test="pkPcombine != null and pkPcombine != ''"> #{pkPcombine} ,</if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> #{pkSettlecenter} ,</if>
            <if test="province != null and province != ''"> #{province} ,</if>
            <if test="sealflag != null and sealflag != ''"> #{sealflag} ,</if>
            <if test="shortname != null and shortname != ''"> #{shortname} ,</if>
            <if test="swiftnum != null and swiftnum != ''"> #{swiftnum} ,</if>
            <if test="ts != null and ts != ''"> #{ts} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from bd_bankdoc a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="pkBankdoc" useGeneratedKeys="true">
  insert into bd_bankdoc(address, amcode, bankdoccode, bankdocname, city, createtime, creator, def1, def2, def3, def4, def5, dr, iscustbank, linkman1, linkman2, linkman3, modifier, modifytime, pcombinename, pcombinenum, phone1, phone2, phone3, pk_banktype, pk_corp, pk_fatherbank, pk_pcombine, pk_settlecenter, province, sealflag, shortname, swiftnum, ts,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.address},#{entity.amcode},#{entity.bankdoccode},#{entity.bankdocname},#{entity.city},#{entity.createtime},#{entity.creator},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.dr},#{entity.iscustbank},#{entity.linkman1},#{entity.linkman2},#{entity.linkman3},#{entity.modifier},#{entity.modifytime},#{entity.pcombinename},#{entity.pcombinenum},#{entity.phone1},#{entity.phone2},#{entity.phone3},#{entity.pkBanktype},#{entity.pkCorp},#{entity.pkFatherbank},#{entity.pkPcombine},#{entity.pkSettlecenter},#{entity.province},#{entity.sealflag},#{entity.shortname},#{entity.swiftnum},#{entity.ts}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="pkBankdoc" useGeneratedKeys="true">
    insert into bd_bankdoc(address, amcode, bankdoccode, bankdocname, city, createtime, creator, def1, def2, def3, def4, def5, dr, iscustbank, linkman1, linkman2, linkman3, modifier, modifytime, pcombinename, pcombinenum, phone1, phone2, phone3, pk_banktype, pk_corp, pk_fatherbank, pk_pcombine, pk_settlecenter, province, sealflag, shortname, swiftnum, ts)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.address},#{entity.amcode},#{entity.bankdoccode},#{entity.bankdocname},#{entity.city},#{entity.createtime},#{entity.creator},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.dr},#{entity.iscustbank},#{entity.linkman1},#{entity.linkman2},#{entity.linkman3},#{entity.modifier},#{entity.modifytime},#{entity.pcombinename},#{entity.pcombinenum},#{entity.phone1},#{entity.phone2},#{entity.phone3},#{entity.pkBanktype},#{entity.pkCorp},#{entity.pkFatherbank},#{entity.pkPcombine},#{entity.pkSettlecenter},#{entity.province},#{entity.sealflag},#{entity.shortname},#{entity.swiftnum},#{entity.ts})
    </foreach>
    on duplicate key update
    address = values(address),
    amcode = values(amcode),
    bankdoccode = values(bankdoccode),
    bankdocname = values(bankdocname),
    city = values(city),
    createtime = values(createtime),
    creator = values(creator),
    def1 = values(def1),
    def2 = values(def2),
    def3 = values(def3),
    def4 = values(def4),
    def5 = values(def5),
    dr = values(dr),
    iscustbank = values(iscustbank),
    linkman1 = values(linkman1),
    linkman2 = values(linkman2),
    linkman3 = values(linkman3),
    modifier = values(modifier),
    modifytime = values(modifytime),
    pcombinename = values(pcombinename),
    pcombinenum = values(pcombinenum),
    phone1 = values(phone1),
    phone2 = values(phone2),
    phone3 = values(phone3),
    pk_banktype = values(pk_banktype),
    pk_corp = values(pk_corp),
    pk_fatherbank = values(pk_fatherbank),
    pk_pcombine = values(pk_pcombine),
    pk_settlecenter = values(pk_settlecenter),
    province = values(province),
    sealflag = values(sealflag),
    shortname = values(shortname),
    swiftnum = values(swiftnum),
    ts = values(ts)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity" >
update bd_bankdoc  set
<trim suffix="" suffixOverrides=",">
  <if test="address != null and address != ''"> address = #{address},</if>
  <if test="amcode != null and amcode != ''"> amcode = #{amcode},</if>
  <if test="bankdoccode != null and bankdoccode != ''"> bankdoccode = #{bankdoccode},</if>
  <if test="bankdocname != null and bankdocname != ''"> bankdocname = #{bankdocname},</if>
  <if test="city != null and city != ''"> city = #{city},</if>
  <if test="createtime != null and createtime != ''"> createtime = #{createtime},</if>
  <if test="creator != null and creator != ''"> creator = #{creator},</if>
  <if test="def1 != null and def1 != ''"> def1 = #{def1},</if>
  <if test="def2 != null and def2 != ''"> def2 = #{def2},</if>
  <if test="def3 != null and def3 != ''"> def3 = #{def3},</if>
  <if test="def4 != null and def4 != ''"> def4 = #{def4},</if>
  <if test="def5 != null and def5 != ''"> def5 = #{def5},</if>
  <if test="dr != null"> dr = #{dr},</if>
  <if test="iscustbank != null and iscustbank != ''"> iscustbank = #{iscustbank},</if>
  <if test="linkman1 != null and linkman1 != ''"> linkman1 = #{linkman1},</if>
  <if test="linkman2 != null and linkman2 != ''"> linkman2 = #{linkman2},</if>
  <if test="linkman3 != null and linkman3 != ''"> linkman3 = #{linkman3},</if>
  <if test="modifier != null and modifier != ''"> modifier = #{modifier},</if>
  <if test="modifytime != null and modifytime != ''"> modifytime = #{modifytime},</if>
  <if test="pcombinename != null and pcombinename != ''"> pcombinename = #{pcombinename},</if>
  <if test="pcombinenum != null and pcombinenum != ''"> pcombinenum = #{pcombinenum},</if>
  <if test="phone1 != null and phone1 != ''"> phone1 = #{phone1},</if>
  <if test="phone2 != null and phone2 != ''"> phone2 = #{phone2},</if>
  <if test="phone3 != null and phone3 != ''"> phone3 = #{phone3},</if>
  <if test="pkBanktype != null and pkBanktype != ''"> pk_banktype = #{pkBanktype},</if>
  <if test="pkCorp != null and pkCorp != ''"> pk_corp = #{pkCorp},</if>
  <if test="pkFatherbank != null and pkFatherbank != ''"> pk_fatherbank = #{pkFatherbank},</if>
  <if test="pkPcombine != null and pkPcombine != ''"> pk_pcombine = #{pkPcombine},</if>
  <if test="pkSettlecenter != null and pkSettlecenter != ''"> pk_settlecenter = #{pkSettlecenter},</if>
  <if test="province != null and province != ''"> province = #{province},</if>
  <if test="sealflag != null and sealflag != ''"> sealflag = #{sealflag},</if>
  <if test="shortname != null and shortname != ''"> shortname = #{shortname},</if>
  <if test="swiftnum != null and swiftnum != ''"> swiftnum = #{swiftnum},</if>
  <if test="ts != null and ts != ''"> ts = #{ts},</if>
</trim>
where pk_bankdoc = #{pkBankdoc}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity" >
update bd_bankdoc  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where pk_bankdoc = #{pkBankdoc}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.BdBankdocEntity" >
update bd_bankdoc  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="address != null and address != ''"> and address = #{address} </if>
            <if test="amcode != null and amcode != ''"> and amcode = #{amcode} </if>
            <if test="bankdoccode != null and bankdoccode != ''"> and bankdoccode = #{bankdoccode} </if>
            <if test="bankdocname != null and bankdocname != ''"> and bankdocname = #{bankdocname} </if>
            <if test="city != null and city != ''"> and city = #{city} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="iscustbank != null and iscustbank != ''"> and iscustbank = #{iscustbank} </if>
            <if test="linkman1 != null and linkman1 != ''"> and linkman1 = #{linkman1} </if>
            <if test="linkman2 != null and linkman2 != ''"> and linkman2 = #{linkman2} </if>
            <if test="linkman3 != null and linkman3 != ''"> and linkman3 = #{linkman3} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="pcombinename != null and pcombinename != ''"> and pcombinename = #{pcombinename} </if>
            <if test="pcombinenum != null and pcombinenum != ''"> and pcombinenum = #{pcombinenum} </if>
            <if test="phone1 != null and phone1 != ''"> and phone1 = #{phone1} </if>
            <if test="phone2 != null and phone2 != ''"> and phone2 = #{phone2} </if>
            <if test="phone3 != null and phone3 != ''"> and phone3 = #{phone3} </if>
            <if test="pkBankdoc != null and pkBankdoc != ''"> and pk_bankdoc = #{pkBankdoc} </if>
            <if test="pkBanktype != null and pkBanktype != ''"> and pk_banktype = #{pkBanktype} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkFatherbank != null and pkFatherbank != ''"> and pk_fatherbank = #{pkFatherbank} </if>
            <if test="pkPcombine != null and pkPcombine != ''"> and pk_pcombine = #{pkPcombine} </if>
            <if test="pkSettlecenter != null and pkSettlecenter != ''"> and pk_settlecenter = #{pkSettlecenter} </if>
            <if test="province != null and province != ''"> and province = #{province} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="shortname != null and shortname != ''"> and shortname = #{shortname} </if>
            <if test="swiftnum != null and swiftnum != ''"> and swiftnum = #{swiftnum} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from bd_bankdoc where pk_bankdoc = #{pkBankdoc}
</delete>

</mapper>

