提交 c9e38db9 authored 作者: xurui's avatar xurui

aaa

上级 03617e8d
......@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
##### 说明
```
Post /stus/add
Post /students/insertion
```
- 通过传递学生对象处理学生新增操作。
......@@ -54,7 +54,7 @@ Post /stus/add
##### 说明
```
Delete /stus/delete
Delete /students/
```
- 通过传递学生id处理学生删除操作。
......@@ -72,7 +72,7 @@ Delete /stus/delete
通过传递学生对象处理学生修改操作。
```
Put /stus/update
Put /students/updation
```
- 业务层方法:update()
......@@ -89,7 +89,7 @@ Put /stus/update
通过传递学生id处理学生查询操作。
```
Get /stus/select
Get /students/
```
- 业务层方法:select()
......
......@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.*;
* 浏览器通过映射地址找到本类方法
*/
@RestController
@RequestMapping("/stus")
@RequestMapping("/students")
public class Controller{
@Autowired
StuService stuservice;
@RequestMapping(value = "/select/{id}",method = RequestMethod.GET)
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
String select(@PathVariable Integer id){
//通过id查找学生
Student select = stuservice.select(id);
......@@ -25,7 +25,7 @@ public class Controller{
Gson gson = new Gson();
return gson.toJson(select);
}
@RequestMapping(value = "/add",method = RequestMethod.POST)
@RequestMapping(value = "/insertion",method = RequestMethod.POST)
String add(@RequestBody Student s) {
try {
if (s.getName().equals("")){
......@@ -48,7 +48,7 @@ public class Controller{
return "参数错误";
}
}
@RequestMapping(value = "/update",method = RequestMethod.PUT)
@RequestMapping(value = "/updation",method = RequestMethod.PUT)
String update(@RequestBody Student s){
//修改学生
Integer update = stuservice.update(s);
......@@ -57,7 +57,7 @@ public class Controller{
}
return "修改成功!";
}
@RequestMapping(value = "/delete/{id}",method = RequestMethod.DELETE)
@RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
String delect(@PathVariable Integer id){
//通过id删除学生
Integer delete = stuservice.delete(id);
......
......@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
##### 说明
```
Post /stus/add
Post /students/insertion
```
- 通过传递学生对象处理学生新增操作。
......@@ -54,7 +54,7 @@ Post /stus/add
##### 说明
```
Delete /stus/delete
Delete /students/
```
- 通过传递学生id处理学生删除操作。
......@@ -72,7 +72,7 @@ Delete /stus/delete
通过传递学生对象处理学生修改操作。
```
Put /stus/update
Put /students/updation
```
- 业务层方法:update()
......@@ -89,7 +89,7 @@ Put /stus/update
通过传递学生id处理学生查询操作。
```
Get /stus/select
Get /students/
```
- 业务层方法:select()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论