package com.zhongzheng.controller.recruit;

import com.zhongzheng.common.annotation.Log;
import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.core.domain.model.LoginUser;
import com.zhongzheng.common.core.page.TableDataInfo;
import com.zhongzheng.common.enums.BusinessType;
import com.zhongzheng.common.utils.ServletUtils;
import com.zhongzheng.framework.web.service.TokenService;
import com.zhongzheng.modules.recruit.bo.RecruitNeedsAddBo;
import com.zhongzheng.modules.recruit.bo.RecruitNeedsEditBo;
import com.zhongzheng.modules.recruit.bo.RecruitNeedsQueryBo;
import com.zhongzheng.modules.recruit.domain.RecruitNeeds;
import com.zhongzheng.modules.recruit.service.IRecruitNeedsService;
import com.zhongzheng.modules.recruit.vo.RecruitNeedsVo;
import com.zhongzheng.modules.user.entity.ClientLoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 招聘需求Controller
 *
 * @author hjl
 * @date 2021-08-12
 */
@Api(value = "招聘需求控制器", tags = {"招聘需求管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/app/common/recruit/needs")
public class RecruitNeedsController extends BaseController {

    private final IRecruitNeedsService iRecruitNeedsService;

    private final TokenService tokenService;

    /**
     * 查询招聘需求列表
     */
    @ApiOperation("查询招聘需求列表")
    @GetMapping("/list")
    public TableDataInfo<RecruitNeeds> list(RecruitNeedsQueryBo bo) {
        List<Integer> statusList = new ArrayList<>();
        statusList.add(2);
        bo.setStatus(statusList);
        startPage();
        List<RecruitNeeds> list = iRecruitNeedsService.queryRecruitNeedsList(bo);
        return getDataTable(list);
    }

    /**
     * 获取招聘需求详细信息
     */
    @ApiOperation("获取招聘需求详细信息")
    @GetMapping("/{id}")
    public AjaxResult<RecruitNeedsVo> getInfo(@PathVariable("id" ) Long id) {
        return AjaxResult.success(iRecruitNeedsService.queryById(id));
    }

}
