|
@@ -11,9 +11,11 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import com.qmth.cqb.paper.dao.PaperRepo;
|
|
import com.qmth.cqb.paper.model.PaperDetail;
|
|
import com.qmth.cqb.paper.model.PaperDetail;
|
|
import com.qmth.cqb.paper.model.PaperDetailUnit;
|
|
import com.qmth.cqb.paper.model.PaperDetailUnit;
|
|
import com.qmth.cqb.paper.service.PaperDetailService;
|
|
import com.qmth.cqb.paper.service.PaperDetailService;
|
|
@@ -33,6 +35,9 @@ public class PaperDetailController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
PaperService paperService;
|
|
PaperService paperService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ PaperRepo paperRepo;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取大题对应的小题
|
|
* 获取大题对应的小题
|
|
@@ -64,9 +69,11 @@ public class PaperDetailController {
|
|
* @param pd
|
|
* @param pd
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @ApiOperation(value = "更新大题", notes = "更新大题")
|
|
|
|
|
|
+ @ApiOperation(value = "更新试卷中的大题", notes = "更新试卷中的大题")
|
|
@PutMapping(value = "/paperDetail")
|
|
@PutMapping(value = "/paperDetail")
|
|
- public ResponseEntity updatePaperDetail(@ModelAttribute PaperDetail pd) {
|
|
|
|
|
|
+ public ResponseEntity updatePaperDetail(@PathVariable String paperId,
|
|
|
|
+ @RequestBody PaperDetail pd) {
|
|
|
|
+ pd.setPaper(paperRepo.findOne(paperId));
|
|
PaperDetail paperDetail = paperDetailService.savePaperDetail(pd);
|
|
PaperDetail paperDetail = paperDetailService.savePaperDetail(pd);
|
|
return new ResponseEntity(paperDetail, HttpStatus.OK);
|
|
return new ResponseEntity(paperDetail, HttpStatus.OK);
|
|
|
|
|
|
@@ -80,7 +87,7 @@ public class PaperDetailController {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "新增大题", notes = "新增大题")
|
|
@ApiOperation(value = "新增大题", notes = "新增大题")
|
|
@PostMapping(value = "/paperDetail")
|
|
@PostMapping(value = "/paperDetail")
|
|
- public ResponseEntity addPaperDetail(@ModelAttribute PaperDetail pd) {
|
|
|
|
|
|
+ public ResponseEntity addPaperDetail(@RequestBody PaperDetail pd) {
|
|
PaperDetail paperDetail = paperDetailService.savePaperDetail(pd);
|
|
PaperDetail paperDetail = paperDetailService.savePaperDetail(pd);
|
|
return new ResponseEntity(paperDetail, HttpStatus.OK);
|
|
return new ResponseEntity(paperDetail, HttpStatus.OK);
|
|
}
|
|
}
|