package org.jeecg.modules.api.controller2;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.JobService;
import org.jeecg.modules.employJob.entity.EmployJob;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags="工作信息相关接口")
@RestController
@RequestMapping("/employ/job")
@Slf4j
public class JobController {

    /******************************************************************************************************************/
    //工作信息
    @Resource
    private JobService jobService;
    /******************************************************************************************************************/
    //查看工作列表
    @ApiOperation(value="首页-查询工作信息列表", notes="首页-查询工作信息列表")
    @RequestMapping(value = "/queryJobList", method = {RequestMethod.GET})
    public Result<?> queryJobList(EmployJob employJob, PageBean pageBean){
        return jobService.queryJobList(employJob, pageBean);
    }

    //首页-根据Id查看工作详情
    @ApiOperation(value="首页-根据Id查看工作详情", notes="首页-根据Id查看工作详情")
    @RequestMapping(value = "/queryJobById", method = {RequestMethod.GET})
    public Result<?> queryJobById(String token, String jobId){
        return jobService.queryJobById(token, jobId);
    }

    //会员中心-我的招工
    @ApiOperation(value="会员中心-我的招工", notes="会员中心-我的招工")
    @RequestMapping(value = "/queryJobListByUserId", method = {RequestMethod.GET})
    public Result<?> queryJobListByUserId(@RequestHeader("X-Access-Token")String token, PageBean pageBean){
        return jobService.queryJobListByUserId(token, pageBean);
    }

    //添加工作信息
    @ApiOperation(value="首页-添加工作信息", notes="首页-添加工作信息")
    @RequestMapping(value = "/addJob", method = {RequestMethod.POST})
    public Result<?> addJob(@RequestHeader("X-Access-Token")String token, EmployJob employJob){
        return jobService.addJob(token, employJob);
    }

    //修改工作信息
    @ApiOperation(value="首页-修改工作信息", notes="首页-修改工作信息")
    @RequestMapping(value = "/updateJob", method = {RequestMethod.POST})
    public Result<?> updateJob(@RequestHeader("X-Access-Token")String token, EmployJob employJob){
        return jobService.updateJob(token, employJob);
    }


}
