文档详情

内容分析包com amaker导入sql updatedaoimpl javaAoImpl.pdf

发布:2024-09-26约4.69千字共4页下载文档
文本预览下载声明

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();

显示全部
相似文档