package model

import (
	"fmt"
	"mtp20_assisted/global"
)

// GetByUserID 通过UserID获取信息
func (t *Bankaccountsign) GetByUserID(userID uint64) (has bool, err error) {
	sql := fmt.Sprintf(`
	select 
		t.*
	from BANK_ACCOUNTSIGN t
	where t.ACCOUNTCODE in 
		(select to_char(a.accountid) from taaccount a where a.RELATEDUSERID = %v)
	`, userID)
	return global.M2A_DB.SQL(sql).Get(t)
}

// Get 通过银行ID获取信息
func (t *Bankbankinfo) Get() (has bool, err error) {
	return global.M2A_DB.Where("BANKID = ?", t.BANKID).Get(t)
}
