<?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.hzs.member.account.mapper.CuMemberBankMapper">

    <update id="batchUpdateBankBypkMembers">
        update cu_member_bank b
        set b.del_flag = 1, b.modified_time = sysdate, b.pk_modified = #{updatePkMember}
        where b.pk_member in
        <foreach collection="businessMemberList" item="item" open="(" close=")" separator=",">
            #{item.pkMember}
        </foreach>
    </update>

    <select id="selectBankCardByPkMember" resultType="com.hzs.common.domain.member.account.CuMemberBankExt">
        select mb.pk_id         pkId,
               mb.card_number   cardNumber,
               mb.default_card  defaultCard,
               b.pk_transaction pkBank,
               b.background_img backgroundImg,
               b.bank_name      bankName,
               b.logo
        from cu_member_bank mb
                 left join bd_bank b
                           on mb.pk_bank = b.pk_id
                               and b.del_flag = 0
                               and b.enable_state = 0
        where mb.del_flag = 0
          and mb.pk_country = #{pkCountry}
          and mb.pk_member = #{pkMember}
        order by mb.default_card desc
    </select>

</mapper>
