accountdao.java
来自「演示ibatis的基本使用方法」· Java 代码 · 共 45 行
JAVA
45 行
package learndao.dao.sqlmapdao;
import learndao.bean.Account;
import learndao.config.DaoConfig;
import learndao.daoface.AccountDaoFace;
import com.ibatis.dao.client.DaoManager;
public class AccountDao extends BaseSqlMapDao implements AccountDaoFace {
public AccountDao(DaoManager daoManager) {
super(daoManager);
}
public Account getAccount(String username) {
return (Account) queryForObject("getAccountByUsername", username);
}
public Account getAccount(String username, String password) {
Account account = new Account();
account.setUsername(username);
account.setPassword(password);
return (Account) queryForObject("getAccountByUsernameAndPassword", account);
}
public void insertAccount(Account account) {
update("insertAccount", account);
update("insertProfile", account);
update("insertSignon", account);
}
public void updateAccount(Account account) {
update("updateAccount", account);
update("updateProfile", account);
if (account.getPassword() != null && account.getPassword().length() > 0) {
update("updateSignon", account);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?