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.CmcTransfer;
import com.ruoyi.oa.service.ICmcTransferService;
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/transfer")
public class CmcTransferController extends BaseController
{
    @Autowired
    private ICmcTransferService cmcTransferService;

    /**
     * 查询cmc员工调岗列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CmcTransfer cmcTransfer)
    {
        startPage();
        List<CmcTransfer> list = cmcTransferService.selectCmcTransferList(cmcTransfer);
        return getDataTable(list);
    }

    /**
     * 导出cmc员工调岗列表
     */
    @Log(title = "cmc员工调岗", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CmcTransfer cmcTransfer)
    {
        List<CmcTransfer> list = cmcTransferService.selectCmcTransferList(cmcTransfer);
        ExcelUtil<CmcTransfer> util = new ExcelUtil<CmcTransfer>(CmcTransfer.class);
        util.exportExcel(response, list, "cmc员工调岗数据");
    }

    /**
     * 获取cmc员工调岗详细信息
     */
    @GetMapping(value = "/{transferId}")
    public AjaxResult getInfo(@PathVariable("transferId") String transferId)
    {
        return success(cmcTransferService.selectCmcTransferByTransferId(transferId));
    }

    /**
     * 新增cmc员工调岗
     */
    @Log(title = "cmc员工调岗", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmcTransfer cmcTransfer)
    {
        return toAjax(cmcTransferService.insertCmcTransfer(cmcTransfer));
    }

    /**
     * 修改cmc员工调岗
     */
    @Log(title = "cmc员工调岗", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmcTransfer cmcTransfer)
    {
        return toAjax(cmcTransferService.updateCmcTransfer(cmcTransfer));
    }

    /**
     * 删除cmc员工调岗
     */
    @Log(title = "cmc员工调岗", businessType = BusinessType.DELETE)
	@DeleteMapping("/{transferIds}")
    public AjaxResult remove(@PathVariable String[] transferIds)
    {
        return success(cmcTransferService.deleteCmcTransferByTransferIds(transferIds));
    }
}
