[Detailed explanation] Springboot main configuration file configuration, mybatis configuration item mybatis.configuration.map-underscore-to-camel-case=true/false

      When configuring springboot, generally add: mybatis configuration item mybatis.configuration.map-underscore-to-camel-case=true/false for the following reasons

      When we define the fields of the table in MySQL, some fields are defined in the form of user_name, user_password, but when we create the entity class in the Java language, we follow the hump principle for the attributes of the entity class. The general entity class attributes are written as userName, userPassword form. When using the mybatis framework, mybatis will help us check whether the database field and the attribute name of the entity class are consistent. This configuration is to map the underlined table field to the entity class attribute in the camel case format: user_Id is mapped to userId. If you don't use this configuration, you need to use the as keyword to alias, and the amount of code will be larger. So it is recommended to use this configuration to simplify development.

mybatis.configuration.map-underscore-to-camel-case=true

 

Guess you like

Origin blog.csdn.net/Sunshineoe/article/details/114652742