returnInstanceForEmptyRow属性是MyBatis 3.4.2版本新增的属性。在此之前,当返回行的所有列都是空时,MyBatis默认返回 null。当开启returnInstanceForEmptyRow设置时,MyBatis会返回一个空实例,类似这样的形式:[{"xxx1":null,"xxx2":null,"xxx3":null}]

returnInstanceForEmptyRow的设置如下所示:

<setting name="returnInstanceForEmptyRow" value="true">

或者,在spring-boot的配置文件的设置:

mybatis.configuration.return-instance-for-empty-row=true

标签: none

[网站公告]-[2024年兼职介绍]


添加新评论