mybatis-plus的ObjectUtils.isNotEmpty()
时间: 2024-05-20 21:14:27 浏览: 22
MyBatis-Plus 是一款 MyBatis 的增强工具,在 MyBatis 的基础上增加了很多实用的功能,其中 ObjectUtils 是其核心工具类之一,提供了一些对象判断和转换的方法。
ObjectUtils.isNotEmpty() 方法是用来判断对象是否不为空的方法,其内部实现会进行如下判断:
1. 如果传入的对象为 null,则返回 false;
2. 如果传入的对象为 CharSequence 类型,则调用其 length() 方法判断长度是否大于 0;
3. 如果传入的对象为 Collection 类型,则调用其 size() 方法判断大小是否大于 0;
4. 如果传入的对象为 Map 类型,则调用其 size() 方法判断大小是否大于 0;
5. 如果传入的对象为 数组 类型,则调用其 length 属性判断长度是否大于 0;
6. 如果传入的对象为其他类型,则返回 true。
因此,使用 ObjectUtils.isNotEmpty() 方法可以方便地判断对象是否不为空。
相关问题
mybatis-plus.configuration
mybatis-plus.configuration是用于配置MyBatis Plus框架的配置项。其中,引用中的mybatis-plus.configuration.configuration-factory是指定配置的工厂类。引用中的mybatis-plus.configuration.auto-mapping-behavior是指定自动映射的行为。引用中的mybatis-plus.type-aliases-package是指定实体类的别名包。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [MyBatis-Plus——超详细讲解配置文件](https://blog.csdn.net/Huang_ZX_259/article/details/122562231)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
mybatis-plus. mapper-locations
MyBatis-Plus is an enhanced version of MyBatis, which is a popular Java persistence framework for working with SQL databases. It provides additional features and simplifies the development process.
The `mapper-locations` property in MyBatis-Plus is used to specify the XML mapper files location. These XML files contain the SQL statements and mapping configurations for MyBatis to interact with the database.
You can specify multiple locations using comma-separated values or use wildcards to scan for XML files in a directory. For example:
```properties
mybatis-plus.mapper-locations=classpath*:mapper/**/*.xml
```
This configuration will search for XML files in the `mapper` directory and its subdirectories on the classpath.
You can also specify file paths using the `file:` prefix. For example:
```properties
mybatis-plus.mapper-locations=file:/path/to/mapper/*.xml
```
This configuration will look for XML files in the specified directory on the file system.
Make sure to provide the correct location(s) of your mapper XML files so that MyBatis-Plus can find and parse them correctly.