package com.ruoyi.web.controller.api;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.mall.domain.MallExamSection;
import com.ruoyi.mall.domain.MallMemberUser;
import com.ruoyi.mall.mapper.MallMemberUserMapper;
import com.ruoyi.mall.service.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName 报考数据接口
 * @Description 报考数据接口
 * @Author LCL
 * @Date 2023/10/18
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/examData")
public class ApiExamDataController {
    @Resource
    private IMallExamDataService mallExamDataService;


    /**
     * 报考数据-报考人数
     *
     * @return
     */
    @GetMapping("/getNumberOfApplicants")
    public AjaxResult getNumberOfApplicants() {
        try {
            return AjaxResult.success().put("data", mallExamDataService.selectNumberOfApplicantsList());
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error("报考数据-报考人数异常");
        }
    }

    /**
     * 报考数据-招生计划人数
     *
     * @param years 年份
     * @return
     */
    @GetMapping("/getEnrollmentNumber")
    public AjaxResult getEnrollmentNumber(@RequestParam String years) {
        try {
            return AjaxResult.success().put("data", mallExamDataService.selectEnrollmentNumber(years));
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error("报考数据-招生计划人数异常");
        }
    }

    /**
     * 报考数据-数据控线
     *
     * @return
     */
    @GetMapping("/getDataControlCable")
    public AjaxResult getDataControlCable() {
        try {
            return AjaxResult.success().put("data", mallExamDataService.selectDataControlCableList());
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error("报考数据-数据控线异常");
        }
    }

}
