public BankAccountVO find(String accountId) { ArrayList<BankAccountPO> poList = bankaccountDataService.getAccount(); for (BankAccountPO po : poList) { if (po.getAccount().equals(accountId)) return new BankAccountVO(po.getName(), po.getMoney()); } return null; }
public ArrayList<BankAccountVO> showBankAccount(String subName) { ArrayList<BankAccountPO> poList = bankaccountDataService.getAccount(); ArrayList<BankAccountVO> voList = new ArrayList<BankAccountVO>(); for (int i = 0; i < poList.size(); i++) { BankAccountPO tempo = poList.get(i); String name = tempo.getName(); if (name.contains(subName)) { voList.add(new BankAccountVO(tempo.getAccount(), name, String.valueOf(tempo.getMoney()))); } } return voList; }
@Override public ArrayList<BankAccountVO> show() { ArrayList<BankAccountVO> result = new ArrayList<>(); ArrayList<BankAccountPO> get = null; try { get = dataService.getAllAccounts(); } catch (Exception e) { System.err.println("获取所有银行账户时出现异常:"); System.err.println(e.getMessage()); return result; } for (BankAccountPO po : get) { result.add((BankAccountVO) po.toVO()); } return result; }