File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed
springboot-starter-data-fast/src/main/java/com/codingapi/springboot/fast/script Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 6
6
import lombok .Getter ;
7
7
import lombok .Setter ;
8
8
import org .springframework .data .domain .Page ;
9
- import org .springframework .web .bind .annotation .RequestMethod ;
10
9
import org .springframework .web .bind .annotation .ResponseBody ;
11
10
12
11
import java .lang .reflect .Method ;
18
17
public class ScriptMapping {
19
18
20
19
private String mapping ;
21
- private RequestMethod requestMethod ;
20
+ private ScriptMethod scriptMethod ;
22
21
private String script ;
23
22
24
23
25
- public ScriptMapping (String mapping , RequestMethod requestMethod , String script ) {
24
+ public ScriptMapping (String mapping , ScriptMethod scriptMethod , String script ) {
26
25
this .mapping = mapping ;
27
- this .requestMethod = requestMethod ;
26
+ this .scriptMethod = scriptMethod ;
28
27
this .script = script ;
29
28
}
30
29
Original file line number Diff line number Diff line change 3
3
import com .codingapi .springboot .fast .mapping .MvcMappingRegister ;
4
4
import com .codingapi .springboot .framework .dto .response .Response ;
5
5
import lombok .AllArgsConstructor ;
6
- import org .springframework .web .bind .annotation .RequestMethod ;
7
6
8
7
@ AllArgsConstructor
9
8
public class ScriptMappingRegister {
@@ -16,7 +15,7 @@ public class ScriptMappingRegister {
16
15
* @param scriptMapping dynamic mapping
17
16
**/
18
17
public void addMapping (ScriptMapping scriptMapping ) {
19
- mappingRegister .addMapping (scriptMapping .getMapping (), scriptMapping .getRequestMethod (),
18
+ mappingRegister .addMapping (scriptMapping .getMapping (), scriptMapping .getScriptMethod (). toRequestMethod (),
20
19
scriptMapping , scriptMapping .getExecuteMethod ());
21
20
}
22
21
@@ -38,8 +37,8 @@ public Response test(ScriptMapping scriptMapping) {
38
37
* @param url mapping url
39
38
* @param requestMethod request method
40
39
*/
41
- public void removeMapping (String url , RequestMethod requestMethod ){
42
- mappingRegister .removeMapping (url , requestMethod );
40
+ public void removeMapping (String url , ScriptMethod scriptMethod ){
41
+ mappingRegister .removeMapping (url , scriptMethod . toRequestMethod () );
43
42
}
44
43
45
44
Original file line number Diff line number Diff line change
1
+ package com .codingapi .springboot .fast .script ;
2
+
3
+ import org .springframework .web .bind .annotation .RequestMethod ;
4
+
5
+ public enum ScriptMethod {
6
+
7
+ GET , POST ;
8
+
9
+
10
+ public RequestMethod toRequestMethod () {
11
+ if (this == GET ) {
12
+ return RequestMethod .GET ;
13
+ } else {
14
+ return RequestMethod .POST ;
15
+ }
16
+ }
17
+
18
+ }
You can’t perform that action at this time.
0 commit comments