SubjectTestPublishGradeController.java 3.45 KB
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.grade.AddGradeDTO;
import com.meishu.model.SubjectTestPublishGradeDO;
import com.meishu.service.SubjectTestPublishGradeService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 * 档次表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-06-21
 */
@RestController
@Api(tags = "档次表")
@RequestMapping("/subjectGrade")
public class SubjectTestPublishGradeController {

    @Autowired
    private SubjectTestPublishGradeService subjectTestPublishGradeService;

    @PostMapping("addGrade")
    @ApiOperation("添加一个档次  gradeName档次名称 publishId 发布id content 综合评价 subjectTestGradeExampleMappingDOS [exampleView 样卷地址]  subjectTestGradeStarMappingDOS [starId 星级id]")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addGrade(@RequestBody AddGradeDTO addGradeDTO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.addGrade(addGradeDTO));
    }

    @PostMapping("deleteGrade")
    @ApiOperation("删除一个档次  id 档次id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteGrade(@RequestBody SubjectTestPublishGradeDO subjectTestPublishGradeDO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.deleteGrade(subjectTestPublishGradeDO));
    }

    @PostMapping("queryGrade")
    @ApiOperation("查询档次全部档次")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO queryGrade(@RequestBody SubjectTestPublishGradeDO subjectTestPublishGradeDO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.queryGrade(subjectTestPublishGradeDO));
    }

    @PostMapping("queryOneGrade")
    @ApiOperation("查询单个档次 id")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO queryOneGrade(@RequestBody SubjectTestPublishGradeDO subjectTestPublishGradeDO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.queryOneGrade(subjectTestPublishGradeDO));
    }

    @PostMapping("updateGrade")
    @ApiOperation("编辑某个档次  id  gradeName档次名称 publishId 发布id  subjectTestGradeExampleMappingDOS [exampleView 样卷地址]  subjectTestGradeStarMappingDOS [starId 星级id] ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateGrade(@RequestBody AddGradeDTO addGradeDTO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.updateGrade(addGradeDTO));
    }

    @PostMapping("getRuleIdByPublishId")
    @ApiOperation("通过publishId查询ruleId {publishId 发布id}")
    public ResponseVO getRuleIdByPublishId(@RequestBody SubjectTestPublishGradeDO subjectTestPublishGradeDO){
        return ResponseData.generateCreatedResponse(0,subjectTestPublishGradeService.getRuleIdByPublishId(subjectTestPublishGradeDO));
    }


}