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 66import lombok .Getter ;
77import lombok .Setter ;
88import org .springframework .data .domain .Page ;
9- import org .springframework .web .bind .annotation .RequestMethod ;
109import org .springframework .web .bind .annotation .ResponseBody ;
1110
1211import java .lang .reflect .Method ;
1817public class ScriptMapping {
1918
2019 private String mapping ;
21- private RequestMethod requestMethod ;
20+ private ScriptMethod scriptMethod ;
2221 private String script ;
2322
2423
25- public ScriptMapping (String mapping , RequestMethod requestMethod , String script ) {
24+ public ScriptMapping (String mapping , ScriptMethod scriptMethod , String script ) {
2625 this .mapping = mapping ;
27- this .requestMethod = requestMethod ;
26+ this .scriptMethod = scriptMethod ;
2827 this .script = script ;
2928 }
3029
Original file line number Diff line number Diff line change 33import com .codingapi .springboot .fast .mapping .MvcMappingRegister ;
44import com .codingapi .springboot .framework .dto .response .Response ;
55import lombok .AllArgsConstructor ;
6- import org .springframework .web .bind .annotation .RequestMethod ;
76
87@ AllArgsConstructor
98public class ScriptMappingRegister {
@@ -16,7 +15,7 @@ public class ScriptMappingRegister {
1615 * @param scriptMapping dynamic mapping
1716 **/
1817 public void addMapping (ScriptMapping scriptMapping ) {
19- mappingRegister .addMapping (scriptMapping .getMapping (), scriptMapping .getRequestMethod (),
18+ mappingRegister .addMapping (scriptMapping .getMapping (), scriptMapping .getScriptMethod (). toRequestMethod (),
2019 scriptMapping , scriptMapping .getExecuteMethod ());
2120 }
2221
@@ -38,8 +37,8 @@ public Response test(ScriptMapping scriptMapping) {
3837 * @param url mapping url
3938 * @param requestMethod request method
4039 */
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 () );
4342 }
4443
4544
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