springboot通用mapper配置

一、pom.xml添加依赖
二、yml或properties配置文件添加配置
1、数据库配置
2、mybaties配置

mybatis:
  type-aliases-package: com.li.entity
  configuration:
    map-underscore-to-camel-case: true

三、启动类配置

@SpringBootApplication
@MapperScan("com.li.mapper")

public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class,args);
    }
}

四、编写接口mapper继承

public interface OrderMapper extends Mapper<Order> {
}

五、或者编写BaseMapper
我的demo会出现泛型错误,待解决


版权声明:本文为weixin_45611186原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。