package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
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.cs.domain.CsApprovalCarbonCopy;
import com.ruoyi.cs.service.ICsApprovalCarbonCopyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 审核抄送记录Controller
 * 
 * @author cc
 * @date 2024-04-30
 */
@RestController
@RequestMapping("/cs/csApprovalCarbonCopy")
public class CsApprovalCarbonCopyController extends BaseController
{
    @Autowired
    private ICsApprovalCarbonCopyService csApprovalCarbonCopyService;

    /**
     * 查询审核抄送记录列表
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:list')")
    @GetMapping("/list")
    public TableDataInfo list(CsApprovalCarbonCopy csApprovalCarbonCopy)
    {
        startPage();
        List<CsApprovalCarbonCopy> list = csApprovalCarbonCopyService.selectCsApprovalCarbonCopyList(csApprovalCarbonCopy);
        return getDataTable(list);
    }

    /**
     * 导出审核抄送记录列表
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:export')")
    @Log(title = "审核抄送记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CsApprovalCarbonCopy csApprovalCarbonCopy)
    {
        List<CsApprovalCarbonCopy> list = csApprovalCarbonCopyService.selectCsApprovalCarbonCopyList(csApprovalCarbonCopy);
        ExcelUtil<CsApprovalCarbonCopy> util = new ExcelUtil<CsApprovalCarbonCopy>(CsApprovalCarbonCopy.class);
        util.exportExcel(response, list, "审核抄送记录数据");
    }

    /**
     * 获取审核抄送记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:query')")
    @GetMapping(value = "/{carbonCopyId}")
    public AjaxResult getInfo(@PathVariable("carbonCopyId") String carbonCopyId)
    {
        return AjaxResult.success(csApprovalCarbonCopyService.selectCsApprovalCarbonCopyByCarbonCopyId(carbonCopyId));
    }

    /**
     * 新增审核抄送记录
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:add')")
    @Log(title = "审核抄送记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CsApprovalCarbonCopy csApprovalCarbonCopy)
    {
        return toAjax(csApprovalCarbonCopyService.insertCsApprovalCarbonCopy(csApprovalCarbonCopy));
    }

    /**
     * 修改审核抄送记录
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:edit')")
    @Log(title = "审核抄送记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CsApprovalCarbonCopy csApprovalCarbonCopy)
    {
        return toAjax(csApprovalCarbonCopyService.updateCsApprovalCarbonCopy(csApprovalCarbonCopy));
    }

    /**
     * 删除审核抄送记录
     */
    @PreAuthorize("@ss.hasPermi('cs:csApprovalCarbonCopy:remove')")
    @Log(title = "审核抄送记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{carbonCopyIds}")
    public AjaxResult remove(@PathVariable String[] carbonCopyIds)
    {
        return toAjax(csApprovalCarbonCopyService.deleteCsApprovalCarbonCopyByCarbonCopyIds(carbonCopyIds));
    }
}
