订单

//Controller层.

void testAction(){

int count1 = mapper.queryGoodsByShopIdAndFirstTypeIdCount(map1);//语句1

service1();

}

//Service层

void service1(){

int count1 = mapper.queryGoodsByShopIdAndFirstTypeIdCount(map2);//语句2

int count1 = mapper.queryGoodsByShopIdAndFirstTypeIdCount(map3);//语句3

}

其中语句1,语句2,语句3都是model层的mybatis接口.执行的是相同的sql语句.语句1和语句3耗时都是30ms,语句2耗时达到2000ms多.请问这是怎么回事??、

为方便,日志文件如下所示:

2014-08-14 18:06:32,062 DEBUG [com.blin360.interceptor.LogInterceptor] -

2014-08-14 18:06:32,062 DEBUG [com.blin360.interceptor.LogInterceptor] -

2014-08-14 18:06:32,062 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,062 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,062 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,062 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 5(Integer), 1216(Integer)>

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 5(Integer), 1216(Integer)>

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.action.BlBusinessShopAction] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.action.BlBusinessShopAction] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] -

2014-08-14 18:06:32,093 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 5(Integer), 1216(Integer)>

2014-08-14 18:06:32,093 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 5(Integer), 1216(Integer)>

2014-08-14 18:06:34,796 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,796 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,796 DEBUG [com.blin360.service.BlGoodsService] -

2014-08-14 18:06:34,796 DEBUG [com.blin360.service.BlGoodsService] -

2014-08-14 18:06:34,796 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,796 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==>  Preparing: select count('id') from bl_business_goods blbusgoods,bl_goods goods,bl_img where blbusgoods.goodId=goods.id AND goods.typeId in(select id from bl_goods_type where type=?) AND blbusgoods.state='0' AND bl_img.goodId=goods.id AND bl_img.type='0' AND blbusgoods.shopId=? >

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 2(Integer), 1216(Integer)>

2014-08-14 18:06:34,828 DEBUG [com.blin360.mapper.BlGoodsMapper.queryGoodsByShopIdAndFirstTypeIdCount] - <==> Parameters: 2(Integer), 1216(Integer)>

2014-08-14 18:06:34,828 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,828 DEBUG [org.mybatis.spring.SqlSessionUtils] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.service.BlGoodsService] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.service.BlGoodsService] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.service.BlGoodsService] -

2014-08-14 18:06:34,828 DEBUG [com.blin360.service.BlGoodsService] -

2014年8月14日 18:21

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐