原文链接:https://my.oschina.net/u/4157150/blog/4282150

步骤1 加载dao文件,即dao接口文件

加载方式1.在dao接口上增加mapper注解

@Mapper
public interface AuthFunctionRepo extends BaseRepository<AuthFunction> 

加载方式2.在启动类加扫描注解

@MapperScan(basePackages = {"com.yxl.smart.auth.repo"}) 
或者@MapperScan("com.yxl.smart.auth.repo")

两种方式配置一种即可。重复配置也不会报错。

步骤2 加载mapper.xml文件

在属性文件中指定xml文件路径。

mybatis-plus:
  mapper-locations: classpath:com/yxl/smart/auth/repo/*.xml

MyBatis-Plus 使用xml文件

xml文件在resources文件夹内路径配置方式

MyBatis-Plus 使用xml文件

相关文章:

  • 2021-08-29
  • 2021-10-31
  • 2021-05-20
  • 2021-11-19
  • 2021-08-11
  • 2022-12-23
  • 2021-12-22
  • 2021-06-23
猜你喜欢
  • 2022-01-24
  • 2021-12-20
  • 2021-10-12
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案