Solution: Mybatis-plus uses selectList to query data as null

Overview

Use the selectList of mybatis-plus to encapsulate the query data into the list and print it as null javaben and database fields can also correspond

 

 

reason

It can be seen from the picture that the data has actually been queried. Three pieces of data are printed. The list collection prints three nulls, indicating that the data is not encapsulated, that is the problem of javaben

mybatis-plus has the camel case naming rule turned on by default and mybatis is not turned on by default

solution

Method 1: You can use the @TableField annotation to specify the database table field name;

Method 2: Configure mybaitis-plus in the configuration file and turn off the automatic hump naming rule mapping:

Add configuration in application.yml:

mybatis-plus:
  configuration:
    map-underscore-to-camel-case: false

Guess you like

Origin blog.csdn.net/weixin_45481821/article/details/125836352
Recommended