📄 statementsearchdao.java
字号:
package com.ebusiness.ebank.dao;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */import java.sql.SQLException;import java.sql.ResultSet;import org.apache.log4j.Logger;import org.apache.log4j.MDC;import com.ebusiness.ebank.criteria.SearchCriteria;import com.ebusiness.ebank.criteria.StatementSearchCriteria;import com.ebusiness.ebank.bean.StatementValue;import com.ebusiness.ebank.bean.ValueList;import com.ebusiness.ebank.exception.SystemException;import com.ebusiness.ebank.exception.BusinessException;import com.ebusiness.ebank.exception.ErrorMessages;import com.ebusiness.ebank.util.Constants;public class StatementSearchDAO extends FastLaneSearchDAO{ private Logger log = Logger.getLogger(this.getClass()); public ValueList search(SearchCriteria criteria) throws SystemException, BusinessException { ValueList vList = new ValueList(); StatementSearchCriteria sCriteria = (StatementSearchCriteria)criteria; String sql = "SELECT * FROM statement WHERE account_no = ? AND banking_date > sysdate - 30 * ? ORDER BY banking_date DESC"; try { this.setConnection(); ps = con.prepareStatement(sql); ps.setString(1, sCriteria.getAccountNo()); ps.setInt(2, sCriteria.getMonthsWithin()); rs = ps.executeQuery(); StatementValue sValue; while(rs.next()) { sValue = getResultSetValues(rs); vList.addValue(sValue); } } catch (SQLException se) { MDC.put(Constants.USER_ID, profile.getUserID()); log.error(ErrorMessages.OTHER_DATABASE_ERROR, se); throw new SystemException(se); } finally { this.close(); } return vList; } private StatementValue getResultSetValues(ResultSet rs) throws SQLException { StatementValue sValue = new StatementValue(); sValue.setObjectID(rs.getLong("object_id")); sValue.setBankingDate(rs.getTimestamp("banking_date")); sValue.setDescription(rs.getString("description")); sValue.setWithdrawal(rs.getDouble("withdrawal")); sValue.setDeposit(rs.getDouble("deposit")); sValue.setBalance(rs.getDouble("balance")); sValue.setAccountNo(rs.getString("account_no")); sValue.setClientCardNo(rs.getString("clientcard_no")); sValue.setCreateUserID(rs.getString("create_userid")); sValue.setCreateDate(rs.getTimestamp("create_Date")); return sValue; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -