資源簡介
自帶需求文檔,ppt演示, 運行環境:mysql eclipse tomact 技術點:struts2 功能齊全 前臺+后臺
代碼片段和文件信息
package?com.wy.dao;
import?java.io.UnsupportedEncodingException;
import?java.sql.*;
import?java.util.*;
import?com.wy.tool.JDBConnection;
import?com.wy.domain.AfficheForm;
//對公告信息的操作
public?class?AfficheDao?{
??private?Connection?connection?=?null;?//定義連接的對象
??private?PreparedStatement?ps?=?null;?//定義預準備的對象
??private?JDBConnection?jdbc?=?null;?//定義數據庫連接對象
??public?AfficheDao()?{
????jdbc?=?new?JDBConnection();
????connection?=?jdbc.connection;?//利用構造方法取得數據庫連接
??}
??//刪除的方法
??public?void?deleteAffiche(Integer?id)?{
????try?{
??????ps?=?connection.prepareStatement(“delete?from?tb_affiche?where?id=?“);
??????ps.setInt(1?id.intValue());
??????ps.executeUpdate();
??????ps.close();
????}
????catch?(SQLException?ex)?{
???? ex.printStackTrace();
????}
??}
??//修改的方法
??public?void?updateAffiche(AfficheForm?form)?{
????try?{
??????ps?=?connection.prepareStatement(“update?tb_affiche?set?name=?content=??where?id=?“);
??????ps.setString(1?form.getName());
??????ps.setString(2?form.getContent());
??????ps.setInt(3?form.getId().intValue());
??????ps.executeUpdate();
??????ps.close();
????}
????catch?(SQLException?ex)?{
???? ex.printStackTrace();
????}
??}
//添加的方法
??public?void?insertAffiche(AfficheForm?form)?throws?UnsupportedEncodingException?{
????try?{
??????ps?=?connection.prepareStatement(“insert?into?tb_affiche?values?(null??now())“);
??????ps.setString(1form.getName());
//??????String?str=new?String(form.getName().getBytes(“ISO-8859-1“)“utf-8“);
//??????System.out.println(new?String(form.getName().getBytes(“iso-8859-1“)“utf-8“));
??????System.out.println(form.getName());
??????ps.setString(2?form.getContent());
??????ps.executeUpdate();
??????ps.close();
????}
????catch?(SQLException?ex)?{
???? ex.printStackTrace();
????}
??}
//以數據庫流水號為條件查詢信息
??public?AfficheForm?selectOneAffiche(Integer?id)?{
????AfficheForm?affiche?=?null;
????try?{
??????ps?=?connection.prepareStatement(“select?*?from?tb_affiche?where?id=?“);
??????ps.setInt(1?id.intValue());
??????ResultSet?rs?=?ps.executeQuery();
??????while?(rs.next())?{
????????affiche?=?new?AfficheForm();
????????affiche.setId(Integer.valueOf(rs.getString(1)));
????????affiche.setName(rs.getString(2));
????????affiche.setContent(rs.getString(3));
????????affiche.setIssueTime(rs.getString(4));
??????}
????}
????catch?(SQLException?ex)?{
???? ex.printStackTrace();
????}
????return?affiche;
??}
//全部查詢的方法
??public?List?selectAffiche()?{
????List?list?=?new?ArrayList();
????AfficheForm?affiche?=?null;
????try?{
??????ps?=?connection.prepareStatement(“select?*?from?tb_affiche?order?by?id?DESC“);
??????ResultSet?rs?=?ps.executeQuery();
??????while?(rs.next())?{
????????affiche?=?new?AfficheForm();
????????affiche.setId(Integer.valueOf(rs.getString(1)));
????????affiche.setName(rs.getString(2));
????????affiche.setContent(rs.getString(3));
????????affiche.setIssueTime(rs.getString(4));
????????list.add(af
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????479232??2013-11-21?14:17??樂購網比賽\2012281PPT.ppt
?????文件??????42777??2013-11-18?07:55??樂購網比賽\db_shopping.sql
?????文件??????76871??2013-11-21?21:31??樂購網比賽\QQ圖片20131121213116.jpg
?????文件????????771??2013-11-08?20:23??樂購網比賽\Shopping\.classpath
?????文件???????1257??2013-11-08?20:26??樂購網比賽\Shopping\.project
?????文件????????503??2013-06-30?10:20??樂購網比賽\Shopping\.settings\.jsdtscope
?????文件?????????99??2013-11-08?20:18??樂購網比賽\Shopping\.settings\com.genuitec.eclipse.j2eedt.core.xm
?????文件????????395??2013-06-30?10:20??樂購網比賽\Shopping\.settings\org.eclipse.jdt.core.prefs
?????文件????????454??2013-06-30?10:20??樂購網比賽\Shopping\.settings\org.eclipse.wst.common.component
?????文件????????352??2013-11-08?20:18??樂購網比賽\Shopping\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2013-06-30?10:20??樂購網比賽\Shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2013-06-30?10:20??樂購網比賽\Shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????3488??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\AfficheDao.class
?????文件???????2848??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\BigTypeDao.class
?????文件???????6928??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\GoodsDao.class
?????文件???????2478??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\li
?????文件???????3407??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\ManagerDao.class
?????文件???????5488??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\MemberDao.class
?????文件???????4677??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\OrderDao.class
?????文件???????3018??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\OrderDetailDao.class
?????文件???????4256??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\dao\SmallTypeDao.class
?????文件???????1807??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\AfficheForm.class
?????文件???????1662??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\BigTypeForm.class
?????文件???????3063??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\GoodsForm.class
?????文件???????1444??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\li
?????文件???????2049??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\ManagerForm.class
?????文件???????2311??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\MemberForm.class
?????文件???????1954??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\OrderDetailForm.class
?????文件???????3003??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\OrderForm.class
?????文件????????346??2013-11-20?18:03??樂購網比賽\Shopping\build\classes\com\wy\domain\SellGoodsForm.class
............此處省略349個文件信息
評論
共有 條評論