通过日志打印的mybatis执行的SQL语句,原原本本复制到数据库,可以查出来很多条数据,但是mybatis要么查不到,要么少数据。
1.已尝试过写死传入参数,证明不是参数问题
2.尝试过select *,无效
3.尝试过查询的数据不小于resultMap里面的数据,也无效
4.写一个POJO类(是叫DTO吧?)来接收数据,也无效
5.SQL语句很简单,而且是通过复制到数据库,以及属性名都是通过复制,不存在写错。
走投无路了。。
以下是代码段以及日志:
日志:
2018-07-02 14:05:00,244 DEBUG [org.mybatis.spring.SqlSessionUtils] - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49]
2018-07-02 14:05:00,244 DEBUG [org.mybatis.spring.SqlSessionUtils] - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49] from current transaction
2018-07-02 14:05:00,244 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Preparing: select v.VideoStream videoStream,v.FileSize fileSize,v.Quality quality,v.UserType userType from vod_videorecord v where trim(v.RoomID) = ?
2018-07-02 14:05:00,244 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Parameters: 9(Integer)
2018-07-02 14:05:00,316 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - <== Total: 17
2018-07-02 14:05:00,316 DEBUG [org.mybatis.spring.SqlSessionUtils] - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49]
2018-07-02 14:05:00,316 DEBUG [org.mybatis.spring.SqlSessionUtils] - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49] from current transaction
2018-07-02 14:05:00,316 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Preparing: select v.VideoStream videoStream,v.FileSize fileSize,v.Quality quality,v.UserType userType from vod_videorecord v where trim(v.RoomID) = ?
2018-07-02 14:05:00,316 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Parameters: 3(Integer)
2018-07-02 14:05:00,393 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - <== Total: 1143
2018-07-02 14:05:00,394 DEBUG [org.mybatis.spring.SqlSessionUtils] - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49]
2018-07-02 14:05:00,394 DEBUG [org.mybatis.spring.SqlSessionUtils] - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49] from current transaction
2018-07-02 14:05:00,394 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Preparing: select v.VideoStream videoStream,v.FileSize fileSize,v.Quality quality,v.UserType userType from vod_videorecord v where trim(v.RoomID) = ?
2018-07-02 14:05:00,394 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Parameters: 2(Integer)
2018-07-02 14:05:00,472 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - <== Total: 36
2018-07-02 14:05:00,472 DEBUG [org.mybatis.spring.SqlSessionUtils] - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49]
2018-07-02 14:05:00,472 DEBUG [org.mybatis.spring.SqlSessionUtils] - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5f2b1d49] from current transaction
2018-07-02 14:05:00,472 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Preparing: select v.VideoStream videoStream,v.FileSize fileSize,v.Quality quality,v.UserType userType from vod_videorecord v where trim(v.RoomID) = ?
2018-07-02 14:05:00,472 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - ==> Parameters: 1(Integer)
2018-07-02 14:05:00,546 DEBUG [com.talk915.liveManagement.webapp.dao.group.VideoRecordDao.getDataByRoomIdforquery] - <== Total: 575
以最后一条查询语句为例
: select v.VideoStream videoStream,v.FileSize fileSize,v.Quality quality,v.UserType userType from vod_videorecord v where trim(v.RoomID) = ?
参数:1
返回条数:575条
数据库数据: 594条
这是差的少的情况,差的多了,直接差了几百,一千条数据都是..
数据库数据:
mapper里面代码段: