|
@@ -37,53 +37,53 @@ public class StudentFaceInfoApi {
|
|
|
@Autowired
|
|
|
StudentRepo studentRepo;
|
|
|
|
|
|
- @ApiOperation(value="按身份证查询",notes="查询")
|
|
|
+ @ApiOperation(value = "按身份证查询", notes = "查询")
|
|
|
@GetMapping("/identityNumber")
|
|
|
- public ResponseEntity findByIdentityNumber(@RequestParam Long orgId,@RequestParam String identityNumber){
|
|
|
- Student student = studentRepo.findByIdentityNumber(identityNumber);
|
|
|
- if(student == null){
|
|
|
- return new ResponseEntity(new ErrorMsg("该学生不存在"),HttpStatus.OK);
|
|
|
- }
|
|
|
- StudentFaceInfo studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
- if(studentFaceInfo == null){
|
|
|
- studentFaceInfo = new StudentFaceInfo();
|
|
|
- studentFaceInfo.setStudent(student);
|
|
|
- }
|
|
|
- return new ResponseEntity(studentFaceInfo,HttpStatus.OK);
|
|
|
+ public ResponseEntity findByIdentityNumber(@RequestParam String identityNumber) {
|
|
|
+ Student student = studentRepo.findByIdentityNumber(identityNumber);
|
|
|
+ if (student == null) {
|
|
|
+ return new ResponseEntity(new ErrorMsg("该学生不存在"), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ StudentFaceInfo studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
+ if (studentFaceInfo == null) {
|
|
|
+ studentFaceInfo = new StudentFaceInfo();
|
|
|
+ studentFaceInfo.setStudent(student);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(studentFaceInfo, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="按学号查询",notes="查询")
|
|
|
+
|
|
|
+ @ApiOperation(value = "按学号查询", notes = "查询")
|
|
|
@GetMapping("/studentCode")
|
|
|
- public ResponseEntity findByStudentCode(@RequestParam Long orgId,@RequestParam String studentCode){
|
|
|
- Student student = studentRepo.findByUserRootOrgIdAndStudentCode(orgId, studentCode);
|
|
|
- if(student == null){
|
|
|
- return new ResponseEntity(new ErrorMsg("该学生不存在"),HttpStatus.OK);
|
|
|
- }
|
|
|
- StudentFaceInfo studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
- if(studentFaceInfo == null){
|
|
|
- studentFaceInfo = new StudentFaceInfo();
|
|
|
- studentFaceInfo.setStudent(student);
|
|
|
- }
|
|
|
- return new ResponseEntity(studentFaceInfo,HttpStatus.OK);
|
|
|
+ public ResponseEntity findByStudentCode(@RequestParam Long orgId, @RequestParam String studentCode) {
|
|
|
+ Student student = studentRepo.findByUserRootOrgIdAndStudentCode(orgId, studentCode);
|
|
|
+ if (student == null) {
|
|
|
+ return new ResponseEntity(new ErrorMsg("该学生不存在"), HttpStatus.OK);
|
|
|
+ }
|
|
|
+ StudentFaceInfo studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
+ if (studentFaceInfo == null) {
|
|
|
+ studentFaceInfo = new StudentFaceInfo();
|
|
|
+ studentFaceInfo.setStudent(student);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(studentFaceInfo, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="按ID查询",notes="ID查询")
|
|
|
+
|
|
|
+ @ApiOperation(value = "按ID查询", notes = "ID查询")
|
|
|
@GetMapping("/{id}")
|
|
|
- public ResponseEntity getById(@PathVariable Long id){
|
|
|
- return new ResponseEntity(studentFaceInfoRepo.findOne(id),HttpStatus.OK);
|
|
|
+ public ResponseEntity getById(@PathVariable Long id) {
|
|
|
+ return new ResponseEntity(studentFaceInfoRepo.findOne(id), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="新增学生照片信息",notes="新增")
|
|
|
+ @ApiOperation(value = "新增学生照片信息", notes = "新增")
|
|
|
@PostMapping
|
|
|
- public ResponseEntity add(@RequestBody StudentFaceInfo studentFaceInfo){
|
|
|
- return new ResponseEntity(studentFaceInfoService.save(studentFaceInfo),HttpStatus.CREATED);
|
|
|
+ public ResponseEntity add(@RequestBody StudentFaceInfo studentFaceInfo) {
|
|
|
+ return new ResponseEntity(studentFaceInfoService.save(studentFaceInfo), HttpStatus.CREATED);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新学生照片信息",notes="更新")
|
|
|
+ @ApiOperation(value = "更新学生照片信息", notes = "更新")
|
|
|
@PutMapping
|
|
|
- public ResponseEntity update(@RequestBody StudentFaceInfo studentFaceInfo){
|
|
|
- studentFaceInfo.setUpdateTime(new Date());
|
|
|
- return new ResponseEntity(studentFaceInfoRepo.save(studentFaceInfo),HttpStatus.OK);
|
|
|
+ public ResponseEntity update(@RequestBody StudentFaceInfo studentFaceInfo) {
|
|
|
+ studentFaceInfo.setUpdateTime(new Date());
|
|
|
+ return new ResponseEntity(studentFaceInfoRepo.save(studentFaceInfo), HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|