資源簡(jiǎn)介
黑馬商城源碼,僅供學(xué)習(xí)參考使用,歡迎大家下載使用!
代碼片段和文件信息
package?com.itheima.dao;
import?java.sql.SQLException;
import?java.util.List;
import?org.apache.commons.dbutils.QueryRunner;
import?org.apache.commons.dbutils.handlers.BeanHandler;
import?org.apache.commons.dbutils.handlers.BeanListHandler;
import?org.apache.commons.dbutils.handlers.ScalarHandler;
import?com.itheima.domain.Category;
import?com.itheima.domain.Product;
import?com.itheima.utils.DataSourceUtils;
public?class?ProductDao?{
//獲得熱門商品
public?List?findHotProductList()?throws?SQLException?{
QueryRunner?runner?=?new?QueryRunner(DataSourceUtils.getDataSource());
String?sql?=?“select?*?from?product?where?is_hot=??limit???“;
return?runner.query(sql?new?BeanListHandler(Product.class)?109);
}
//獲得最新商品
public?List?findNewProductList()?throws?SQLException?{
QueryRunner?runner?=?new?QueryRunner(DataSourceUtils.getDataSource());
String?sql?=?“select?*?from?product?order?by?pdate?desc?limit???“;
return?runner.query(sql?new?BeanListHandler(Product.class)09);
}
public?List?findAllCategory()?throws?SQLException?{
QueryRunner?runner?=?new?QueryRunner(DataSourceUtils.getDataSource());
String?sql?=?“select?*?from?category“;
return?runner.query(sql?new?BeanListHandler(Category.class));
}
public?int?getCount(String?cid)?throws?SQLException?{
QueryRunner?runner=new?QueryRunner(DataSourceUtils.getDataSource());
String?sql=“select?count(*)?from?product?where?cid=?“;//返回值為L(zhǎng)ong型
Long?query=(Long)?runner.query(sql?new?ScalarHandler()cid);//返回值為object型,強(qiáng)轉(zhuǎn)為L(zhǎng)ong型
return?query.intValue();//返回值為L(zhǎng)ong型強(qiáng)轉(zhuǎn)為int型
}
public?List?findProductByPage(String?cid?int?index?int?currentCount)?throws?SQLException?{
QueryRunner?runner?=?new?QueryRunner(DataSourceUtils.getDataSource());
String?sql?=?“select?*?from?product?where?cid=??limit???“;
List?list?=?runner.query(sql?new?BeanListHandler(Product.class)?cidindexcurrentCount);
return?list;
}
public?Product?findProductByPid(String?pid)?throws?SQLException?{
QueryRunner?runner?=?new?QueryRunner(DataSourceUtils.getDataSource());
String?sql?=?“select?*?from?product?where?pid=?“;
return?runner.query(sql?new?BeanHandler(Product.class)?pid);
}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????842??2017-12-17?15:16??HeimaShop\.classpath
?????文件????????1042??2017-12-17?15:16??HeimaShop\.project
?????文件?????????567??2017-12-17?15:16??HeimaShop\.settings\.jsdtscope
?????文件??????????57??2017-12-17?15:21??HeimaShop\.settings\org.eclipse.core.resources.prefs
?????文件?????????670??2017-12-17?15:21??HeimaShop\.settings\org.eclipse.jdt.core.prefs
?????文件?????????479??2017-12-17?15:16??HeimaShop\.settings\org.eclipse.wst.common.component
?????文件?????????345??2017-12-17?15:16??HeimaShop\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2017-12-17?15:16??HeimaShop\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2017-12-17?15:16??HeimaShop\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件??????????39??2017-12-17?15:17??HeimaShop\WebContent\me
?????文件??????610790??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\c3p0-0.9.1.2.jar
?????文件??????232019??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-beanutils-1.8.3.jar
?????文件???????49572??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-dbutils-1.4.jar
?????文件???????57779??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-fileupload-1.2.1.jar
?????文件??????109043??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-io-1.4.jar
?????文件???????60841??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-logging-1.1.1.jar
?????文件??????109568??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\commons-pool2-2.3.jar
?????文件??????190418??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\gson-2.2.4.jar
?????文件??????339368??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\jedis-2.7.0.jar
?????文件???????20682??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\jstl.jar
?????文件??????494975??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\mail.jar
?????文件??????495944??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\mysql-connector-java-5.0.4-bin.jar
?????文件??????393259??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\lib\standard.jar
?????文件????????2195??2017-12-17?15:17??HeimaShop\WebContent\WEB-INF\web.xm
?????文件?????????874??2017-12-17?15:17??HeimaShop\WebContent\admin\bottom.jsp
?????文件????????1796??2017-12-17?15:17??HeimaShop\WebContent\admin\category\add.jsp
?????文件????????1750??2017-12-17?15:17??HeimaShop\WebContent\admin\category\edit.jsp
?????文件????????2701??2017-12-17?15:17??HeimaShop\WebContent\admin\category\list.jsp
?????文件?????????914??2017-12-17?15:17??HeimaShop\WebContent\admin\home.jsp
?????文件????????1923??2017-12-17?15:17??HeimaShop\WebContent\admin\index.jsp
?????文件????????1287??2017-12-17?15:17??HeimaShop\WebContent\admin\left.jsp
............此處省略438個(gè)文件信息
評(píng)論
共有 條評(píng)論