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

📄 userinfotooracle.java

📁 一个简单的汽车租赁系统 jsp+struts+oracle
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
				}
				return customer;
				
				
			}
			//更新renttable_
			public void updateRentTable(RentTable renttable) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement = connection.prepareStatement("update renttable set  TABLEID=?, IMPREST=?, SHOULDPAYPRICE=?, PRICE=?, BEGINDATE=?, SHOULDRETURNDATE=?, RENTFLAG=?, CUSTID=?, CARID=?, USERID=? where TABLEID='"+renttable.getTableid()+"'");
					preparedStatement.setString(1, renttable.getTableid());
					preparedStatement.setInt(2, renttable.getImprest());
					preparedStatement.setInt(3,renttable.getShouldpayprice ());
					preparedStatement.setInt(4,renttable.getPrice());
					preparedStatement.setDate(5,new java.sql.Date(renttable.getBegindate().getTime()));
					preparedStatement.setDate(6, new java.sql.Date(renttable.getShouldreturn().getTime()));
					preparedStatement.setString(7,renttable.getRentflag());
					preparedStatement.setString(8,renttable.getCustid());
					preparedStatement.setString(9,renttable.getCarid());
					preparedStatement.setInt(10,renttable.getUserid());
					preparedStatement.execute();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
			}
			//更新车查询汽车里的修改
			public void updateCar(Car car) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement = connection.prepareStatement("update cars set  CARID=?,CARTYPE=?,COLOR=?,PRICE=?,RENTPRICE=?,DEPOSIT=?,ISRENTING=?,DESCRIPTION=? where CARID='"+car.getCarid()+"'");
					preparedStatement.setString(1, car.getCarid());
					preparedStatement.setString(2, car.getCartype());

					preparedStatement.setString(3,car.getCarlor());
					preparedStatement.setInt(4,car.getPrice());
					preparedStatement.setInt(5, car.getRentprice());
					preparedStatement.setInt(6, car.getDeposit());
					preparedStatement.setString(7,car.getIsrenting());
					preparedStatement.setString(8,car.getDescription());
					preparedStatement.execute();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
			}
			//更新出租后的汽车出租状态
			public void updateCars(String carid) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement;
					String sql = "update cars set ISRENTING=? where carid='"+carid+"'";
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1,"1");
					ResultSet resultSet = preparedStatement.executeQuery();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
			}
			//更新验收检查后汽车出租状态
			public void updateCarss(String carid) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement = connection.prepareStatement("update cars set  ISRENTING=? where carid='"+carid+"'");
					
					preparedStatement.setString(1,"0");
					preparedStatement.execute();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
			}
			//删除
			public void delete(String userName) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					String sql = "delete from users where USERNAME=?";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, userName);
					ResultSet resultSet = preparedStatement.executeQuery();
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
			}
			//查询密码
			public Customer searchCustomerPwd(String identity) {
				Connection connection = null;
				Customer customer = new Customer();
				try {
					connection=JdbcUtil.getInstance().getConn();
					
					String sql = "select * from customers where IDENTITY=?";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, identity);
					ResultSet resultSet = preparedStatement.executeQuery();
					
					if(resultSet.next() ){
						customer.setCustpwd(resultSet.getString("CUSTPWD"));
					}
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
				return customer;
			}
			//更新密码
			public void updateCustomerPwd(String newpwd,String identity) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					String sql = "update customers set CUSTPWD=? where IDENTITY='"+identity+"'";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, newpwd);
					ResultSet resultSet = preparedStatement.executeQuery();
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
				
			}
			//删除客户
			
			public void deleteCustomer(String identity) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					String sql = "delete from customers where IDENTITY=?";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, identity);
					ResultSet resultSet = preparedStatement.executeQuery();
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
			}
			//删除车汽车管理里的删掉功能
			
			public void deleteCar(String carid) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					String sql = "delete from cars where CARID=?";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, carid);
					ResultSet resultSet = preparedStatement.executeQuery();
					resultSet.close();
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
			}
			
			//加车
			public void  addCar(Car car) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement = connection.prepareStatement("insert into cars(CARID,CARTYPE,COLOR,PRICE,RENTPRICE,DEPOSIT,ISRENTING,DESCRIPTION )values(?,?,?,?,?,?,?,?)");
					preparedStatement.setString(1, car.getCarid());
					preparedStatement.setString(2, car.getCartype());
					preparedStatement.setString(3, car.getCarlor());
					preparedStatement.setInt(4, car.getPrice());
					preparedStatement.setInt(5,car.getRentprice());
					preparedStatement.setInt(6, car.getDeposit());
					preparedStatement.setString(7, car.getIsrenting());
					preparedStatement.setString(8, car.getDescription());
					preparedStatement.execute();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
		}
			//查车
			public Car searchCar(String carid) {
				Connection connection = null;
				Car car = new Car();
				try {
					connection=JdbcUtil.getInstance().getConn();
					
					String sql = "select * from cars where CARID=?";
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					preparedStatement.setString(1, carid);
					ResultSet resultSet = preparedStatement.executeQuery();
					
					if(resultSet.next() ){
						car.setCarid(resultSet.getString("CARID"));
					}
					connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}
				return car;
			}
			//加出租单
			public void  addRentTable(RentTable renttable) {
				Connection connection = null;
				try {
					connection=JdbcUtil.getInstance().getConn();
					PreparedStatement preparedStatement = connection.prepareStatement("insert into renttable(TABLEID,IMPREST,SHOULDPAYPRICE,PRICE,BEGINDATE,SHOULDRETURNDATE,RENTFLAG,CUSTID,CARID,USERID,IDENTITY )values(?,?,?,?,?,?,?,?,?,?,?)");
					preparedStatement.setString(1, renttable.getTableid());
					preparedStatement.setInt(2, renttable.getImprest());
					preparedStatement.setInt(3, renttable.getShouldpayprice());
					preparedStatement.setInt(4, renttable.getPrice());
					preparedStatement.setDate(5, new java.sql.Date(renttable.getBegindate().getTime()));
					preparedStatement.setDate(6,new java.sql.Date(renttable.getShouldreturn().getTime()));
					preparedStatement.setString(7, renttable.getRentflag());
					preparedStatement.setString(8, renttable.getCustid());
					preparedStatement.setString(9, renttable.getCarid());
					preparedStatement.setInt(10, renttable.getUserid());
					preparedStatement.setString(11, renttable.getIdtentity());
					
					preparedStatement.execute();
					preparedStatement.close();
				    connection.close();
				} catch (SQLException e) {
					throw new RuntimeException(e);
				}	
		}
			
			//加客户
			public List<Customer> searchCustomer(Customer customer){
				Connection connection = null;
				
				List<Customer> customerlist = new ArrayList<Customer>();
				try {
					connection=JdbcUtil.getInstance().getConn();
					PageUserInfoDao pud = new PageUserInfoDao();
					String sql = pud.genSQLCustomer(customer);
		    		PreparedStatement preparedStatement;
					preparedStatement = connection.prepareStatement(sql);
					ResultSet resultSet = preparedStatement.executeQuery();
					while(resultSet.next() ){
						Customer customer1 = new Customer();
						customer1.setAddress(resultSet.getString("ADDRESS"));
						customer1.setCareer(resultSet.getString("CAREER"));
						customer1.setCustname(resultSet.getString("CUSTNAME"));
						customer1.setCustpwd(resultSet.getString("CUSTPWD"));
						
						customer1.setIdentity(resultSet.getString("IDENTITY"));
						customer1.setPhone(resultSet.getString("PHONE"));
						customer1.setSex(resultSet.getInt("SEX") == 1?"true":"false");
						customerlist.add(customer1);
					}
				} catch (SQLException e) {
					
					e.printStackTrace();
				}
				return customerlist;

			}
			//?????????????????????????????????
			public List<RentTable> findrenttabledate(String date1) {
				Connection connection = null;
				List<RentTable> renlist = new ArrayList<RentTable>();
				Customer customer = new Customer();
				try{
				connection=JdbcUtil.getInstance().getConn();
				String sql = selectsql(date1);

⌨️ 快捷键说明

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