master
无限超频 6 years ago
parent a63143aeb0
commit 8b8a0abd0e
  1. 5
      mybatis/src/main/java/config/MyBatisConfig.java
  2. 10
      mybatis/src/main/java/model/DataSourceModel.java

@ -77,9 +77,8 @@ public class MyBatisConfig extends InitConfig {
Configuration configuration = new Configuration();
PathMatchingResourcePatternResolver resolver=new PathMatchingResourcePatternResolver();
try {
String path="classpath*:/"+dataSourceModel.getPackageName().replaceAll("\\.","/")+"/*.xml";
LOG.info("Mapper匹配规则"+path);
factoryBean.setMapperLocations(resolver.getResources(path));
LOG.info("Mapper匹配规则"+dataSourceModel.getMapperXmlPath());
factoryBean.setMapperLocations(resolver.getResources(dataSourceModel.getMapperXmlPath()));
} catch (IOException e) {
throw new RuntimeException("mapper匹配规则解析出错");
}

@ -12,7 +12,7 @@ public class DataSourceModel {
private String dbDesc;
private DBType dbType;
private String factoryBean;
private String packageName;
private String mapperXmlPath;
private String transactionManagerBean;
@JSONField
@ -88,12 +88,12 @@ public class DataSourceModel {
}
@JSONField
public String getPackageName() {
return packageName;
public String getMapperXmlPath() {
return mapperXmlPath;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
public void setMapperXmlPath(String mapperXmlPath) {
this.mapperXmlPath = mapperXmlPath;
}
@JSONField

Loading…
Cancel
Save