• 大小: 12.66MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-01
  • 语言: Java
  • 标签:

资源简介

本项目是自己的毕业设计项目,使用了jsp,servlet等javaweb技术,代码结构清晰,是初学者的选择。

资源截图

代码片段和文件信息

package com.lechou.order;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import com.lechou.util.DatabaseOperator;

public class OrderDAO {
private static Connection conn = DatabaseOperator.getConn();
/*
 * 查询处理,获得所有的VO对象
 */
public List getVOs() {


Statement stmt = null;
ResultSet rs = null;
List vos = new ArrayList();
try {

stmt = DatabaseOperator.createStatement(conn);
String sql = “select * from lechou_order  order by publishtime desc “;
System.out.println(“开始执行单行select语句“ + sql);
rs = stmt.executeQuery(sql);
OrderVO vo = null;
while (rs.next()) {
vo = new OrderVO();
OrderMgr.getInstance().initFromResultSet(vo rs);
vos.add(vo);
}

} catch (SQLException e) {
e.printStackTrace();
} finally {
DatabaseOperator.close(stmt);
DatabaseOperator.close(rs);

}

return vos;
}

/*
 * 分页查询处理
 * 
 * @return 获得VO对象总数
 */
public int getVOs(List vos int pageNo int pageSize) {
int totalRecords = -1;

Statement stmt = null;
ResultSet rs = null;
Statement stmtCount = null;
ResultSet rsCount = null;
try {

stmt = DatabaseOperator.createStatement(conn);
String sql = “select * from lechou_order  order by publishtime desc limit “
+ (pageNo - 1) * pageSize + ““ + pageSize;
System.out.println(“开始执行单行select语句“ + sql);
rs = stmt.executeQuery(sql);
OrderVO vo = null;
while (rs.next()) {
vo = new OrderVO();
OrderMgr.getInstance().initFromResultSet(vo rs);
vos.add(vo);
}
stmtCount = DatabaseOperator.createStatement(conn);
rsCount = DatabaseOperator.executeQuery(stmtCount
“select count(*) from lechou_order“);
System.out.println(“开始执行单行select语句“ + sql);
rsCount.next();
totalRecords = rsCount.getInt(1);

} catch (SQLException e) {
e.printStackTrace();
} finally {
DatabaseOperator.close(rsCount);
DatabaseOperator.close(stmtCount);
DatabaseOperator.close(stmt);
DatabaseOperator.close(rs);

}

return totalRecords;
}

/*
 * 按条件分页查询处理
 * 
 * @return 获得VO对象总数
 */
public int getVOs(List vos int pageNo int pageSize
String queryStr) {
int totalRecords = -1;

Statement stmt = null;
ResultSet rs = null;
Statement stmtCount = null;
ResultSet rsCount = null;
try {

stmt = DatabaseOperator.createStatement(conn);
String sql = “select * from lechou_order “ + queryStr
+ “ order by publishtime desc limit “ + (pageNo - 1)
* pageSize + ““ + pageSize;
System.out.println(“开始执行单行select语句“ + sql);
rs = stmt.executeQuery(sql);
OrderVO vo = null;
while (rs.next()) {
vo = new OrderVO();
OrderMgr.getInstance().initFromResultSet

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-06-22 09:23  lechou1.3\
     文件         529  2015-05-10 14:53  lechou1.3\.classpath
     目录           0  2015-06-22 09:23  lechou1.3\.externalToolBuilders\
     文件         548  2015-05-14 23:18  lechou1.3\.externalToolBuilders\org.eclipse.wst.jsdt.core.javascriptValidator.launch
     目录           0  2015-06-22 09:23  lechou1.3\.myeclipse\
     文件         300  2015-07-22 22:18  lechou1.3\.mymetadata
     文件        1983  2015-06-22 09:24  lechou1.3\.project
     目录           0  2015-06-22 15:29  lechou1.3\.settings\
     文件         500  2015-05-10 14:53  lechou1.3\.settings\.jsdtscope
     文件         307  2015-05-30 10:21  lechou1.3\.settings\com.genuitec.eclipse.core.prefs
     文件        1040  2015-06-22 09:24  lechou1.3\.settings\com.genuitec.eclipse.j2eedt.core.prefs
     文件         395  2015-05-10 14:53  lechou1.3\.settings\org.eclipse.jdt.core.prefs
     文件         465  2015-06-22 09:24  lechou1.3\.settings\org.eclipse.wst.common.component
     文件         252  2015-05-10 14:53  lechou1.3\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2015-05-10 14:53  lechou1.3\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2015-05-10 14:53  lechou1.3\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2015-06-22 09:23  lechou1.3\SQL\
     文件        7958  2015-06-23 11:29  lechou1.3\SQL\lechou.sql
     目录           0  2015-06-22 09:23  lechou1.3\src\
     目录           0  2015-06-22 09:23  lechou1.3\src\com\
     目录           0  2015-06-22 09:23  lechou1.3\src\com\lechou\
     目录           0  2015-06-22 09:23  lechou1.3\src\com\lechou\order\
     文件       10651  2015-05-30 16:40  lechou1.3\src\com\lechou\order\OrderDAO.java
     文件        3185  2015-05-30 21:41  lechou1.3\src\com\lechou\order\OrderMgr.java
     文件         542  2015-05-17 10:00  lechou1.3\src\com\lechou\order\OrderSearchVO.java
     文件        1956  2015-05-23 08:56  lechou1.3\src\com\lechou\order\OrderVO.java
     目录           0  2015-06-22 09:23  lechou1.3\src\com\lechou\project\
     目录           0  2015-06-22 09:23  lechou1.3\src\com\lechou\project\approvelist\
     文件        5293  2015-05-30 22:08  lechou1.3\src\com\lechou\project\approvelist\ProjectApprovelistDAO.java
     文件        2210  2015-05-30 22:09  lechou1.3\src\com\lechou\project\approvelist\ProjectApprovelistMgr.java
     文件        1428  2015-06-22 16:07  lechou1.3\src\com\lechou\project\approvelist\ProjectApprovelistVO.java
............此处省略220个文件信息

评论

共有 条评论