-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2dccec
commit a7833d2
Showing
6 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/InjectorResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2011-2020, baomidou ([email protected]). | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.baomidou.mybatisplus.core; | ||
|
||
import org.apache.ibatis.builder.annotation.MethodResolver; | ||
|
||
/** | ||
* 继承 {@link MethodResolver} | ||
* | ||
* @author miemie | ||
* @since 2019-01-05 | ||
*/ | ||
public class InjectorResolver extends MethodResolver { | ||
|
||
private final MybatisMapperAnnotationBuilder annotationBuilder; | ||
|
||
public InjectorResolver(MybatisMapperAnnotationBuilder annotationBuilder) { | ||
super(annotationBuilder, null); | ||
this.annotationBuilder = annotationBuilder; | ||
} | ||
|
||
@Override | ||
public void resolve() { | ||
annotationBuilder.parserInjector(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...-core/src/test/java/com/baomidou/mybatisplus/core/MybatisMapperAnnotationBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.baomidou.mybatisplus.core; | ||
|
||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import org.apache.ibatis.annotations.CacheNamespace; | ||
import org.apache.ibatis.annotations.CacheNamespaceRef; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author miemie | ||
* @since 2020-11-07 | ||
*/ | ||
class MybatisMapperAnnotationBuilderTest { | ||
|
||
@Test | ||
void parse() { | ||
MybatisConfiguration configuration = new MybatisConfiguration(); | ||
MybatisMapperAnnotationBuilder a = new MybatisMapperAnnotationBuilder(configuration, AMapper.class); | ||
a.parse(); | ||
MybatisMapperAnnotationBuilder b = new MybatisMapperAnnotationBuilder(configuration, BMapper.class); | ||
b.parse(); | ||
configuration.getMappedStatement(AMapper.class.getName() + ".insert"); | ||
} | ||
|
||
@CacheNamespaceRef(BMapper.class) | ||
interface AMapper extends BaseMapper<A> { | ||
|
||
} | ||
|
||
@CacheNamespace | ||
interface BMapper extends BaseMapper<B> { | ||
|
||
} | ||
|
||
@Data | ||
private static class A { | ||
private Long id; | ||
} | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
private static class B extends A { | ||
|
||
} | ||
} |