⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlmapaccountdao.java

📁 Spring的项目
💻 JAVA
字号:
/**
 * 
 */
package carNumber.dao.ibatis;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import carNumber.dao.AccountDao;
import carNumber.domain.Account;

import org.apache.log4j.*;
/**
 * @author xiaobin
 *
 */
public class SqlMapAccountDao extends SqlMapClientDaoSupport 
  implements AccountDao {

	Logger logger = Logger.getLogger(this.getClass());
	
	/* (non-Javadoc)
	 * @see carNumber.dao.AccountDao#getAccount(java.lang.String)
	 */
	public Account getAccount(String usernameStr) throws DataAccessException {
		// TODO Auto-generated method stub
		return (Account)getSqlMapClientTemplate().queryForObject("getAccountByUsername", usernameStr);
	}

	/* (non-Javadoc)
	 * @see carNumber.dao.AccountDao#getAccount(java.lang.String, java.lang.String)
	 */
	public Account getAccount(String usernameStr, String pwdStr)
			throws DataAccessException {
		// TODO Auto-generated method stub
		Account act = new Account();
		act.setUsername(usernameStr);
		act.setPassword(pwdStr);
		
		logger.info("run: " + "getAccount(String usernameStr, String pwdStr)");
		return (Account)getSqlMapClientTemplate().queryForObject("getAccountByUsernameAndPassword", act);
	}

	/* (non-Javadoc)
	 * @see carNumber.dao.AccountDao#getUsernameList()
	 */
	public List getUsernameList() throws DataAccessException {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("getUsernameList");
	}

	/* (non-Javadoc)
	 * @see carNumber.dao.AccountDao#insertAccount(carNumber.domain.Account)
	 */
	public void insertAccount(Account act) throws DataAccessException {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("insertAccount", act);
		getSqlMapClientTemplate().insert("insertProfile", act);
		getSqlMapClientTemplate().insert("insertSignon", act);
	}

	/* (non-Javadoc)
	 * @see carNumber.dao.AccountDao#updateAccount(carNumber.domain.Account)
	 */
	public void updateAccount(Account act) throws DataAccessException {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().update("updateAccount", act, 1);
		getSqlMapClientTemplate().update("updateProfile", act, 1);
		if(act.getPassword() != null && act.getPassword().length() > 0) {
			getSqlMapClientTemplate().update("updateSignon", act, 1);
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -