跳至主要內容

升级MyBatis-Plus

Jin...小于 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

  1. 升级前
    • 返回 int
  2. 升级后
    • 返回 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;

贡献者: Jin
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度