|
|
|
@ -49,7 +49,7 @@ public class StudentController {
|
|
|
|
|
IPage<Student> res = studentService.findAll(
|
|
|
|
|
new Page<>(page, size), name, grade, tel, institute, major, clazz
|
|
|
|
|
);
|
|
|
|
|
return buildApiResult(200, "分页查询所有学生", res);
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "分页查询所有学生", res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -62,9 +62,9 @@ public class StudentController {
|
|
|
|
|
public R<Student> findById(@PathVariable("studentId") Integer studentId) {
|
|
|
|
|
Student res = studentService.findById(studentId);
|
|
|
|
|
if (res != null) {
|
|
|
|
|
return buildApiResult(200, "请求成功", res);
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功", res);
|
|
|
|
|
} else {
|
|
|
|
|
return buildApiResult(404, "查询的用户不存在", null);
|
|
|
|
|
return ApiResultHandler.buildApiResult(404, "查询的用户不存在", null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -76,7 +76,7 @@ public class StudentController {
|
|
|
|
|
*/
|
|
|
|
|
@DeleteMapping("/student/{studentId}")
|
|
|
|
|
public R<Integer> deleteById(@PathVariable("studentId") Integer studentId) {
|
|
|
|
|
return buildApiResult(200, "删除成功", studentService.deleteById(studentId));
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "删除成功", studentService.deleteById(studentId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -89,9 +89,9 @@ public class StudentController {
|
|
|
|
|
public R update(@RequestBody Student student) {
|
|
|
|
|
int res = studentService.update(student);
|
|
|
|
|
if (res != 0) {
|
|
|
|
|
return buildApiResult(200, "更新成功", res);
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "更新成功", res);
|
|
|
|
|
}
|
|
|
|
|
return buildApiResult(400, "更新失败", res);
|
|
|
|
|
return ApiResultHandler.buildApiResult(400, "更新失败", res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|