来源:SpringBoot开启mybatis的日志打印_caijibiandashen的博客-CSDN博客_springboot打印mybatis日志
- 查看sql语句
- 查看查询结果
- 查看是否是在同一个会话当中
/** * 一对多查询进行封装 但是要进行多次查询,但是在同一个sqlsession当中 * @param id * @return */ @Results(id = "result", value = { @Result(column = "id", property = "id"), @Result(column = "name", property = "name"), @Result(column = "release_time", property = "releaseTime"), @Result(column = "director", property = "director"), @Result(column = "duration", property = "duration"), @Result(column = "type", property = "type"), @Result(column = "region", property = "region"), @Result(column = "db_score", property = "db_score"), @Result(column = "image_address", property = "imageAddress"), @Result(column = "description", property = "description"), @Result(column = "bt_seed", property = "bt_seed"), @Result(column = "addTime", property = "addTime"), @Result( property = "channelList", column = "id", javaType = List.class, many = @Many(select = "com.ll.videowebsite.mapper.ChannelMapper.loadByVideoId") ), @Result( property = "actorList", column = "id", javaType = List.class, many = @Many(select = "com.ll.videowebsite.mapper.ActorMapper.loadByVideoId") ), @Result( property = "commentList", column = "id", javaType = List.class, many = @Many(select = "com.ll.videowebsite.mapper.CommentMapper.loadByVideoId") ), @Result( property = "shortVideoList", column = "id", javaType = List.class, many = @Many(select = "com.ll.videowebsite.mapper.ShortVideoMapper.loadAll") ), @Result( property = "imageList", column = "id", javaType = List.class, many = @Many(select = "com.ll.videowebsite.mapper.ImageMapper.loadAll") ) }) @Select("SELECT * FROM videoDetails WHERE id = #{id}") VideoDetails loadById1(int id);
解决方法:
在application 中配置如下信息。
# mybatis日志打印 mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl