11package com .tml .otowbackend .engine .generator .template .java .service ;
2+
23import com .baomidou .mybatisplus .core .toolkit .StringUtils ;
34import com .tml .otowbackend .engine .generator .template .java .ClassTemplate ;
45import com .tml .otowbackend .engine .generator .template .meta .MetaAnnotation ;
@@ -33,19 +34,20 @@ public ControllerTemplate(String packagePath, String className, String urlPath)
3334 addAnnotation (new MetaAnnotation (RequestMapping .class , urlPath ));
3435 }
3536
36- public static String getControllerClassName (String className ){
37- return className + "Controller" ;
37+ public static String getControllerClassName (String className ) {
38+ return className + "Controller" ;
3839 }
3940
4041 public String getUrlPath () {
4142 return urlPath ;
4243 }
4344
44- public void setCommonResult (String commonResult ,Class <?> clazz ){
45+ public void setCommonResult (String commonResult , Class <?> clazz ) {
4546 this .commonResult = commonResult ;
4647 addImportClazz (clazz );
4748 }
48- public void addService (ServiceTemplate serviceTemplate ){
49+
50+ public void addService (ServiceTemplate serviceTemplate ) {
4951 this .services .add (serviceTemplate );
5052 String serviceClass = serviceTemplate .getClassName ();
5153 String servicePackage = serviceTemplate .getAllPackagePath ();
@@ -56,27 +58,28 @@ public void addService(ServiceTemplate serviceTemplate){
5658 this .addImportPath (servicePackage );
5759 }
5860
59- public void addPostMethod (MetaMethod method , String path ){
61+ public void addPostMethod (MetaMethod method , String path ) {
6062 method .addAnnotations (List .of (new MetaAnnotation (PostMapping .class , path )));
6163 this .addMethod (method );
6264 }
6365
64- public void addGetMethod (MetaMethod method , String path ){
66+ public void addGetMethod (MetaMethod method , String path ) {
6567 method .addAnnotations (List .of (new MetaAnnotation (GetMapping .class , path )));
6668 this .addMethod (method );
6769 }
6870
69- public void addDeleteMethod (MetaMethod method , String path ){
71+ public void addDeleteMethod (MetaMethod method , String path ) {
7072 method .addAnnotations (List .of (new MetaAnnotation (DeleteMapping .class , path )));
7173 this .addMethod (method );
7274 }
7375
74- public void addMethod (MetaMethod method ){
76+ public void addMethod (MetaMethod method ) {
7577 this .apiMethod .add (method );
7678 super .addMethod (method );
7779 }
80+
7881 @ Override
79- public void initAnnotations (){
82+ public void initAnnotations () {
8083 addAnnotations (MetaAnnotation .convertByClazz (CONTROLLER_ANNOTATION ));
8184 }
8285}
0 commit comments