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.CmcBrandProjectProgress;
import com.ruoyi.oa.service.ICmcBrandProjectProgressService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * cmc品牌项目进度Controller
 * 
 * @author cmc
 * @date 2024-06-12
 */
@RestController
@RequestMapping("/oa/brandProgress")
public class CmcBrandProjectProgressController extends BaseController
{
    @Autowired
    private ICmcBrandProjectProgressService cmcBrandProjectProgressService;

    /**
     * 查询cmc品牌项目进度列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CmcBrandProjectProgress cmcBrandProjectProgress)
    {
        startPage();
        List<CmcBrandProjectProgress> list = cmcBrandProjectProgressService.selectCmcBrandProjectProgressList(cmcBrandProjectProgress);
        return getDataTable(list);
    }

    /**
     * 导出cmc品牌项目进度列表
     */
    @Log(title = "cmc品牌项目进度", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CmcBrandProjectProgress cmcBrandProjectProgress)
    {
        List<CmcBrandProjectProgress> list = cmcBrandProjectProgressService.selectCmcBrandProjectProgressList(cmcBrandProjectProgress);
        ExcelUtil<CmcBrandProjectProgress> util = new ExcelUtil<CmcBrandProjectProgress>(CmcBrandProjectProgress.class);
        util.exportExcel(response, list, "cmc品牌项目进度数据");
    }

    /**
     * 获取cmc品牌项目进度详细信息
     */
    @GetMapping(value = "/{progressId}")
    public AjaxResult getInfo(@PathVariable("progressId") Long progressId)
    {
        return success(cmcBrandProjectProgressService.selectCmcBrandProjectProgressByProgressId(progressId));
    }

    /**
     * 新增cmc品牌项目进度
     */
    @Log(title = "cmc品牌项目进度", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmcBrandProjectProgress cmcBrandProjectProgress)
    {
        return toAjax(cmcBrandProjectProgressService.insertCmcBrandProjectProgress(cmcBrandProjectProgress));
    }

    /**
     * 修改cmc品牌项目进度
     */
    @Log(title = "cmc品牌项目进度", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmcBrandProjectProgress cmcBrandProjectProgress)
    {
        return toAjax(cmcBrandProjectProgressService.updateCmcBrandProjectProgress(cmcBrandProjectProgress));
    }

    /**
     * 删除cmc品牌项目进度
     */
    @Log(title = "cmc品牌项目进度", businessType = BusinessType.DELETE)
	@DeleteMapping("/{projectIds}")
    public AjaxResult remove(@PathVariable String[] projectIds)
    {
        return success(cmcBrandProjectProgressService.deleteCmcBrandProjectProgressByProgressIds(projectIds));
    }
}
