Blame view

MatchDictController.java 8.39 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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
package com.zhongzhi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.constant.ProjectType;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.match.MatchDictDTO;
import com.zhongzhi.dto.match.SelectListPageDTO;
import com.zhongzhi.model.MatchDictDO;
import com.zhongzhi.service.MatchDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
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;

/**
 * <p>
 * 赛事年份管理 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-05-17
 */
@RestController
@Api(tags = "赛事年份管理")
@RequestMapping("/match")
public class MatchDictController {

    @Autowired
    private MatchDictService matchDictService;

    @PostMapping(value = "/getMainTrackMatch")
    @LoginRequired({Platform.school, Platform.center, Platform.student})
    @ApiOperation("查询主赛道启用赛事年份")
    public ResponseVO getMainTrackMatch() {
        return ResponseData.generateCreatedResponse(0, matchDictService.getMainTrackMatch());
    }

    @PostMapping(value = "/getSeedTrackMatch")
    @LoginRequired({Platform.school, Platform.center, Platform.student})
    @ApiOperation("查询种子赛道启用赛事年份")
    public ResponseVO getSeedTrackMatch() {
        return ResponseData.generateCreatedResponse(0, matchDictService.getSeedTrackMatch());
    }

    @PostMapping(value = "/getMatch")
    @ApiOperation("查询启用种子赛事年份")
    public ResponseVO getMatch() {
        return ResponseData.generateCreatedResponse(0, matchDictService.getMatch());
    }

    @PostMapping(value = "/getVocationalMatch")
    @ApiOperation("查询启用职教赛事年份")
    public ResponseVO getVocationalMatch() {
        return ResponseData.generateCreatedResponse(0, matchDictService.getVocationalMatch());
    }

    @PostMapping("updateMatchDate")
    @ApiOperation("修改届数 id  registrationStart  registrationDeadline")
    public ResponseVO updateMatch(@RequestBody MatchDictDO matchDictDO){
        matchDictService.updateMatchDate(matchDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("getMatchInfo")
    @ApiOperation("查看某届数详情  id")
    public ResponseVO getMatch(@RequestBody MatchDictDO matchDictDO){
        return ResponseData.generateCreatedResponse(0,matchDictService.getMatch(matchDictDO));
    }


    @PostMapping(value = "/getMainTrackMatchPage")
    @LoginRequired({Platform.center, Platform.school})
    @ApiOperation("中心端/院校端 ---分页查询主赛道赛事年份:pageNo、pageSize")
    public ResponseVO getMainTrackMatchPage(@RequestBody SelectListPageDTO selectListPageDTO) {
        Page page = new Page(selectListPageDTO.getPageNo(), selectListPageDTO.getPageSize());
        return ResponseData.generateCreatedResponse(0, matchDictService.page(page, new QueryWrapper<MatchDictDO>()
                .lambda()
                .eq(MatchDictDO::getMatchType, ProjectType.MAIN_TRACK)));
    }

    @PostMapping(value = "/getSeedTrackMatchPage")
    @LoginRequired({Platform.center, Platform.school, Platform.review})
    @ApiOperation("中心端/院校端 ---分页查询种子赛道赛事年份:pageNo、pageSize")
    public ResponseVO getSeedTrackMatchPage(@RequestBody SelectListPageDTO selectListPageDTO) {
        return ResponseData.generateCreatedResponse(0, matchDictService.getSeedTrackMatchPage(selectListPageDTO));
    }

    @PostMapping(value = "/createMainTrackMatch")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---创建主赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
            "schedule:[{ scheduleTime/时间安排、explain/说明 }]")
    public ResponseVO createMainTrackMatch(@RequestBody MatchDictDTO matchDictDTO) {
        matchDictDTO.setMatchType(ProjectType.MAIN_TRACK);
        matchDictService.createMatch(matchDictDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/createSeedTrackMatch")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---创建种子赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
            "schedule:[{ scheduleTime/时间安排、explains/说明 }]")
    public ResponseVO createSeedTrackMatch(@RequestBody MatchDictDTO matchDictDTO) {
        matchDictDTO.setMatchType(ProjectType.SEED_TRACK);
        matchDictService.createMatch(matchDictDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/createVocationalMatch")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---创建职教赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
            "schedule:[{ scheduleTime/时间安排、explains/说明 }]")
    public ResponseVO createVocationalMatch(@RequestBody MatchDictDTO matchDictDTO) {
        matchDictDTO.setMatchType(ProjectType.VOCATIONAL);
        matchDictService.createMatch(matchDictDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/updateMatch")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---编辑赛事年份:id/ID、matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、status/状态(1:启动,0:暂停)" +
            "schedule:[{ id/时间安排ID、scheduleTime/时间安排、explains/说明 }]")
    public ResponseVO updateMatch(@RequestBody MatchDictDTO matchDictDTO) {
        matchDictService.updateMatch(matchDictDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/delete")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---删除赛事年份:id/ID")
    public ResponseVO delete(@RequestBody MatchDictDO matchDictDO) {
        matchDictService.removeById(matchDictDO.getId());
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/getMainTrackMatchAll")
    @LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
    @ApiOperation("中心端/学生端/院校端/审批端 ---查询全部主赛道赛事年份")
    public ResponseVO getMainTrackMatchAll() {
        return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
                .lambda()
                .eq(MatchDictDO::getMatchType, ProjectType.MAIN_TRACK)));
    }

    @PostMapping(value = "/getSeedTrackMatchAll")
    @LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
    @ApiOperation("中心端/学生端/院校端/审批端 ---查询全部种子赛道赛事年份")
    public ResponseVO getSeedTrackMatchAll() {
        return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
                .lambda()
                .eq(MatchDictDO::getMatchType, ProjectType.SEED_TRACK)));
    }

    @PostMapping(value = "/getVocationalMatchAll")
    @LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
    @ApiOperation("中心端/学生端/院校端/审批端 ---查询全部职教赛道赛事年份")
    public ResponseVO getVocationalMatchAll() {
        return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
                .lambda()
                .eq(MatchDictDO::getMatchType, ProjectType.VOCATIONAL)));
    }

    /* 职教管理端 */
    @PostMapping(value = "/getVocationalPage")
    @LoginRequired({Platform.center, Platform.school, Platform.review})
    @ApiOperation("中心端/院校端 ---分页查询职教赛道赛事年份:pageNo、pageSize")
    public ResponseVO getVocationalPage(@RequestBody SelectListPageDTO selectListPageDTO) {
        return ResponseData.generateCreatedResponse(0, matchDictService.getVocationalPage(selectListPageDTO));
    }


}