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

/**
 * cmc品牌项目支付记录Controller
 * 
 * @author cmc
 * @date 2024-04-29
 */
@RestController
@RequestMapping("/oa/brandPayment")
public class CmcBrandPaymentController extends BaseController
{
    @Autowired
    private ICmcBrandPaymentService cmcBrandPaymentService;

    /**
     * 查询cmc品牌项目支付记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CmcBrandPayment cmcBrandPayment)
    {
        startPage();
        List<CmcBrandPayment> list = cmcBrandPaymentService.selectCmcBrandPaymentList(cmcBrandPayment);
        return getDataTable(list);
    }

    /**
     * 导出cmc品牌项目支付记录列表
     */
    @Log(title = "cmc品牌项目支付记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CmcBrandPayment cmcBrandPayment)
    {
        List<CmcBrandPayment> list = cmcBrandPaymentService.selectCmcBrandPaymentList(cmcBrandPayment);
        ExcelUtil<CmcBrandPayment> util = new ExcelUtil<CmcBrandPayment>(CmcBrandPayment.class);
        util.exportExcel(response, list, "cmc品牌项目支付记录数据");
    }

    /**
     * 获取cmc品牌项目支付记录详细信息
     */
    @GetMapping(value = "/{brandId}")
    public AjaxResult getInfo(@PathVariable("brandId") String brandId)
    {
        return success(cmcBrandPaymentService.selectCmcBrandPaymentByBrandId(brandId));
    }

    /**
     * 新增cmc品牌项目支付记录
     */
    @Log(title = "cmc品牌项目支付记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmcBrandPayment cmcBrandPayment)
    {
        return toAjax(cmcBrandPaymentService.insertCmcBrandPayment(cmcBrandPayment));
    }

    /**
     * 修改cmc品牌项目支付记录
     */
    @Log(title = "cmc品牌项目支付记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmcBrandPayment cmcBrandPayment)
    {
        return toAjax(cmcBrandPaymentService.updateCmcBrandPayment(cmcBrandPayment));
    }

    /**
     * 删除cmc品牌项目支付记录
     */
    @Log(title = "cmc品牌项目支付记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{brandIds}")
    public AjaxResult remove(@PathVariable String[] brandIds)
    {
        return success(cmcBrandPaymentService.deleteCmcBrandPaymentByBrandIds(brandIds));
    }
}
