package dao;
import java.util.ArrayList;
import java.util.List;
import entity.Account;
public class AccountDao {
private List<Account> accountList;
private static AccountDao accountDao;
public static AccountDao instance() {
if (accountDao == null) {
accountDao = new AccountDao();
}
return accountDao;
}
public List<Account> getAccountList() {
return accountList;
}
private AccountDao() {
accountList = new ArrayList<Account>();
accountList.add(new Account("admin", "admin"));
}
public boolean check(String userName, String password) {
for (Account account : accountList) {
if (account.getUserName().equals(userName)
&& account.getPassword().equals(password)) {
return true;
}
}
return false;
}
public Object[][] getUserList() {
Object[][] result = new Object[accountList.size()][2];
Account account;
for (int i = 0; i < accountList.size(); i++) {
account = accountList.get(i);
result[i][0] = account.getUserName();
result[i][1] = account.getPassword();
}
return result;
}
public void addUser(String userName, String password) {
accountList.add(new Account(userName, password));
}
}
最近下载更多
lsglsg9 LV23
2023年12月29日
wuying8208 LV15
2023年1月1日
微信网友_6191697646571520 LV6
2022年10月28日
TheMostCodeUser_52 LV1
2022年10月2日
308711800 LV4
2022年6月21日
3078179739 LV2
2022年6月18日
root111snkdnc LV3
2022年6月17日
wanglinddad LV55
2022年5月5日
GaryYoung LV5
2022年1月11日
2518029339 LV1
2021年12月21日

最近浏览