baomidou / mybatis-plus-doc Goto Github PK
View Code? Open in Web Editor NEWMyBatis-Plus Official Documentation
Home Page: https://baomidou.com
MyBatis-Plus Official Documentation
Home Page: https://baomidou.com
你好,最新的文档为什么现在都是空白,example:http://mp.baomidou.com/guide/enum.html
文档只是简要的说明,例如如何对一些配置进行操作根本不知道要从何得知,要一遍遍的不断试才能够明白,有的还试不明白,真的有些糟糕
比如工程分为三个模块:
web
service
dao
如何配置让自动生成的代码各自归位,即 Controller 生成到 web 模块;service 生成到 service 模块;mapper 生成到 dao 模块。
解决了:
https://github.com/liushuijinger/mp-multi-module-generator
为什么废弃热加载?
3.3.2
通过官网的API进行开发,在使用#Update功能时,发现了实际功能与文档说明不符,而且是正好的相反的情况。
CRUD接口-Service CRUD 接口-Update
CRUD接口-Service CRUD 接口-Update
文档信息:
// 根据 whereEntity 条件,更新记录
boolean update(T entity, Wrapper updateWrapper);
但实际使用时发现该接口是根据 updateWrapper条件更新记录,而不是文档上写的whereEntity 条件,whereEntity实际是新数据。
你好! 非常感谢关注我的麻烦.
update和insert方法都需要返回实体给前端, 但是像created, updated这些字段, 他是由数据库自动加入的, 请问有没办法获取数据库自动加入的值, 实在没办法也可以手动注入一个, 目前我用aop 切update, insert等方法. 有没有更合适的方案呢.
文档有这句话:
如果数据库字段使用datetime,逻辑未删除值和已删除值支持配置为字符串null,另一个值支持配置为函数来获取值如now()
但是设置null会报错,应该如何设置呢?
mybatis.plus网站好卡啊,mp.baomidou.com在电脑上的浏览器直接进不去,ie,firefox,chrome,edge都试过了,卡的吓人
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)
看到select和update多处用到Wrapper,但是文档上并没有说明在service层传参时如何传入Wrapper类型的参数,还有就是关于条件构造器如何在service层使用,希望添加这些相关的。
3.4.0版本中, OptimisticLockerInterceptor
以及PaginationInterceptor
类已被弃用, 请更新文档最新使用方法
https://mybatis.plus/guide/#%E4%BC%98%E7%A7%80%E6%A1%88%E4%BE%8B
这个 jeeweb-mybatis:JeeWeb 敏捷开发平台
发生这一异常的原因也可能是依赖包冲突引起的。
springboot项目解决办法:
将pom.xml 中的mybatis依赖
org.mybatis.spring.boot
mybatis-spring-boot-starter
换成
com.baomidou
mybatisplus-spring-boot-starter
xxx
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 使用版本
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
https://mybatis.plus/guide/#%E4%BC%98%E7%A7%80%E6%A1%88%E4%BE%8B
Crab:WEB 极速开发框架
增加逻辑删除字段后,有的时候查询想要查询已删除的,但是自动添加逻辑删除不能查询
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"))); }
ac-blog:适合学生的一款ac博客网站
源码地址:https://github.com/memo012/ac-blog
请问mybatis-plus有关联查询吗?例如:一个老师对象里有多个学生对象,怎么在查询老师的时候把对应的学生找出来?只能手动地更改mapper.xml文件,加上吗?但是一旦表结构变化的话,重新生成mapper.xml文件,自己新增的内容就会被覆盖
有的话能不能push一下,想看老版本的文档,比如3.1.2
谢谢
谁能告诉我应该怎么开始?
使用 baseMapper 中的 crud 可以自动填充指定字段,但是自己写的语句中填充失败.
那不实现Serializable接口不就可以了吗?传输时会因为没有实现该接口而报错,为什么非要实现这个接口呢?
mybatis-plus-doc/guide/sql-injector.md no longer apply to version 3.3.1
FastOS 基于经典技术组合(Spring Boot、Spring MVC、Apache Shiro、MyBatis-Plus、Freemarker、Bootstrap、AdminLTE)采用经典开发模式 https://gitee.com/zhouhuanOGP/J2EEFAST
在多数据源配置的时候mysql5.7和mysql8可以同时使用吗
怎么能获取到mybatisplus配置项里面的值,既GlobalConfig里面的内容?
例如,想实现在插入时给公共字段deleted 赋默认值,想获取GlobalConfig里面的默认值
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项目配置了多个数据源
配置如下
Since yesterday
自动导入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();
}
}
for example:
the method int BaseMapper.updateById(Serializable) now returns int instead of boolean, but documents are not updated correspondingly. It is misleading, what does the return value means? 0 for failure or success? What about 1,2,3? Will it return -1,-2-3 ?
<mybatis-plus.version>3.1.1</mybatis-plus.version>
saveBatch方法慢
saveBatch方法慢
文档中并未提及MySQL的JDBC连接的url中要加rewriteBatchedStatements参数,并保证5.1.13以上版本的驱动,才能实现高性能的批量插入。
建议在官网中提示一下
some time i only want to generate a specufic table code not all table code,how to do it?
idea:版本171
dao接口层无法自动生成对应的xml代码
例如 http://mp.baomidou.com/guide/page.html 等很多文档模块没有内容
我们和美国的开源项目差距还是很大啊
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
在nacos上配置数据源信息使用了npw.但mybatis plus在获取env变量解密npw的顺序比nacos拉取配置源还要早的问题.
dynamic-datasource-spring-boot-starter :版本为3.0.0,不能加载到多数据源,
子类没有声明需要自动填充的字段,其父类声明要自动填充的字段.在插入时,自动填充不起作用.
父类部分代码如下:
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;
...
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.