解决mybatis-generator生成Mapper文件没有Selective结尾的问题
一开始从网上找的generatorConfig.xml内容如下:
... ...
发现运行生成代码的maven插件后,Mapper.java和Mapper.xml中都没有Selective结尾的方法(insertSelective、updateByPrimaryKeySelective)。
后来发现是context标签的targetRuntime属性的原因,将其设置为MyBatis3即可。
补充知识:MyBatisPlus中selectPage方法。返回的total为空问题
我记得我在哪里看到。好像哪个版本之后是不需要加分页插件的。
importcom.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; importorg.springframework.context.annotation.Bean; importorg.springframework.context.annotation.Configuration; @Configuration publicclassMyBatisPlusConfig{ @Bean publicPaginationInterceptorpaginationInterceptor(){ PaginationInterceptorpage=newPaginationInterceptor(); page.setDialectType("mysql"); returnpage; } }
加上这个类问题基本就解决了
如果没解决。看一下项目中有没有pagehelper的依赖。如果有的话去掉就好了。
以上这篇解决mybatis-generator生成Mapper文件没有Selective结尾的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。