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(); Configuration configuration = new Configuration();
PathMatchingResourcePatternResolver resolver=new PathMatchingResourcePatternResolver(); PathMatchingResourcePatternResolver resolver=new PathMatchingResourcePatternResolver();
try { try {
String path="classpath*:/"+dataSourceModel.getPackageName().replaceAll("\\.","/")+"/*.xml"; LOG.info("Mapper匹配规则"+dataSourceModel.getMapperXmlPath());
LOG.info("Mapper匹配规则"+path); factoryBean.setMapperLocations(resolver.getResources(dataSourceModel.getMapperXmlPath()));
factoryBean.setMapperLocations(resolver.getResources(path));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("mapper匹配规则解析出错"); throw new RuntimeException("mapper匹配规则解析出错");
} }

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

Loading…
Cancel
Save