资源简介
北大青鸟S2结业项目《易买网》,内含项目代码以及数据库(完整版)。
代码片段和文件信息
package com.T212.easybuy.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
* 数据库操作工具类
* @author Administrator
*/
public class baseDao {
private final static String UserName = “root“;
private final static String PassWord = “root“;
private final static String Driver = “com.mysql.jdbc.Driver“;
private final static String URL = “jdbc:mysql://localhost:3306/easybuy?characterEncoding=utf8“;
protected PreparedStatement ps = null;
protected Connection conn =null;
protected ResultSet rs = null;
/**
* 打开连接
* @return 连接对象
*/
protected Connection getConnection() {
try {
Class.forName(Driver);
Connection con = DriverManager.getConnection(URL UserName PassWord);
return con;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 关闭连接
* @return 空
*/
protected void closeAll(Connection con PreparedStatement ps ResultSet rs) {
try {
if (rs != null) {
rs.close();
}
if (ps != null) {
ps.close();
}
if (con != null) {
con.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 增删改
* @param sql
* @param arr
* @return受影响的行数
*/
protected int executeUpdate(String sql object... arr) {
try {
conn = getConnection();
ps = conn.prepareStatement(sql);
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
ps.setobject(i + 1 arr[i]);
}
}
return ps.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeAll(conn ps null);
}
return 0;
}
/**
* 查询
*/
protected ResultSet executeQuery(String sql object... param) {
try {
conn = getConnection();
ps = conn.prepareStatement(sql);
if (param!=null) {
for (int i = 0; i < param.length; i++) {
ps.setobject(i+1 param[i]);
}
}
rs = ps.executeQuery();
} catch (Exception e) {
e.printStackTrace();
}
return rs;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 727 2018-07-23 08:39 EasyBuyProject\.classpath
文件 914 2018-07-22 10:05 EasyBuyProject\.project
文件 567 2018-07-22 10:05 EasyBuyProject\.settings\.jsdtscope
文件 364 2018-07-22 10:05 EasyBuyProject\.settings\org.eclipse.jdt.core.prefs
文件 494 2018-07-22 10:05 EasyBuyProject\.settings\org.eclipse.wst.common.component
文件 305 2018-07-22 10:05 EasyBuyProject\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2018-07-22 10:05 EasyBuyProject\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2018-07-22 10:05 EasyBuyProject\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 2558 2018-07-26 12:09 EasyBuyProject\build\classes\com\T212\easybuy\dao\ba
文件 288 2018-07-25 19:18 EasyBuyProject\build\classes\com\T212\easybuy\dao\EasybuyMenuDao.class
文件 252 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\dao\EasybuyNewsDao.class
文件 384 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\dao\EasybuyProductDao.class
文件 471 2018-07-26 16:29 EasyBuyProject\build\classes\com\T212\easybuy\dao\EasybuyUserDao.class
文件 2126 2018-07-25 19:18 EasyBuyProject\build\classes\com\T212\easybuy\dao\impl\EasybuyMenuDaoImpl.class
文件 2200 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\dao\impl\EasybuyNewsDaoImpl.class
文件 3750 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\dao\impl\EasybuyProductDaoImpl.class
文件 3212 2018-07-26 16:38 EasyBuyProject\build\classes\com\T212\easybuy\dao\impl\EasybuyUserDaoImpl.class
文件 1322 2018-07-26 11:47 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyMenu.class
文件 1143 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyNews.class
文件 1763 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyOrder.class
文件 1301 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyOrderdetail.class
文件 2390 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyProduct.class
文件 2444 2018-07-26 16:37 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyUser.class
文件 1552 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\entity\EasybuyUseraddress.class
文件 300 2018-07-26 16:20 EasyBuyProject\build\classes\com\T212\easybuy\service\EasybuyMenuService.class
文件 264 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\service\EasybuyNewsService.class
文件 432 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\service\EasybuyProductService.class
文件 483 2018-07-26 16:38 EasyBuyProject\build\classes\com\T212\easybuy\service\EasybuyUserService.class
文件 850 2018-07-26 16:21 EasyBuyProject\build\classes\com\T212\easybuy\service\impl\EasybuyMenuServiceImpl.class
文件 798 2018-07-26 17:28 EasyBuyProject\build\classes\com\T212\easybuy\service\impl\EasybuyNewsServiceImpl.class
............此处省略519个文件信息
评论
共有 条评论