提交 67a7f3c5 authored 作者: xurui's avatar xurui

aaa

上级 5ac452c0
...@@ -27,9 +27,17 @@ public class Controller{ ...@@ -27,9 +27,17 @@ public class Controller{
} }
@RequestMapping(value = "/add",method = RequestMethod.POST) @RequestMapping(value = "/add",method = RequestMethod.POST)
String add(@RequestBody Student s) { String add(@RequestBody Student s) {
//添加学生
try { try {
if (s.getName().equals("")){
return "请输入姓名";
}
if (s.getAge().equals("")){
return "请输入年龄";
}
if (s.getSex().equals("")){
return "请输入性别";
}
//添加学生
Integer add = stuservice.add(s); Integer add = stuservice.add(s);
if (add>=1){ if (add>=1){
return "添加成功!"; return "添加成功!";
...@@ -42,7 +50,7 @@ public class Controller{ ...@@ -42,7 +50,7 @@ public class Controller{
} }
@RequestMapping(value = "/update",method = RequestMethod.PUT) @RequestMapping(value = "/update",method = RequestMethod.PUT)
String update(@RequestBody Student s){ String update(@RequestBody Student s){
//增加学生 //修改学生
Integer update = stuservice.update(s); Integer update = stuservice.update(s);
if(update<1){ if(update<1){
return "修改失败!"; return "修改失败!";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论