Git Product home page Git Product logo

mybatis-plus-doc's Issues

mysql中如果URL没有rewriteBatchedStatements=true的话批量插入速度慢

当前使用版本(必填,否则不予处理)

<mybatis-plus.version>3.1.1</mybatis-plus.version>

该问题是如何引起的?(确定最新版也有问题再提!!!)

saveBatch方法慢

重现步骤(如果有就写完整)

saveBatch方法慢
文档中并未提及MySQL的JDBC连接的url中要加rewriteBatchedStatements参数,并保证5.1.13以上版本的驱动,才能实现高性能的批量插入。
建议在官网中提示一下

报错信息

分页插件

/**
* 乐观锁 影响分页数据
* @return
*/
@bean
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
return new OptimisticLockerInterceptor();
}

启动类加上这个东西影响到了分页数据

补充test的描述

自动配置的测试

自动导入Mybatis-plus test的自动配置,通过@MybatisPlusTest注解快速配置。

示例工程:

👉 mybatis-plus-boot-starter-test

  • 添加测试依赖
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>lates</version>
</dependency>

示例代码:

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author miemie
 * @since 2020-05-27
 */
@MybatisPlusTest
class MybatisPlusSampleTest {

    @Autowired
    private SampleMapper sampleMapper;

    @Test
    void testInsert() {
        Sample sample = new Sample();
        sampleMapper.insert(sample);
        assertThat(sample.getId()).isNotNull();
    }
}

只有父类加@TableField(fill = ...)注解,而子类不加自动填充注解时,自动填充失效

子类没有声明需要自动填充的字段,其父类声明要自动填充的字段.在插入时,自动填充不起作用.
父类部分代码如下:
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableField(value = "createTime", fill = FieldFill.INSERT)
private Date createTime;
...
}
子类部分代码:
@TableName("sys_user_demo")
public class SysUserDemo extends BaseEntity {
private static final long serialVersionUID = 1L;
private String username;
private String password;
private Integer age;
...
}

文档不够详细

文档只是简要的说明,例如如何对一些配置进行操作根本不知道要从何得知,要一遍遍的不断试才能够明白,有的还试不明白,真的有些糟糕

逻辑删除

增加逻辑删除字段后,有的时候查询想要查询已删除的,但是自动添加逻辑删除不能查询

添加Wrapper如何使用

看到select和update多处用到Wrapper,但是文档上并没有说明在service层传参时如何传入Wrapper类型的参数,还有就是关于条件构造器如何在service层使用,希望添加这些相关的。

官网太卡

mybatis.plus网站好卡啊,mp.baomidou.com在电脑上的浏览器直接进不去,ie,firefox,chrome,edge都试过了,卡的吓人

3.0 代码生成,PackageInfoConfig中ModuleName被去掉了

3.0版本

private void handlerPackage(TemplateConfig template, String outputDir, PackageConfig config) { this.packageInfo = new HashMap(6); this.packageInfo.put("Entity", this.joinPackage(config.getParent(), config.getEntity())); this.packageInfo.put("Mapper", this.joinPackage(config.getParent(), config.getMapper())); this.packageInfo.put("Xml", this.joinPackage(config.getParent(), config.getXml())); this.packageInfo.put("Service", this.joinPackage(config.getParent(), config.getService())); this.packageInfo.put("ServiceImpl", this.joinPackage(config.getParent(), config.getServiceImpl())); this.packageInfo.put("Controller", this.joinPackage(config.getParent(), config.getController())); Map configPathInfo = config.getPathInfo(); if(null != configPathInfo) { this.pathInfo = configPathInfo; } else { this.pathInfo = new HashMap(6); this.setPathInfo(this.pathInfo, template.getEntity(this.getGlobalConfig().isKotlin()), outputDir, "entity_path", "Entity"); this.setPathInfo(this.pathInfo, template.getMapper(), outputDir, "mapper_path", "Mapper"); this.setPathInfo(this.pathInfo, template.getXml(), outputDir, "xml_path", "Xml"); this.setPathInfo(this.pathInfo, template.getService(), outputDir, "service_path", "Service"); this.setPathInfo(this.pathInfo, template.getServiceImpl(), outputDir, "service_impl_path", "ServiceImpl"); this.setPathInfo(this.pathInfo, template.getController(), outputDir, "controller_path", "Controller"); } }

2.1.9版本

private void handlerPackage(TemplateConfig template, String outputDir, PackageConfig config) { this.packageInfo = new HashMap(); this.packageInfo.put("ModuleName", config.getModuleName()); this.packageInfo.put("Entity", this.joinPackage(config.getParent(), config.getEntity())); this.packageInfo.put("Mapper", this.joinPackage(config.getParent(), config.getMapper())); this.packageInfo.put("Xml", this.joinPackage(config.getParent(), config.getXml())); this.packageInfo.put("Service", this.joinPackage(config.getParent(), config.getService())); this.packageInfo.put("ServiceImpl", this.joinPackage(config.getParent(), config.getServiceImpl())); this.packageInfo.put("Controller", this.joinPackage(config.getParent(), config.getController())); this.pathInfo = new HashMap(); if(StringUtils.isNotEmpty(template.getEntity(this.getGlobalConfig().isKotlin()))) { this.pathInfo.put("entity_path", this.joinPath(outputDir, (String)this.packageInfo.get("Entity"))); }

怎么获取GlobalConfig内容

怎么能获取到mybatisplus配置项里面的值,既GlobalConfig里面的内容?
例如,想实现在插入时给公共字段deleted 赋默认值,想获取GlobalConfig里面的默认值

mapper selectOne 数据库存在多条数据时会出现TooManyResultsException

mp版本:3.3.2

复现步骤: 使用mapper的selectOne进行查询,当数据库存在多条满足queryWrapper数据时会出现TooManyResultsException

2020-08-25 11:46:05 [http-nio-8081-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] -Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2] with root cause
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
	at com.sun.proxy.$Proxy68.selectOne(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:108)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:96)
	at com.sun.proxy.$Proxy69.selectOne(Unknown Source)
	at com.etekcity.it.storageservice.service.impl.ApplicationConfigServiceImpl.selectOne(ApplicationConfigServiceImpl.java:33)
	at com.etekcity.it.storageservice.service.impl.ApplicationConfigServiceImpl$$FastClassBySpringCGLIB$$9e4e08c6.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:687)
	at com.etekcity.it.storageservice.service.impl.ApplicationConfigServiceImpl$$EnhancerBySpringCGLIB$$1b905e18.selectOne(<generated>)
	at com.etekcity.it.storageservice.controller.BucketController.delete(BucketController.java:70)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)

springboot 集成3.0-gamma版本,启动出错

Reason: Failed to convert property value of type 'java.lang.String' to required type 'com.baomidou.mybatisplus.core.handlers.MetaObjectHandler' for property 'globalConfig.metaObjectHandler'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'com.baomidou.mybatisplus.core.handlers.MetaObjectHandler' for property 'metaObjectHandler': no matching editors or conversion strategy found

关联查询

请问mybatis-plus有关联查询吗?例如:一个老师对象里有多个学生对象,怎么在查询老师的时候把对应的学生找出来?只能手动地更改mapper.xml文件,加上吗?但是一旦表结构变化的话,重新生成mapper.xml文件,自己新增的内容就会被覆盖

用了AOP切面切换数据源,实体类状态类字段用枚举类型,实现了IEnum接口,新增和查询都失败

mybatis-plus 使用版本

com.baomidou
mybatis-plus-boot-starter
3.1.0

新增数据库入库的字段值是枚举的name和int 类型不匹配。
查询异常:

[14:08:19.256] ERROR com.task.job.BaseJob 50 execute - 任务执行异常 : org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'order_status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.task.component.enums.RightStatusEnum.1
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-2.0.0.jar:2.0.0]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-2.0.0.jar:2.0.0]
at com.sun.proxy.$Proxy103.selectList(Unknown Source) ~[?:?]
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) ~[mybatis-spring-2.0.0.jar:2.0.0]
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:125) ~[mybatis-plus-core-3.1.0.jar:3.1.0]
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:94) ~[mybatis-plus-core-3.1.0.jar:3.1.0]
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61) ~[mybatis-plus-core-3.1.0.jar:3.1.0]
at com.sun.proxy.$Proxy111.selectPage(Unknown Source) ~[?:?]
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.page(ServiceImpl.java:277) ~[mybatis-plus-extension-3.1.0.jar:3.1.0]
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl$$FastClassBySpringCGLIB$$76535273.invoke() ~[mybatis-plus-extension-3.1.0.jar:3.1.0]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at com..task.service.impl.RightOrderServiceImpl$$EnhancerBySpringCGLIB$$c695d69b.page() ~[classes/:?]
at com..task.service.impl.JobServiceImpl.handleRightOrder(JobServiceImpl.java:68) ~[classes/:?]
at com..task.service.impl.JobServiceImpl$$FastClassBySpringCGLIB$$965ed6d4.invoke() ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at com..task.service.impl.JobServiceImpl$$EnhancerBySpringCGLIB$$fac27e43.handleRightOrder() ~[classes/:?]
at com.task.job.RightJob.doExecute(RightJob.java:11) ~[classes/:?]
at com.task.job.RightJob.doExecute(RightJob.java:1) ~[classes/:?]
at com.task.job.BaseJob.execute(BaseJob.java:48) [classes/:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar:?]
Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'order_status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com..task.component.enums.RightStatusEnum.1
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:83) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:521) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:402) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:354) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:328) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:301) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:194) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[mybatis-3.5.0.jar:3.5.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.5.0.jar:3.5.0]
at com.sun.proxy.$Proxy142.query(Unknown Source) ~[?:?]
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.5.0.jar:3.5.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-2.0.0.jar:2.0.0]
... 29 more
Caused by: java.lang.IllegalArgumentException: No enum constant com..task.component.enums.RightStatusEnum.1
at java.lang.Enum.valueOf(Enum.java:238) ~[?:1.8.0_131]
at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:49) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:26) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:81) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:521) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:402) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:354) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:328) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:301) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:194) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[mybatis-3.5.0.jar:3.5.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.5.0.jar:3.5.0]
at com.sun.proxy.$Proxy142.query(Unknown Source) ~[?:?]
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.5.0.jar:3.5.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-2.0.0.jar:2.0.0]
... 29 more

逻辑删除字段是日期

文档有这句话:
如果数据库字段使用datetime,逻辑未删除值和已删除值支持配置为字符串null,另一个值支持配置为函数来获取值如now()

但是设置null会报错,应该如何设置呢?

文档错误-自动填充说明文档有误

当前使用版本(必填,否则不予处理)

3.4.1

该问题是如何引起的?(确定最新版也有问题再提!!!)

最新版官网文档错误

重现步骤(如果有就写完整)

官网链接:https://baomidou.com/guide/auto-fill-metainfo.html
github链接:https://github.com/baomidou/mybatis-plus-doc/blob/master/guide/auto-fill-metainfo.md

报错信息

自定义实现类中insertFill中第二个方法起始版本 3.3.3(推荐)调用的方法名写错了,如果使用该文档写的this.strictUpdateFill是没有作用的,应当改为this.strictInsertFill
image

BindingException

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xyhj.tacu.dao.UsersMapper.selectList

at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy115.selectList(Unknown Source)
at com.xyhj.tacu.web.SimpleTest.select(SimpleTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

自带方法调用报错,springboot项目配置了多个数据源
配置如下
image
image

-----pom

com.baomidou
mybatis-plus-boot-starter
3.1.2

------------- UsersMapper.java
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xyhj.tacu.entity.User;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UsersMapper extends BaseMapper {
}

CRUD接口-Service CRUD 接口-Update文档说明错误

当前使用版本(必填,否则不予处理)

3.3.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

通过官网的API进行开发,在使用#Update功能时,发现了实际功能与文档说明不符,而且是正好的相反的情况。

重现步骤(如果有就写完整)

CRUD接口-Service CRUD 接口-Update

报错信息

CRUD接口-Service CRUD 接口-Update
文档信息:
// 根据 whereEntity 条件,更新记录
boolean update(T entity, Wrapper updateWrapper);
但实际使用时发现该接口是根据 updateWrapper条件更新记录,而不是文档上写的whereEntity 条件,whereEntity实际是新数据。

PR地址

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.