Skip to content

Commit

Permalink
新增返回值map时无null值对于key说明.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Nov 19, 2024
1 parent 9c76064 commit 784ab71
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/content/docs/reference/question.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,20 @@ MyBatis Plus 不支持复合主键并强制使用唯一的 ID,这是出于以

<Accordion client:load title={'Page或List返回的结果集为null或者包含部分null元素'}>
- 原因:mybatis默认情况下, 当返回行的所有列都是空时(含属性无法自动映射), 默认返回 null
> 解决方案:配置return-instance-for-empty-row 为true
> 解决方案:配置returnInstanceForEmptyRow 为true
```yaml
mybatis-plus:
configuration:
return-instance-for-empty-row: true
```
</Accordion>

<Accordion client:load title={'当返回值为Map或List<Map>时,null值对应的key没有添加至Map里'}>
- 原因:mybatis默认情况下, 当返回 null 时,不会调用put方法
> 解决方案:配置callSettersOnNulls 为true
```yaml
mybatis-plus:
configuration:
call-setters-on-nulls: true
```
</Accordion>

0 comments on commit 784ab71

Please sign in to comment.