正确运行,但查出来的数据为0
来源:2-5 开发BookService实现图书分页查询
慕盖茨8500022
2023-04-08 18:13:54
18:11:28 DEBUG [main] o.s.w.s.m.m.a.RequestMappingHandlerMapping - 2 mappings in 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' 18:11:28 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter' 18:11:28 DEBUG [main] o.s.w.s.m.m.a.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 18:11:28 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'mvcUriComponentsContributor' 18:11:29 DEBUG [main] o.s.w.s.m.m.a.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0' 18:11:29 DEBUG [main] o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - ControllerAdvice beans: 0 @ExceptionHandler, 1 ResponseBodyAdvice 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping' 18:11:29 DEBUG [main] _.s.w.s.H.Mappings - 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping' {} 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'localeResolver' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'themeResolver' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'viewNameTranslator' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'flashMapManager' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0' 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' 18:11:29 DEBUG [main] _.s.w.s.H.Mappings - 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' {/**=org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@467f77a5} 18:11:29 DEBUG [main] o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionManager' 18:11:29 DEBUG [main] o.s.t.c.c.DefaultCacheAwareContextLoaderDelegate - Storing ApplicationContext [1742920067] in cache under key [[MergedContextConfiguration@3d36e4cd testClass = BookServiceTest, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]] 18:11:29 DEBUG [main] o.s.test.context.cache - Spring test ApplicationContext cache statistics: [DefaultContextCache@c0b41d6 size = 1, maxSize = 32, parentContextCount = 0, hitCount = 0, missCount = 1] 18:11:29 DEBUG [main] o.s.t.c.c.DefaultCacheAwareContextLoaderDelegate - Retrieved ApplicationContext [1742920067] from cache with key [[MergedContextConfiguration@3d36e4cd testClass = BookServiceTest, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]] 18:11:29 DEBUG [main] o.s.test.context.cache - Spring test ApplicationContext cache statistics: [DefaultContextCache@c0b41d6 size = 1, maxSize = 32, parentContextCount = 0, hitCount = 1, missCount = 1] 18:11:29 DEBUG [main] o.s.t.c.s.AbstractDirtiesContextTestExecutionListener - Before test method: context [DefaultTestContext@709ba3fb testClass = BookServiceTest, testInstance = null(com.imooc.reader.service.BookServiceTest), testMethod = testSelectPage1@BookServiceTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@3d36e4cd testClass = BookServiceTest, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null]. 18:11:29 DEBUG [main] o.s.t.c.c.DefaultCacheAwareContextLoaderDelegate - Retrieved ApplicationContext [1742920067] from cache with key [[MergedContextConfiguration@3d36e4cd testClass = BookServiceTest, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]] 18:11:29 DEBUG [main] o.s.test.context.cache - Spring test ApplicationContext cache statistics: [DefaultContextCache@c0b41d6 size = 1, maxSize = 32, parentContextCount = 0, hitCount = 2, missCount = 1] 18:11:29 DEBUG [main] o.s.t.c.c.DefaultCacheAwareContextLoaderDelegate - Retrieved ApplicationContext [1742920067] from cache with key [[MergedContextConfiguration@3d36e4cd testClass = BookServiceTest, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]] 18:11:29 DEBUG [main] o.s.test.context.cache - Spring test ApplicationContext cache statistics: [DefaultContextCache@c0b41d6 size = 1, maxSize = 32, parentContextCount = 0, hitCount = 3, missCount = 1] 18:11:29 DEBUG [main] o.m.spring.SqlSessionUtils - Creating a new SqlSession 18:11:29 DEBUG [main] o.m.spring.SqlSessionUtils - Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f9d6c7b] 18:11:29 DEBUG [main] o.s.j.d.DataSourceUtils - Fetching JDBC Connection from DataSource 18:11:29 INFO [main] c.a.druid.pool.DruidDataSource - {dataSource-1} inited 18:11:29 DEBUG [main] o.m.s.t.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@319854f0] will be managed by Spring 18:11:29 DEBUG [main] c.i.r.m.B.selectPage_mpCount - ==> Preparing: SELECT COUNT(*) FROM book WHERE (category_id = ?) 18:11:29 DEBUG [main] c.i.r.m.B.selectPage_mpCount - ==> Parameters: 11(Integer) 18:11:29 DEBUG [main] c.i.r.m.B.selectPage_mpCount - <== Total: 1 18:11:29 DEBUG [main] o.m.spring.SqlSessionUtils - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f9d6c7b] 18:11:29 DEBUG [main] o.m.spring.SqlSessionUtils - Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f9d6c7b] 18:11:29 DEBUG [main] o.m.spring.SqlSessionUtils - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f9d6c7b] 总页数:0 记录数:0
1回答
好帮手慕小蓝
2023-04-10
同学你好,从日志中可以看到,传入的参数category_id值为11,如果同学使用的是课程中的数据库内容,那么确实是没有对应的数据的。
课程中演示时使用的是“1l”,后一个字符是小写的字母“L”而不是数字“1”,所以这里实际传入的数据是“long类型的数据1”,而不是“11”。
祝学习愉快~
相似问题