汽车租赁管理系统/carRentalSystem/src/com/bluedot/persist/impl/OperatorStateManagerDaoImpl.java

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.bluedot.persist.impl;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;

import oracle.jdbc.driver.OracleTypes;

import com.bluedot.common.Constants;
import com.bluedot.common.JdbcUtil;
import com.bluedot.domain.Car;
import com.bluedot.domain.Customers;
import com.bluedot.domain.Page;
import com.bluedot.domain.Renttable;
import com.bluedot.domain.User;
import com.bluedot.exception.ApplicationException;
import com.bluedot.exception.DataAccessException;
import com.bluedot.persist.OperatorStateManagerDao;

public class OperatorStateManagerDaoImpl implements OperatorStateManagerDao {

	@Override
	public Page monthReturnCars(int pageIndex) {
		Connection conn = null;
		Page page  = new Page();
		List<Renttable> list = new ArrayList<Renttable>();
		try{
			conn = JdbcUtil.getConnection();
			CallableStatement cs = conn.prepareCall("Call page(?,?,?,?,?)");
			cs.setInt(1, pageIndex);
			cs.setString(2, this.generateSQL());
			cs.setInt(3, Constants.PAGE_NUMBER);
			cs.registerOutParameter(4, Types.INTEGER);
			cs.registerOutParameter(5, OracleTypes.CURSOR);
			cs.execute();
			ResultSet rs = (ResultSet)cs.getObject(5);
			while(rs.next()){
				Renttable rent = new Renttable();
				rent.setTableId(rs.getLong("tableid"));
				rent.setBeginDate(rs.getDate("begindate"));
				rent.setShouldReturnDate(rs.getDate("shouldreturndate"));
				rent.setRentFlag(rs.getInt("rentflag"));
				Customers c = new Customers();
				c.setIdentity(rs.getString("identity"));
				rent.setCust(c);
				Car car = new Car();
				car.setCarNumber(rs.getString("carnumber"));
				rent.setCar(car);
				User user = new User();
				user.setUserName(rs.getString("username"));
				rent.setUser(user);
				list.add(rent);
			}
			page.setCurrIndex(pageIndex);
			page.setTotalPage(cs.getInt(4));
后面还有 72 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。