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.education.service.MyFavoriteNeedsService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Long
 * @since 2022-12-30
 */
@RestController
@RequestMapping("/education/my-favorite-needs")
@ApiSupport(author = "Long")
public class MyFavoriteNeedsController {

    @Autowired
    private MyFavoriteNeedsService myFavoriteNeedsService;

    @ApiOperation("收藏学员需求")
    @GetMapping("/collect")
    public R collect(HttpServletRequest request) {
        int collect = myFavoriteNeedsService.collect(request);
        if (collect > 0) {
            return R.ok().message("收藏成功");
        }
        return R.ok().message("收藏失败");
    }

    @ApiOperation("取消收藏学员需求")
    @GetMapping("/cancelCollect")
    public R cancelCollect(HttpServletRequest request) {
        boolean b = myFavoriteNeedsService.cancelCollect(request);
        if (b) {
            return R.ok().message("取消收藏成功");
        }
        return R.ok().message("取消收藏失败");
    }

    @ApiOperation("查询个人收藏的学员需求")
    @GetMapping("/findPersonCollect")
    public R findPersonCollect(HttpServletRequest request) {
        myFavoriteNeedsService.findPersonCollect(request)
    }

}

