|
@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.service.core.api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
import cn.com.qmth.examcloud.service.core.entity.Student;
|
|
import cn.com.qmth.examcloud.service.core.entity.Student;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.entity.UserRole;
|
|
import cn.com.qmth.examcloud.service.core.enums.LoginType;
|
|
import cn.com.qmth.examcloud.service.core.enums.LoginType;
|
|
import cn.com.qmth.examcloud.service.core.repo.StudentRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.StudentRepo;
|
|
import cn.com.qmth.examcloud.service.core.service.StudentService;
|
|
import cn.com.qmth.examcloud.service.core.service.StudentService;
|
|
@@ -63,6 +65,9 @@ public class StudentApi {
|
|
@PostMapping
|
|
@PostMapping
|
|
public ResponseEntity addStudent(@RequestBody Student student){
|
|
public ResponseEntity addStudent(@RequestBody Student student){
|
|
student.setCreateTime(new Date());
|
|
student.setCreateTime(new Date());
|
|
|
|
+ List<UserRole> userRoles = new ArrayList<UserRole>();
|
|
|
|
+ userRoles.add(new UserRole("ecs_oe","STUDENT"));
|
|
|
|
+ student.getUser().setUserRoles(userRoles);
|
|
return new ResponseEntity(studentService.save(student),HttpStatus.CREATED);
|
|
return new ResponseEntity(studentService.save(student),HttpStatus.CREATED);
|
|
}
|
|
}
|
|
|
|
|