SubjectTestDictController.java 2.81 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.test.GetAllTestDTO;
import com.meishu.model.SubjectTestDictDO;
import com.meishu.service.SubjectTestDictService;
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-05-20
 */
@RestController
@Api(tags = "测评字典表")
@RequestMapping("/subjectTest")
public class SubjectTestDictController {

    @Autowired
    private SubjectTestDictService subjectTestService;

    @PostMapping("getAllTest")
    @ApiOperation("获取全部测评字典数据 分页   {ruleId   testName  pageSize  pageNum}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllTest(@RequestBody GetAllTestDTO getAllTestDTO){
        return ResponseData.generateCreatedResponse(0,subjectTestService.getAllTest(getAllTestDTO));
    }

    @PostMapping("getTest")
    @ApiOperation("获取全不对测评  不分页   {ruleId   testName}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getTest(@RequestBody  GetAllTestDTO getAllTestDTO){
        return ResponseData.generateCreatedResponse(0,subjectTestService.getTest(getAllTestDTO));
    }


    @PostMapping("insertTest")
    @ApiOperation("新增一个测评 {ruleId 规则id  testName:测评名称  examination:卷面}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO insertTest(@RequestBody SubjectTestDictDO subjectTestDictDO){
        return ResponseData.generateCreatedResponse(0,subjectTestService.insertTest(subjectTestDictDO));
    }

    @PostMapping("updateTest")
    @ApiOperation("修改一个测评 {id ruleId 规则id  testName:测评名称   examination:卷面} ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateTest(@RequestBody SubjectTestDictDO subjectTestDictDO){
        return ResponseData.generateCreatedResponse(0,subjectTestService.updateTest(subjectTestDictDO));
    }

    @PostMapping("deleteByTestId")
    @ApiOperation("删除一个测评 {id}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteByTestId(@RequestBody SubjectTestDictDO subjectTestDictDO){
        return ResponseData.generateCreatedResponse(0,subjectTestService.deleteByTestId(subjectTestDictDO));
    }



}