Skip to content

Commit 70fa404

Browse files
committed
add controller
1 parent 7cdc40b commit 70fa404

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}

0 commit comments

Comments
 (0)