package com.xunwang.education.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.xunwang.commonutils.JwtUtils;
import com.xunwang.commonutils.R;
import com.xunwang.commonutils.RedisIdWorker;
import com.xunwang.education.entity.StudentRequirements;
import com.xunwang.education.service.StudentRequirementsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 需求表 前端控制器
 * </p>
 *
 * @author Long
 * @since 2022-11-16
 */
@RestController
@RequestMapping("/education/student-requirements")
@Api("学生需求表")
@ApiSupport(author = "Long")
public class StudentRequirementsController {

    @Resource
    private StudentRequirementsService requirementsService;

    @ApiOperation("发布学生需求")
    @PostMapping("publishRequirements")
    public R publishRequirements(@RequestBody StudentRequirements requirements, HttpServletRequest request) {
        boolean b = requirementsService.publishRequirements(requirements, request);
        if (b) {
            return R.ok().message("提交成功,请等待审核");
        } else {
            return R.ok().message("提交失败,请稍后再试");
        }
    }
}

