File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed
src/main/java/com/yi/project Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .yi .project .bean ;
2+
3+ public class FestFulBean <T > {
4+
5+ private int status ;
6+ private T data ;
7+ private String msg ;
8+
9+ public int getStatus () {
10+ return status ;
11+ }
12+
13+ public void setStatus (int status ) {
14+ this .status = status ;
15+ }
16+
17+ public T getData () {
18+ return data ;
19+ }
20+
21+ public void setData (T data ) {
22+ this .data = data ;
23+ }
24+
25+ public String getMsg () {
26+ return msg ;
27+ }
28+
29+ public void setMsg (String msg ) {
30+ this .msg = msg ;
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package com .yi .project .controller ;
2+
3+ import org .springframework .web .bind .annotation .RequestMapping ;
4+ import org .springframework .web .bind .annotation .RequestMethod ;
5+ import org .springframework .web .bind .annotation .RestController ;
6+
7+ @ RestController
8+ public class cityContoller {
9+
10+ @ RequestMapping (value ="/addCity" ,method = RequestMethod .GET )
11+ public boolean addCity () {
12+ System .out .println ("开始新增..." );
13+ return true ;
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ package com .yi .project .controller ;
2+
3+
4+ import com .yi .project .bean .FestFulBean ;
5+ import org .springframework .web .bind .annotation .RequestMapping ;
6+ import org .springframework .web .bind .annotation .RequestMethod ;
7+ import org .springframework .web .bind .annotation .RequestParam ;
8+ import org .springframework .web .bind .annotation .RestController ;
9+
10+ @ RestController
11+ public class user {
12+
13+ @ RequestMapping (value = "/user" , method = RequestMethod .GET )
14+ public FestFulBean <String > user (@ RequestParam String username ) {
15+ FestFulBean <String > restful = new FestFulBean <String >();
16+ restful .setData ("hello, " + username + " welcom to my website!" );
17+ restful .setStatus (0 );
18+ restful .setMsg ("成功" );
19+ return restful ;
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments