一开始从网上找的generatorConfig.xml内容如下:
... ...
发现运行生成代码的maven插件后,Mapper.java和Mapper.xml中都没有Selective结尾的方法(insertSelective、updateByPrimaryKeySelective)。
后来发现是context标签的targetRuntime属性的原因,将其设置为MyBatis3即可。
补充知识:MyBatis Plus中 selectPage 方法。返回的total为空问题
我记得我在哪里看到。好像哪个版本之后是不需要加分页插件的。
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyBatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor page = new PaginationInterceptor();
page.setDialectType("mysql");
return page;
}
}
加上这个类问题基本就解决了
如果没解决。看一下项目中有没有pagehelper的依赖。如果有的话去掉就好了。
以上这篇解决mybatis-generator生成Mapper文件没有Selective结尾的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



