文章目录
- 概述
- ShopDao接口
- ShopDao.xml配置SQL
- DAO层单元测试
- Github地址
概述
商铺注册和商铺编辑开发完成之后,我们来做一下商铺列表页面。
- 列表页面需要支持分页 (MySql数据库,我们使用limit关键字)
ShopDao接口
com.artisan.o2o.dao.ShopDao 新增两个接口方法
- selectShopCount
- selectShopList
/**
*
*
* @Title: selectShopList
*
* @Description: 带有分页功能的查询商铺列表 。
*
* 可输入的查询条件:商铺名(要求模糊查询) 区域Id 商铺状态 商铺类别 owner
* (注意在sqlmapper中按照前端入参拼装不同的查询语句)
*
*
* @param shopConditionShop
* @param rowIndex
* 从第几行开始取
* @param pageSize
* 返回多少行数据(页面上的数据量)
*
* 比如 rowIndex为1,pageSize为5 即为 从第一行开始取,取5行数据
*
* @return: List
*/
List<Shop> selectShopList(@Param("shopCondition") Shop shopCondition, @Param("rowIndex") int rowIndex, @Param("pageSize") int pageSize);
/**
*
*
* @Title: selectShopCount
*
* @Description: 按照条件查询 符合前台传入的条件的商铺的总数
*
* @param shopCondition
*
* @return: int
*/
int selectShopCount(@Param("shopCondition") Shop shopCondition);
ShopDao.xml配置SQL
/o2o/src/main/resources/mapper/ShopDao.xml
因为统计的SQL和查询商铺列表的SQL中的where条件是相同的,所以这里我们使用SQL片段的方式,简化配置
Sql中可将重复的sql提取出来,使用时用include引用即可,最终达到sql重用的目的
{} #{}表示一个占位符号,通过#{}可以实现preparedStatement向占位符中设置值,自动进行java类型和jdbc类型转换, #{}可以有效防止sql注入。 #{}可以接收简单类型值或pojo属性值。 如果parameterType传输单个简单类型值,#{}括号中可以是value或其它名称。 {}表示拼接sql串,通过{}可以将parameterType 传入的内容拼接在sql中且不进行jdbc类型转换,
DAO层单元测试
结合tb_shop中数据,编写如下单元测试
代码语言:javascript复制@Test
public void testSelectShopListAndCount() {
Area area = new Area();
ShopCategory shopCategory = new ShopCategory();
PersonInfo personInfo = new PersonInfo();
List<Shop> shopList = null;
/**
* 可输入的查询条件: 1.商铺名(要求模糊查询) 2.区域Id 3.商铺状态 4.商铺类别 5.owner
*
*
* 首先按照单个条件进行单元测试,然后组合测试
**/
// 1.商铺名(要求模糊查询)
Shop shopCondition = new Shop();
shopCondition.setShopName("咖啡");
// 1.1 数据库中只有3条数据符合 ,我们分页条件 取出5条,即全部取出 验证rowIndex 和 pageSize
shopList = shopDao.selectShopList(shopCondition, 0, 5);
Assert.assertEquals(3, shopList.size());
int count1 = shopDao.selectShopCount(shopCondition);
Assert.assertEquals(3, count1);
// 1.2 数据库中只有3条数据符合 ,我们分页条件 取出2条,即取出前两条 验证rowIndex 和 pageSize
shopList = shopDao.selectShopList(shopCondition, 0, 2);
Assert.assertEquals(2, shopList.size());
// 总数依然是3条
int count2 = shopDao.selectShopCount(shopCondition);
Assert.assertEquals(3, count2);
// 为了不影响测试, 新实例化出来一个Shop
// 2.区域Id 库表中符合条件的记录有10条 areaId=1 10条 areaId=2 3条
Shop shopCondition2 = new Shop();
area.setAreaId(1);
shopCondition2.setArea(area);
shopList = shopDao.selectShopList(shopCondition2, 0, 99);
Assert.assertEquals(10, shopList.size());
area.setAreaId(2);
shopCondition2.setArea(area);
shopList = shopDao.selectShopList(shopCondition2, 0, 99);
Assert.assertEquals(3, shopList.size());
// 3.商铺状态 EnableStatus=0 12条 EnableStatus=1 1条
Shop shopCondition3 = new Shop();
shopCondition3.setEnableStatus(0);
shopList = shopDao.selectShopList(shopCondition3, 0, 99);
Assert.assertEquals(12, shopList.size());
shopCondition3.setEnableStatus(1);
shopList = shopDao.selectShopList(shopCondition3, 0, 99);
Assert.assertEquals(1, shopList.size());
// 4.商铺类别
// shop_category_id = 1 9条数据
// shop_category_id = 2 3条数据
// shop_category_id = 3 1条数据
Shop shopCondition4 = new Shop();
shopCategory.setShopCategoryId(1L);
shopCondition4.setShopCategory(shopCategory);
shopList = shopDao.selectShopList(shopCondition4, 0, 99);
Assert.assertEquals(9, shopList.size());
shopCategory.setShopCategoryId(2L);
shopCondition4.setShopCategory(shopCategory);
shopList = shopDao.selectShopList(shopCondition4, 0, 99);
Assert.assertEquals(3, shopList.size());
shopCategory.setShopCategoryId(3L);
shopCondition4.setShopCategory(shopCategory);
shopList = shopDao.selectShopList(shopCondition4, 0, 99);
Assert.assertEquals(1, shopList.size());
// 5.owner_id=1 13条 其余0条
Shop shopCondition5 = new Shop();
personInfo.setUserId(1L);
shopCondition5.setOwner(personInfo);
shopList = shopDao.selectShopList(shopCondition5, 0, 99);
Assert.assertEquals(13, shopList.size());
personInfo.setUserId(877L);
shopCondition5.setOwner(personInfo);
shopList = shopDao.selectShopList(shopCondition5, 0, 99);
Assert.assertEquals(0, shopList.size());
// 组合场景不全面,仅列几个
// 组合场景 owner_id =1 shop_name like %咖啡%
Shop shopCondition6 = new Shop();
personInfo.setUserId(1L);
shopCondition6.setOwner(personInfo);
shopCondition6.setShopName("咖啡");
shopList = shopDao.selectShopList(shopCondition6, 0, 99);
Assert.assertEquals(3, shopList.size());
int count6 = shopDao.selectShopCount(shopCondition6);
Assert.assertEquals(3, count6);
// 组合场景 area_id =1 shop_name like %咖啡% owner_id=1
Shop shopCondition7 = new Shop();
personInfo.setUserId(1L);
area.setAreaId(1);
shopCondition7.setOwner(personInfo);
shopCondition7.setArea(area);
shopCondition7.setShopName("咖啡");
shopList = shopDao.selectShopList(shopCondition7, 0, 99);
Assert.assertEquals(2, shopList.size());
int count7 = shopDao.selectShopCount(shopCondition7);
Assert.assertEquals(2, count7);
}
单元测试OK
控制台SQL日志如下:
代码语言:javascript复制JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@7fb95505] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 0(Integer), 5(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Total: 3
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@12d2ce03]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e6a5539] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@6d025197] will not be managed by Spring
==> Preparing: SELECT count(1) FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id
==> Parameters:
<== Columns: count(1)
<== Row: 3
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e6a5539]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1b955cac] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@5a1de7fb] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 0(Integer), 2(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Total: 2
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1b955cac]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31dadd46] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@12f9af83] will not be managed by Spring
==> Preparing: SELECT count(1) FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id
==> Parameters:
<== Columns: count(1)
<== Row: 3
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31dadd46]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@ee86bcb] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@19835e64] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.area_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Integer), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 33, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:45.0, 2018-06-06 17:54:45.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 36, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 18:01:49.0, 2018-06-06 18:01:49.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 31, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:52:58.0, 2018-06-06 17:52:58.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 34, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:55:18.0, 2018-06-06 17:55:18.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 32, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:24.0, 2018-06-06 17:54:24.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 35, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:59:29.0, 2018-06-06 17:59:29.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 27, 星巴克, 星巴克复兴街店, 复兴街, 56544565, uploaditemshopImage272018052816202438800.jpg, null, 2018-05-28 16:20:24.0, 2018-05-28 16:20:24.0, 0, null, 1, 北京, 1, 咖啡奶茶
<== Row: 30, 优乐美, 优乐美奶茶店, 复兴街, 123456, uploaditemshopImage302018053001010899137.png, null, 2018-05-30 01:01:07.0, 2018-05-30 01:01:07.0, 0, null, 1, 北京, 3, 奶茶
<== Total: 10
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@ee86bcb]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7d1cfb8b] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@2e1ef60] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.area_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 2(Integer), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 5, ArtisanUP, ArtisanDescUP, NanJingUP, 123456UP, /xxx/xxx/UP, 66, 2018-05-18 02:17:26.0, 2018-06-06 18:01:50.0, 1, Waring UP, 2, 上海, 2, 咖啡
<== Row: 29, NEW, eeeee, NEW ADDR, 123, uploaditemshopImage292018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡
<== Total: 3
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7d1cfb8b]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7b94089b] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@47f9738] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.enable_status = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 0(Integer), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 31, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:52:58.0, 2018-06-06 17:52:58.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 32, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:24.0, 2018-06-06 17:54:24.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 33, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:45.0, 2018-06-06 17:54:45.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 34, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:55:18.0, 2018-06-06 17:55:18.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 35, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:59:29.0, 2018-06-06 17:59:29.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 36, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 18:01:49.0, 2018-06-06 18:01:49.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 27, 星巴克, 星巴克复兴街店, 复兴街, 56544565, uploaditemshopImage272018052816202438800.jpg, null, 2018-05-28 16:20:24.0, 2018-05-28 16:20:24.0, 0, null, 1, 北京, 1, 咖啡奶茶
<== Row: 29, NEW, eeeee, NEW ADDR, 123, uploaditemshopImage292018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 30, 优乐美, 优乐美奶茶店, 复兴街, 123456, uploaditemshopImage302018053001010899137.png, null, 2018-05-30 01:01:07.0, 2018-05-30 01:01:07.0, 0, null, 1, 北京, 3, 奶茶
<== Total: 12
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7b94089b]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@21a21c64] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@531f4093] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.enable_status = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Integer), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 5, ArtisanUP, ArtisanDescUP, NanJingUP, 123456UP, /xxx/xxx/UP, 66, 2018-05-18 02:17:26.0, 2018-06-06 18:01:50.0, 1, Waring UP, 2, 上海, 2, 咖啡
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@21a21c64]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@16fdec90] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@40238dd0] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_category_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 35, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:59:29.0, 2018-06-06 17:59:29.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 33, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:45.0, 2018-06-06 17:54:45.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 36, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 18:01:49.0, 2018-06-06 18:01:49.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 32, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:24.0, 2018-06-06 17:54:24.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 34, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:55:18.0, 2018-06-06 17:55:18.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 31, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:52:58.0, 2018-06-06 17:52:58.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 27, 星巴克, 星巴克复兴街店, 复兴街, 56544565, uploaditemshopImage272018052816202438800.jpg, null, 2018-05-28 16:20:24.0, 2018-05-28 16:20:24.0, 0, null, 1, 北京, 1, 咖啡奶茶
<== Total: 9
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@16fdec90]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2f1de2d6] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@79517588] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_category_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 2(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 5, ArtisanUP, ArtisanDescUP, NanJingUP, 123456UP, /xxx/xxx/UP, 66, 2018-05-18 02:17:26.0, 2018-06-06 18:01:50.0, 1, Waring UP, 2, 上海, 2, 咖啡
<== Row: 29, NEW, eeeee, NEW ADDR, 123, uploaditemshopImage292018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡
<== Total: 3
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2f1de2d6]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@403f0a22] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@4c51cf28] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_category_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 3(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 30, 优乐美, 优乐美奶茶店, 复兴街, 123456, uploaditemshopImage302018053001010899137.png, null, 2018-05-30 01:01:07.0, 2018-05-30 01:01:07.0, 0, null, 1, 北京, 3, 奶茶
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@403f0a22]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3e7dd664] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@4b1d6571] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 35, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:59:29.0, 2018-06-06 17:59:29.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 33, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:45.0, 2018-06-06 17:54:45.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 34, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:55:18.0, 2018-06-06 17:55:18.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 32, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:54:24.0, 2018-06-06 17:54:24.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 31, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 17:52:58.0, 2018-06-06 17:52:58.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 36, Artisan, ArtisanDesc, NanJing, 123456, /xxx/xxx, 99, 2018-06-06 18:01:49.0, 2018-06-06 18:01:49.0, 0, Waring, 1, 北京, 1, 咖啡奶茶
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 5, ArtisanUP, ArtisanDescUP, NanJingUP, 123456UP, /xxx/xxx/UP, 66, 2018-05-18 02:17:26.0, 2018-06-06 18:01:50.0, 1, Waring UP, 2, 上海, 2, 咖啡
<== Row: 30, 优乐美, 优乐美奶茶店, 复兴街, 123456, uploaditemshopImage302018053001010899137.png, null, 2018-05-30 01:01:07.0, 2018-05-30 01:01:07.0, 0, null, 1, 北京, 3, 奶茶
<== Row: 29, NEW, eeeee, NEW ADDR, 123, uploaditemshopImage292018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡
<== Row: 27, 星巴克, 星巴克复兴街店, 复兴街, 56544565, uploaditemshopImage272018052816202438800.jpg, null, 2018-05-28 16:20:24.0, 2018-05-28 16:20:24.0, 0, null, 1, 北京, 1, 咖啡奶茶
<== Total: 13
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3e7dd664]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@16414e40] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@525575] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 877(Long), 0(Integer), 99(Integer)
<== Total: 0
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@16414e40]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@db57326] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@4748a0f9] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' and s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Row: 28, Modify咖啡店, Modify小工匠的咖啡店28, Modify-NanJing218, 12345628, uploaditemshopImage282018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡
<== Total: 3
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@db57326]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6dee4f1b] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@6ee6f53] will not be managed by Spring
==> Preparing: SELECT count(1) FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' and s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id
==> Parameters: 1(Long)
<== Columns: count(1)
<== Row: 3
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6dee4f1b]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31bcf236] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@4fad9bb2] will not be managed by Spring
==> Preparing: SELECT s.shop_id, s.shop_name, s.shop_desc, s.shop_addr, s.phone, s.shop_img, s.priority, s.create_time, s.last_edit_time, s.enable_status, s.advice, a.area_id, a.area_name, sc.shop_category_id, sc.shop_category_name FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' and s.area_id = ? and s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESC LIMIT ? , ?
==> Parameters: 1(Integer), 1(Long), 0(Integer), 99(Integer)
<== Columns: shop_id, shop_name, shop_desc, shop_addr, phone, shop_img, priority, create_time, last_edit_time, enable_status, advice, area_id, area_name, shop_category_id, shop_category_name
<== Row: 24, 咖啡点, 小工匠的咖啡店, NanJing, 9876553, uploaditemshopImage242018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 审核中, 1, 北京, 1, 咖啡奶茶
<== Row: 25, 咖啡店Improve, 小工匠的咖啡店Improve, NanJing-Improve, 9876553, uploaditemshopImage252018052214472089649.jpg, 99, 2018-05-22 14:46:16.0, 2018-05-22 14:46:18.0, 0, 审核中Improve, 1, 北京, 1, 咖啡奶茶
<== Total: 2
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31bcf236]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7241a47d] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@5dcd8c7a] will not be managed by Spring
==> Preparing: SELECT count(1) FROM tb_shop s, tb_area a, tb_shop_category sc WHERE s.shop_name like '%咖啡%' and s.area_id = ? and s.owner_id = ? AND s.area_id = a.area_id AND s.shop_category_id = sc.shop_category_id
==> Parameters: 1(Integer), 1(Long)
<== Columns: count(1)
<== Row: 2
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7241a47d]
六月 06, 2018 10:30:47 下午 org.springframework.context.support.GenericApplicationContext doClose
信息: Closing org.springframework.context.support.GenericApplicationContext@45afc369: startup date [Wed Jun 06 22:30:42 BOT 2018]; root of context hierarchy
Github地址
代码地址: https://github.com/yangshangwei/o2o