package com.sqx.modules.intention.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.intention.entity.Intention;
import com.sqx.modules.intention.service.IntentionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author www.javacoder.top
 * @since 2023-01-13
 */
@Api(value = "求职期望", tags = {"求职期望"})

@RestController
@RequestMapping("/admin/intention/")
public class AdminIntentionController {
    @Autowired
    private IntentionService intentionService;



    @ApiOperation("获取求职意向列表")
    @GetMapping(value = "getIntentionList")
    public Result getIntentionList(Long userId, Integer page, Integer limit, Intention intention) {
        intention.setUserId(userId);
        return Result.success().put("data", intentionService.getIntentionList(page, limit, intention));
    }

    @ApiOperation("获取求职意向信息")
    @GetMapping(value = "getIntentionInfo")
    public Result getIntentionInfo(Long intentionId) {
        return Result.success().put("data", intentionService.getById(intentionId));


    }

    @ApiOperation("删除求职意向")
    @PostMapping(value = "deleteIntention")
    public Result deleteIntention(Long intentionId) {
        return intentionService.removeById(intentionId) ? Result.success() : Result.error();
    }
}

