package com.ruoyi.web.controller.oa;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.oa.domain.CmcRecruit;
import com.ruoyi.oa.service.ICmcRecruitService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * cmc员工招聘Controller
 * 
 * @author cmc
 * @date 2025-10-16
 */
@RestController
@RequestMapping("/oa/recruit")
public class CmcRecruitController extends BaseController
{
    @Autowired
    private ICmcRecruitService cmcRecruitService;

    /**
     * 查询cmc员工招聘列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CmcRecruit cmcRecruit)
    {
        startPage();
        List<CmcRecruit> list = cmcRecruitService.selectCmcRecruitList(cmcRecruit);
        return getDataTable(list);
    }

    /**
     * 导出cmc员工招聘列表
     */
    @Log(title = "cmc员工招聘", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CmcRecruit cmcRecruit)
    {
        List<CmcRecruit> list = cmcRecruitService.selectCmcRecruitList(cmcRecruit);
        ExcelUtil<CmcRecruit> util = new ExcelUtil<CmcRecruit>(CmcRecruit.class);
        util.exportExcel(response, list, "cmc员工招聘数据");
    }

    /**
     * 获取cmc员工招聘详细信息
     */
    @GetMapping(value = "/{recruitId}")
    public AjaxResult getInfo(@PathVariable("recruitId") String recruitId)
    {
        return success(cmcRecruitService.selectCmcRecruitByRecruitId(recruitId));
    }

    /**
     * 新增cmc员工招聘
     */
    @Log(title = "cmc员工招聘", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmcRecruit cmcRecruit)
    {
        return toAjax(cmcRecruitService.insertCmcRecruit(cmcRecruit));
    }

    /**
     * 修改cmc员工招聘
     */
    @Log(title = "cmc员工招聘", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmcRecruit cmcRecruit)
    {
        return toAjax(cmcRecruitService.updateCmcRecruit(cmcRecruit));
    }

    /**
     * 删除cmc员工招聘
     */
    @Log(title = "cmc员工招聘", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recruitIds}")
    public AjaxResult remove(@PathVariable String[] recruitIds)
    {
        return success(cmcRecruitService.deleteCmcRecruitByRecruitIds(recruitIds));
    }
}
