升级MyBatis-Plus
...小于 1 分钟
升级MyBatis-Plus
1、Maven 坐标
<mybatis-plus.version>3.5.6</mybatis-plus.version>
<!-- mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
2、程序升级
@TableId
@TableId(type = IdType.ID_WORKER_STR)
// 全局替换成
@TableId(type = IdType.ASSIGN_ID)
getMap
service.getMap(queryContext.getWrapper().select(...)
// 语法变更为
service.getMap(Wrappers.<T>query().select(...)
// 示例
service.getMap(Wrappers.<OprtUse>query().select(...)
count
- 升级前
- 返回 int
- 升级后
- 返回 long
CrudController
return (Class<E>) ReflectionKit.getSuperClassGenericType(getClass(), 1);
更改为:
protected Class<E> currentModelClass() {
return (Class<E>) ReflectionKit.getSuperClassGenericType(getClass(), super.getClass(), 1);
}
public boolean removeByIds(Collection<? extends Serializable> idList) {
public boolean removeByIds(Collection<?> idList) {
import org.junit.Test;
import org.junit.jupiter.api.Test;
你认为这篇文章怎么样?
- 0
- 0
- 0
- 0
- 0
- 0