实战SSM_O2O商铺_21【商铺列表】Dao层开发
生活随笔
收集整理的這篇文章主要介紹了
实战SSM_O2O商铺_21【商铺列表】Dao层开发
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 概述
- ShopDao接口
- ShopDao.xml配置SQL
- DAO層單元測試
- Github地址
概述
商鋪注冊和商鋪編輯開發完成之后,我們來做一下商鋪列表頁面。
- 列表頁面需要支持分頁 (MySql數據庫,我們使用limit關鍵字)
ShopDao接口
com.artisan.o2o.dao.ShopDao 新增兩個接口方法
- selectShopCount
- selectShopList
ShopDao.xml配置SQL
/o2o/src/main/resources/mapper/ShopDao.xml
因為統計的SQL和查詢商鋪列表的SQL中的where條件是相同的,所以這里我們使用SQL片段的方式,簡化配置
Sql中可將重復的sql提取出來,使用時用include引用即可,最終達到sql重用的目的
注意:如果引用其它mapper.xml的sql片段,則在引用時需要加上namespace,如下:<include refid="namespace.sql片段”/>
<sql id="selectShopByCondition"><!-- 可輸入的查詢條件:商鋪名(要求模糊查詢) 區域Id 商鋪狀態 商鋪類別 owner (注意在sqlmapper中按照前端入參拼裝不同的查詢語句) --><!-- 商鋪名(要求模糊查詢) --><if test="shopCondition.shopName != null and '' != shopCondition.shopName"><!-- 兩種寫法都可以 注意第二種是 ${}傳值 --><!-- #{}和${}#{}表示一個占位符號,通過#{}可以實現preparedStatement向占位符中設置值,自動進行java類型和jdbc類型轉換,#{}可以有效防止sql注入。 #{}可以接收簡單類型值或pojo屬性值。如果parameterType傳輸單個簡單類型值,#{}括號中可以是value或其它名稱。${}表示拼接sql串,通過${}可以將parameterType 傳入的內容拼接在sql中且不進行jdbc類型轉換, ${}可以接收簡單類型值或pojo屬性值,如果parameterType傳輸單個簡單類型值,${}括號中只能是value。--><!-- and s.shop_name like concat('%',#{shopCondition.shopName},'%')-->and s.shop_name like '%${shopCondition.shopName}%'</if><!-- 區域Id --><if test="shopCondition.area != null and shopCondition.area.areaId != null ">and s.area_id = #{shopCondition.area.areaId}</if><!-- 商鋪狀態 --><if test="shopCondition.enableStatus !=null">and s.enable_status = #{shopCondition.enableStatus}</if><!-- 商鋪類別 --><if test="shopCondition.shopCategory != null and shopCondition.shopCategory.shopCategoryId != null ">and s.shop_category_id = #{shopCondition.shopCategory.shopCategoryId}</if><!-- owner --><if test="shopCondition.owner != null and shopCondition.owner.userId != null">and s.owner_id = #{shopCondition.owner.userId}</if> </sql><select id="selectShopList" resultMap="shopMap">SELECTs.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_nameFROMtb_shop s,tb_area a,tb_shop_category sc<where><include refid="selectShopByCondition"/></where>AND s.area_id = a.area_idAND s.shop_category_id = sc.shop_category_id ORDER BY s.priority DESCLIMIT #{rowIndex} , #{pageSize}</select><select id="selectShopCount" resultType="Integer">SELECTcount(1)FROMtb_shop s,tb_area a,tb_shop_category sc<where><include refid="selectShopByCondition"/></where>AND s.area_id = a.area_idAND s.shop_category_id = sc.shop_category_id </select>DAO層單元測試
結合tb_shop中數據,編寫如下單元測試
@Testpublic 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 和 pageSizeshopList = shopDao.selectShopList(shopCondition, 0, 5);Assert.assertEquals(3, shopList.size());int count1 = shopDao.selectShopCount(shopCondition);Assert.assertEquals(3, count1);// 1.2 數據庫中只有3條數據符合 ,我們分頁條件 取出2條,即取出前兩條 驗證rowIndex 和 pageSizeshopList = 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=1Shop 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日志如下:
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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\28\2018060500333541696.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\27\2018052816202438800.jpg, null, 2018-05-28 16:20:24.0, 2018-05-28 16:20:24.0, 0, null, 1, 北京, 1, 咖啡奶茶 <== Row: 30, 優樂美, 優樂美奶茶店, 復興街, 123456, \upload\item\shopImage\30\2018053001010899137.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, \upload\item\shopImage\28\2018060500333541696.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, \upload\item\shopImage\29\2018052914541464482.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\28\2018060500333541696.jpg, 78, 2018-05-28 23:13:37.0, 2018-06-06 20:56:31.0, 0, null, 2, 上海, 2, 咖啡 <== Row: 27, 星巴克, 星巴克復興街店, 復興街, 56544565, \upload\item\shopImage\27\2018052816202438800.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, \upload\item\shopImage\29\2018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡 <== Row: 30, 優樂美, 優樂美奶茶店, 復興街, 123456, \upload\item\shopImage\30\2018053001010899137.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\24\2018052118095757182.jpg, 99, 2018-05-21 18:09:57.0, 2018-05-21 18:09:57.0, 0, 審核中, 1, 北京, 1, 咖啡奶茶 <== Row: 27, 星巴克, 星巴克復興街店, 復興街, 56544565, \upload\item\shopImage\27\2018052816202438800.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, \upload\item\shopImage\28\2018060500333541696.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, \upload\item\shopImage\29\2018052914541464482.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, \upload\item\shopImage\30\2018053001010899137.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\28\2018060500333541696.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, \upload\item\shopImage\30\2018053001010899137.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, \upload\item\shopImage\29\2018052914541464482.png, null, 2018-05-29 14:54:14.0, 2018-05-29 14:54:14.0, 0, null, 2, 上海, 2, 咖啡 <== Row: 27, 星巴克, 星巴克復興街店, 復興街, 56544565, \upload\item\shopImage\27\2018052816202438800.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\25\2018052214472089649.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, \upload\item\shopImage\28\2018060500333541696.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, \upload\item\shopImage\24\2018052118095757182.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, \upload\item\shopImage\25\2018052214472089649.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 hierarchyGithub地址
代碼地址: https://github.com/yangshangwei/o2o
總結
以上是生活随笔為你收集整理的实战SSM_O2O商铺_21【商铺列表】Dao层开发的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 实战SSM_O2O商铺_20【商铺编辑】
- 下一篇: 实战SSM_O2O商铺_22【商铺列表】