Blame view

SubjectRuleController.java 2.61 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.rule.GetAllRulesDTO;
import com.meishu.dto.rule.GetRuleReportDTO;
import com.meishu.model.SubjectRuleDO;
import com.meishu.service.SubjectRuleService;
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-08
 */
@RestController
@Api(tags = "规则字典表")
@RequestMapping("/subjectRule")
public class SubjectRuleController {

    @Autowired
    private SubjectRuleService subjectRuleService;

    @PostMapping("getAllRules")
    @ApiOperation("获取所有规则 ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllRules(@RequestBody GetAllRulesDTO getAllRulesDTO){
        return ResponseData.generateCreatedResponse(0,subjectRuleService.getAllRules(getAllRulesDTO));
    }

    @PostMapping("getRules")
    @ApiOperation("获取所有规则 ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getRules(){
        return ResponseData.generateCreatedResponse(0,subjectRuleService.getRules());
    }

    @PostMapping("addRule")
    @ApiOperation("新建规则 {subjectId:科目id  ruleName规则名称}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addRule(@RequestBody SubjectRuleDO subjectRuleDO){
        return ResponseData.generateCreatedResponse(0,subjectRuleService.addRule(subjectRuleDO));
    }

    @PostMapping("updateRule")
    @ApiOperation("更新规则 {id subjectId:科目id  ruleName规则名称 status }")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateRule(@RequestBody SubjectRuleDO subjectRuleDO){
        return ResponseData.generateCreatedResponse(0,subjectRuleService.updateRule(subjectRuleDO));
    }

    @PostMapping("deleteRule")
    @ApiOperation("删除规则 {id}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteRule(@RequestBody SubjectRuleDO subjectRuleDO){
        return ResponseData.generateCreatedResponse(0,subjectRuleService.deleteRule(subjectRuleDO));
    }

}