1
1
package cn .alphahub .dtt .plus .config .support ;
2
2
3
3
import cn .alphahub .dtt .plus .config .DttProperties ;
4
+ import cn .alphahub .dtt .plus .entity .ContextWrapper ;
4
5
import cn .alphahub .dtt .plus .entity .ModelEntity ;
5
6
import cn .alphahub .dtt .plus .framework .ClassScanningProvider ;
6
7
import cn .alphahub .dtt .plus .framework .annotations .EnableDtt ;
7
- import cn .alphahub .dtt .plus .framework .core .DefaultJavaDocParser ;
8
+ import cn .alphahub .dtt .plus .framework .core .DttCommentParser ;
8
9
import cn .alphahub .dtt .plus .framework .core .ParseFactory ;
9
10
import lombok .AllArgsConstructor ;
10
11
import lombok .Builder ;
@@ -78,10 +79,10 @@ public class MyBatisPlusCodeGeneratorConfigurer {
78
79
* @return The class of mybatis-plus code generator
79
80
*/
80
81
@ Bean
81
- @ ConditionalOnBean ({VelocityEngine .class , DefaultJavaDocParser .class , ClassScanningProvider .class })
82
+ @ ConditionalOnBean ({VelocityEngine .class , ContextWrapper .class , ClassScanningProvider .class })
82
83
public MyBatisPlusCodeGeneratorPlaceholder myBatisPlusCodeGeneratorPlaceholder (CodeGeneratorProperties cgProperties ,
84
+ ContextWrapper contextWrapper ,
83
85
VelocityEngine velocityEngine ,
84
- DefaultJavaDocParser javaDocParser ,
85
86
ClassScanningProvider classScanningProvider
86
87
) {
87
88
MyBatisPlusCodeGeneratorPlaceholder placeholder = new MyBatisPlusCodeGeneratorPlaceholder ();
@@ -97,7 +98,7 @@ public MyBatisPlusCodeGeneratorPlaceholder myBatisPlusCodeGeneratorPlaceholder(C
97
98
return placeholder ;
98
99
}
99
100
100
- List <MyBatisPlusCodeWrapper > codeWrappers = getMyBatisPlusCodeWrappers (cgProperties , javaDocParser , classScanningProvider );
101
+ List <MyBatisPlusCodeWrapper > codeWrappers = getMyBatisPlusCodeWrappers (cgProperties , contextWrapper . getCommentParser () , classScanningProvider );
101
102
102
103
if (CollectionUtils .isEmpty (codeWrappers )) return placeholder ;
103
104
@@ -141,19 +142,19 @@ public MyBatisPlusCodeGeneratorPlaceholder myBatisPlusCodeGeneratorPlaceholder(C
141
142
* Get mybatis-plus code wrappers
142
143
*
143
144
* @param cgProperties The given MyBatis-Plus code generation configuration properties
144
- * @param javaDocParser The java doc parser
145
+ * @param commentParser The comment parser
145
146
* @param classScanningProvider The Class scanning provider
146
147
* @return mybatis-plus code wrappers
147
148
*/
148
- private List <MyBatisPlusCodeWrapper > getMyBatisPlusCodeWrappers (CodeGeneratorProperties cgProperties , DefaultJavaDocParser javaDocParser , ClassScanningProvider classScanningProvider ) {
149
+ private List <MyBatisPlusCodeWrapper > getMyBatisPlusCodeWrappers (CodeGeneratorProperties cgProperties , DttCommentParser < ModelEntity > commentParser , ClassScanningProvider classScanningProvider ) {
149
150
List <MyBatisPlusCodeWrapper > codeWrappers = new ArrayList <>();
150
151
151
152
if (StringUtils .isNoneBlank (cgProperties .getBasePackage ())) {
152
153
codeWrappers = classScanningProvider .scanBasePackage (cgProperties .getBasePackage ()).stream ()
153
154
.filter (className -> !className .getName ().endsWith ("Builder" ))
154
155
.map (aClass -> {
155
156
String modelComment = "" ;
156
- ParseFactory <ModelEntity > parseFactory = javaDocParser .parse (aClass .getName ());
157
+ ParseFactory <ModelEntity > parseFactory = commentParser .parse (aClass .getName ());
157
158
if (null != parseFactory .getModel ())
158
159
modelComment = StringUtils .defaultIfBlank (parseFactory .getModel ().getModelComment (), "" );
159
160
return MyBatisPlusCodeWrapper .builder ()
@@ -168,7 +169,7 @@ private List<MyBatisPlusCodeWrapper> getMyBatisPlusCodeWrappers(CodeGeneratorPro
168
169
if (ObjectUtils .isNotEmpty (cgProperties .getBaseClasses ())) {
169
170
for (Class <? extends Serializable > aClass : cgProperties .getBaseClasses ()) {
170
171
String modelComment = "" ;
171
- ParseFactory <ModelEntity > parseFactory = javaDocParser .parse (aClass .getName ());
172
+ ParseFactory <ModelEntity > parseFactory = commentParser .parse (aClass .getName ());
172
173
if (null != parseFactory .getModel ())
173
174
modelComment = StringUtils .defaultIfBlank (parseFactory .getModel ().getModelComment (), "" );
174
175
codeWrappers .add (MyBatisPlusCodeWrapper .builder ()
0 commit comments