generated from cotes2020/chirpy-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 2023-12-22-记录mybatis查询分页数据全是空的情况.md
- Loading branch information
1 parent
5b2fdfa
commit fe89799
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
layout: post | ||
title: "记录mybatis查询分页数据, 查询出的数据全是空的情况" | ||
date: 2023-12-22 10:29:20 +0800 | ||
categories: | ||
- 杂项 | ||
tags: | ||
- mybatis | ||
--- | ||
|
||
|
||
查看本文可以解决一下问题: | ||
- mybatis 查询列表数据全是null | ||
- mybatis 提示找不到某个mapper | ||
|
||
一个好好的功能,不知道同事提交了什么,用不了了。 | ||
|
||
事情发生在一个分页列表里,今天我修改了一点逻辑,本地想单点调试下,结果居然狂报空指针。 | ||
|
||
idea查看变量提示: `all elements is null`, WTF? | ||
|
||
一般发生这种变动都是框架有变动,或者是配置文件有变动。 | ||
|
||
就去查看提交记录, 果然一个同事提交修改了pom文件,再看里面引入了`mybatis-plus`. | ||
|
||
由于我之前图简单,直接使用`resultType`返回实体, 而这个实体类属性和数据库一致(而且是全大写),没有做驼峰。 | ||
|
||
于是去定义了一个`resultMap`,我的问题得到解决。 | ||
|
||
后来同事说项目运行还会提示异常, 某些mapper也找不到。 | ||
|
||
查看mybatis 有配置`mybatis.mapperLocations`, 想到引入了`mybatis-plus`于是又去配置了`mybatisPlus.mapperLocations`. | ||
|
||
问题解决! | ||
|
||
总结一下是,如果一个功能用的好好的,突然不能正常使用了。基本上就可以肯定是环境或数据发生了问题。 | ||
|
||
数据没问题的话,就直接去查看提交记录把,看看有没有大佬们引入新的东西。 | ||
|