資源簡介
在線點餐的網(wǎng)頁版,用戶能實現(xiàn)從選餐與商家之間實現(xiàn)點外賣.用到的技術(shù)為java web,前臺界面jQuery,及各種熱門的前臺插件,該項目并沒有用到java的高級框架.資源里數(shù)據(jù)庫,源碼,開發(fā)基本流程及前臺界面的模板.項目可直接運行,界面美觀,用戶體驗友好.
代碼片段和文件信息
package?com.shsxt.dao;
import?java.lang.reflect.Field;
import?java.lang.reflect.Method;
import?java.sql.Connection;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.ResultSetmetaData;
import?java.util.ArrayList;
import?java.util.List;
import?com.shsxt.util.DBUtil;
/**
?*??公用的數(shù)據(jù)庫操作工具類
?*? 1、更新操作(添加、修改、刪除)
?*? 2、查詢某一個字段?(常用場景:查詢總數(shù)量?count)
?*? 3、查詢對象集合
?*? 4、查詢對象?
?*?@author?威威
?*
?*/
@SuppressWarnings(“all“)
public?class?baseDao?{
/**
?*?更新操作(添加修改刪除)
?*?@param?sql
?*?@param?params
?*?@return
?*?返回true表示更新成功false表示更新失敗
?*/
public?static?Boolean?executeUpdate(String?sql?Listject>?params)?{
boolean?flag?=?false;
Connection?conn?=?null;
PreparedStatement?pst?=?null;
try?{
//?得到數(shù)據(jù)庫的鏈接
conn?=?DBUtil.getConnection();
//?預編譯
pst?=?conn.prepareStatement(sql);
//?設置參數(shù)
//?判斷參數(shù)集合是否為空
if?(params?!=?null?&&?params.size()>0)?{
//?循環(huán)設置參數(shù),下標從1開始
for?(int?i?=?0;?i? pst.setobject(i+1?params.get(i));
}
}
//?執(zhí)行更新,返回受影響的行數(shù)
if?(pst.executeUpdate()?>?0)?{
flag?=?true;
}
}?catch?(Exception?e)?{
e.printStackTrace();
}?finally?{
DBUtil.closeSourse(conn?pst);
}
return?flag;
}
/**
?*?查詢某一個字段?(常用于查詢總數(shù)量)
?*?@param?sql
?*?@param?params
?*?@return:返回一個對象
?*/
public?static?object?findSingleValue(String?sqlListject>?params)?{
//準備對象類
object?object?=?null;
Connection?conn?=?null;
PreparedStatement?pst?=?null;
ResultSet?rs?=?null;
try?{
//?得到數(shù)據(jù)庫的鏈接
conn?=?DBUtil.getConnection();
//?預編譯
pst?=?conn.prepareStatement(sql);
//?設置參數(shù)
//?判斷參數(shù)集合是否為空
if?(params?!=?null?&&?params.size()>0)?{
//?循環(huán)設置參數(shù),下標從1開始
for?(int?i?=?0;?i? pst.setobject(i+1?params.get(i));
}
}
//?執(zhí)行查詢,返回結(jié)果集
rs?=?pst.executeQuery();
//?分析結(jié)果集,得到對應的值
if?(rs.next())?{
object?=?rs.getobject(1);
}
}?catch?(Exception?e)?{
e.printStackTrace();
}?finally?{
//關(guān)閉資源
DBUtil.close(conn?pst?rs);
}
return?object;
}
/**
?*?查詢一個對象的集合
?*?@param?sql
?*?@param?params
?*?@param?cls
?*?@return
?*/
public?static?List?findRows(String?sql?Listject>?params?Class?cls)?{
//準備工作
List?list?=?new?ArrayList<>();
Connection?conn?=?null;
PreparedStatement?pst?=?null;
ResultSet?rs?=?null;
try?{
//?得到數(shù)據(jù)庫的鏈接
conn?=?DBUtil.getConnection();
//?預編譯
pst?=?conn.prepareStatement(sql);
//?設置參數(shù)
//?判斷參數(shù)集合是否為空
if?(params?!=?null?&&?params.size()?>?0)?{
//?循環(huán)設置參數(shù),下標從1開始
for(int?i?=?0;?i? pst.setobject(i+1?params.get(i));
}
}
//?執(zhí)行查詢,返回結(jié)果集
rs?=?pst.executeQuery();
//?得到結(jié)果集的元數(shù)據(jù)???得到查詢的字段數(shù)量以及對應的字段名
ResultSetmetaData?metaData?=?rs.getmetaData();
//?得到查詢的字段數(shù)量
int?columnNum?=?metaData.getColumnCount();
//?分析結(jié)果集
while?(rs.next())?{
//?創(chuàng)建一個對象
object?object?=?cls.newInstance();
//?循環(huán)得到數(shù)據(jù)庫查詢到的字段名
for?(int?i?=?0;?i?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????221375??2018-09-14?22:04??在線訂餐系統(tǒng)\online_restaurant.xmind
?????文件???????9437??2016-05-31?01:55??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻article_list.html
?????文件???????8033??2016-05-31?01:52??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻article_read.html
?????文件???????9229??2016-05-31?01:52??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻cart.html
?????文件??????13474??2016-05-31?01:52??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻category.html
?????文件??????11126??2016-05-31?01:52??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻confirm_order.html
?????文件??????10855??2016-05-31?01:52??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻detailsp.html
?????文件???????1020??2014-09-11?10:14??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\3_j.png
?????文件????????402??2014-09-18?11:44??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\alipay.png
?????文件????????694??2014-09-23?13:20??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\al_ico.jpg
?????文件??????11745??2016-05-31?01:50??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\Android_ico_d.gif
?????文件??????42577??2014-09-19?14:23??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\bank.png
?????文件????????965??2013-11-21?14:32??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\bg5.png
?????文件???????6376??2016-05-31?00:37??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\by_button.png
?????文件???????2093??2014-09-16?12:01??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\collect.png
?????文件???????6129??2016-05-31?00:38??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\dc_button.png
?????文件???????2996??2014-09-23?16:50??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\ddprice_bg.gif
?????文件???????1495??2014-08-30?01:59??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\dot.png
?????文件???????2441??2014-09-11?16:07??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\help-ico.png
?????文件??????11007??2016-05-31?01:51??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\iphone_ico_d.gif
?????文件???????2405??2014-09-23?15:13??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\jf.png
?????文件??????13263??2016-05-31?00:48??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\logo.jpg
?????文件???????5629??2014-09-11?16:22??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\l_f_ico.png
?????文件??????32308??2014-09-09?14:14??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\menu_bg_ico.png
?????文件????????669??2014-08-08?14:55??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\newaddress.png
?????文件???????3448??2014-08-30?01:59??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\next.png
?????文件????????146??2013-11-21?14:32??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\p-bg.png
?????文件???????3445??2014-08-30?01:59??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\prev.png
?????文件????????969??2014-09-15?09:13??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\s-down.png
?????文件????????971??2014-09-15?09:12??在線訂餐系統(tǒng)\前臺模板\網(wǎng)上點餐前臺界面?zhèn)溆肻images\s-up.png
............此處省略880個文件信息
評論
共有 條評論