MatchDictController.java 8.39 KB
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));
    }


}