浏览代码

完善 ApiOperation 说明,区分 教师 学生。

tom 5 月之前
父节点
当前提交
6ba33b75b8

+ 5 - 2
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamCollectionController.java

@@ -39,7 +39,7 @@ public class RealExamCollectionController extends BaseController {
 
     // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:list')")
     @GetMapping("/list")
-    @ApiOperation("查询考试集合列表")
+    @ApiOperation("[老师]查询考试集合列表")
     public TableDataInfo list(RealExamCollection realExamCollection) {
         startPage();
         List<RealExamCollection> list = realExamCollectionService.selectRealExamCollectionList(realExamCollection);
@@ -63,7 +63,7 @@ public class RealExamCollectionController extends BaseController {
      */
     // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:query')")
     @GetMapping(value = "/{examCollectionId}")
-    @ApiOperation("获取考试集合详细信息")
+    @ApiOperation("[老师]获取考试集合详细信息")
     public AjaxResult getInfo(@PathVariable("examCollectionId") Long examCollectionId) {
         return success(realExamCollectionService.selectRealExamCollectionByExamCollectionId(examCollectionId));
     }
@@ -74,6 +74,7 @@ public class RealExamCollectionController extends BaseController {
     @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:add')")
     @Log(title = "考试集合", businessType = BusinessType.INSERT)
     @PostMapping
+    @ApiOperation("[老师]新增考试集合")
     public AjaxResult add(@RequestBody RealExamCollection realExamCollection) {
         return toAjax(realExamCollectionService.insertRealExamCollection(realExamCollection));
     }
@@ -84,6 +85,7 @@ public class RealExamCollectionController extends BaseController {
     @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:edit')")
     @Log(title = "考试集合", businessType = BusinessType.UPDATE)
     @PutMapping
+    @ApiOperation("[老师]修改考试集合")
     public AjaxResult edit(@RequestBody RealExamCollection realExamCollection) {
         return toAjax(realExamCollectionService.updateRealExamCollection(realExamCollection));
     }
@@ -94,6 +96,7 @@ public class RealExamCollectionController extends BaseController {
     @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:remove')")
     @Log(title = "考试集合", businessType = BusinessType.DELETE)
     @DeleteMapping("/{examCollectionIds}")
+    @ApiOperation("[老师]删除考试集合")
     public AjaxResult remove(@PathVariable Long[] examCollectionIds) {
         return toAjax(realExamCollectionService.deleteRealExamCollectionByExamCollectionIds(examCollectionIds));
     }

+ 14 - 12
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamController.java

@@ -6,12 +6,10 @@ import javax.servlet.http.HttpServletResponse;
 import com.ruoyi.sim.service.impl.RealExamService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -41,16 +39,16 @@ public class RealExamController extends BaseController {
      * 查询考试列表
      */
     // @PreAuthorize("@ss.hasPermi('sim:real-exam:list')")
-    // @GetMapping("/list")
-    // @ApiOperation("查询考试列表")
+    @GetMapping("/teacher/list")
+    @ApiOperation("[老师]查询学生考试列表")
     public TableDataInfo list(RealExam realExam) {
         startPage();
         List<RealExam> list = realExamService.selectRealExamList(realExam);
         return getDataTable(list);
     }
 
-    @GetMapping("/listByUserId/{userId}")
-    @ApiOperation("查询userId学生考试列表")
+    @GetMapping("/student/listByUserId/{userId}")
+    @ApiOperation("[学生]查询userId学生考试列表")
     public TableDataInfo listByUserId(@PathVariable("userId") Long userId) {
         // todo:
         RealExam realExam = new RealExam();
@@ -71,13 +69,17 @@ public class RealExamController extends BaseController {
         util.exportExcel(response, list, "考试数据");
     }
 
-    /**
-     * 获取考试详细信息
-     */
     // @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
-    @GetMapping(value = "/{examId}")
-    @ApiOperation("获取考试详细信息")
-    public AjaxResult getInfo(@PathVariable("examId") Long examId) {
+    @GetMapping(value = "/student/{examId}")
+    @ApiOperation("[学生]获取考试详细信息")
+    public AjaxResult getInfoStudent(@PathVariable("examId") Long examId) {
+        return success(realExamService.selectRealExamByExamId(examId));
+    }
+
+    // @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
+    @GetMapping(value = "/teacher/{examId}")
+    @ApiOperation("[老师]获取考试详细信息")
+    public AjaxResult getInfoTeacher(@PathVariable("examId") Long examId) {
         return success(realExamService.selectRealExamByExamId(examId));
     }