Skip to content

Commit 6cb5d2b

Browse files
author
hewei
committed
pull#120 增加对老版本兼容,补充测试用例
1 parent 518af47 commit 6cb5d2b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/itfsw/mybatis/generator/plugins/MapperAnnotationPlugin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass,
5858
String annotationName = prop.getKey().toString().trim();
5959
String annotationImport = prop.getValue().toString().trim();
6060
// TODO 兼容老版本
61-
if ("@Repository".equals(annotationName) && StringUtility.isTrue(annotationImport)) {
62-
interfaze.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Repository"));
63-
interfaze.addAnnotation("@Repository");
61+
if ("@Repository".equals(annotationName) && ("true".equalsIgnoreCase(annotationImport) || "false".equalsIgnoreCase(annotationImport))) {
62+
if (StringUtility.isTrue(annotationImport)) {
63+
interfaze.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Repository"));
64+
interfaze.addAnnotation("@Repository");
65+
}
6466
} else if (!"@Mapper".equals(annotationName)) {
6567
interfaze.addImportedType(new FullyQualifiedJavaType(annotationImport));
6668
interfaze.addAnnotation(annotationName);

0 commit comments

Comments
 (0)