package com.ruoyi.frequency.klkaccounattach.controller;

import java.util.List;
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.frequency.klkaccounattach.entity.KlkAccountAttach;
import com.ruoyi.frequency.klkaccounattach.service.KlkAccountAttachService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 拉卡拉平台账号信息附件Controller
 * 
 * @author liwenlong
 * @date 2024-05-07
 */
@RestController
@RequestMapping("/frequency/klkaccounattach")
public class KlkAccountAttachController extends BaseController
{
    @Autowired
    private KlkAccountAttachService klkAccountAttachService;

    /**
     * 查询拉卡拉平台账号信息附件列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:list')")
    @GetMapping("/list")
    public TableDataInfo<KlkAccountAttach> list(KlkAccountAttach klkAccountAttach)
    {
        startPage();
        List<KlkAccountAttach> list = klkAccountAttachService.selectKlkAccountAttachList(klkAccountAttach);
        return getDataTable(list);
    }

    /**
     * 导出拉卡拉平台账号信息附件列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:export')")
    @Log(title = "拉卡拉平台账号信息附件", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(KlkAccountAttach klkAccountAttach)
    {
        List<KlkAccountAttach> list = klkAccountAttachService.selectKlkAccountAttachList(klkAccountAttach);
        ExcelUtil<KlkAccountAttach> util = new ExcelUtil<KlkAccountAttach>(KlkAccountAttach.class);
        return util.exportExcel(list, "拉卡拉平台账号信息附件数据");
    }

    /**
     * 获取拉卡拉平台账号信息附件详细信息
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult<KlkAccountAttach> getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(klkAccountAttachService.selectKlkAccountAttachById(id));
    }

    /**
     * 新增拉卡拉平台账号信息附件
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:add')")
    @Log(title = "拉卡拉平台账号信息附件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KlkAccountAttach klkAccountAttach)
    {
        return toAjax(klkAccountAttachService.insertKlkAccountAttach(klkAccountAttach));
    }

    /**
     * 修改拉卡拉平台账号信息附件
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:edit')")
    @Log(title = "拉卡拉平台账号信息附件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KlkAccountAttach klkAccountAttach)
    {
        return toAjax(klkAccountAttachService.updateKlkAccountAttach(klkAccountAttach));
    }

    /**
     * 删除拉卡拉平台账号信息附件
     */
    @PreAuthorize("@ss.hasPermi('frequency:klkaccounattach:remove')")
    @Log(title = "拉卡拉平台账号信息附件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}/{delFlag}")
    public AjaxResult remove(@PathVariable("ids") Long[] ids,@PathVariable("delFlag") Integer delFlag)
    {
        return toAjax(klkAccountAttachService.deleteKlkAccountAttachByIds(ids,delFlag));
    }
}
