内容分析包com amaker导入sql updatedaoimpl javaAoImpl.pdf
packagecom.amaker.dao.impl;
importjava.sql.Connection;
importjava.sql.ResultSet;
importjava.sql.SQLException;
importjava.sql.Statement;
importjava.util.ArrayList;
importjava.util.List;
importcom.amaker.dao.UpdateDao;
importcom.amaker.entity.CheckTable;
importcom.amaker.entity.Menu;
importcom.amaker.util.DBUtil;
/**
*@author
*/
publicclassUpdateDaoImplimplementsUpdateDao{
//òб
publicListgetMenuList(){
//SQL
Stringsql=selectid,typeId,price,name,pic,remarkfromMenuTbl;
//
DBUtilutil=newDBUtil();
//
Connectionconn=util.openConnection();
try{
//
Statementpstmt=conn.createStatement();
//в
ResultSetrs=pstmt.executeQuery(sql);
//ж
ListlistMenu=newArrayList();
while(rs.next()){
//ò
intid=rs.getInt(1);
inttypeId=rs.getInt(2);
intprice=rs.getInt(3);
Stringname=rs.getString(4);
Stringpic=rs.getString(5);
Stringremark=rs.getString(6);
Menum=newMenu();
m.setId(id);
m.setName(name);
m.setPic(pic);
m.setPrice(price);
m.setRemark(remark);
m.setTypeId(typeId);
listMenu.add(m);
}
returnlistMenu;
}catch(SQLExceptione){
e.printStackTrace();
}finally{
util.closeConn(conn);
}
returnnull;
}
//òб
publicListgetTableList(){
//SQL
Stringsql=selectid,num,flag,descriptionfromTableTbl;
//
DBUtilutil=newDBUtil();
//
Connectionconn=util.openConnection();
try{
//
Statementpstmt=conn.createStatement();