package com.ruoyi.web.controller.projectV2;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.projectV2.ZsyzFj;
import com.ruoyi.system.service.projectV2.IZsyzFjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 招商引资_附件Controller
 * 
 * @author 博曼
 * @date 2023-02-22
 */
@RestController
@RequestMapping("/projectV2/fj")
public class ZsyzFjController extends BaseController
{
    @Autowired
    private IZsyzFjService zsyzFjService;

    /**
     * 查询招商引资_附件列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzFj zsyzFj)
    {
        startPage();
        List<ZsyzFj> list = zsyzFjService.selectZsyzFjList(zsyzFj);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_附件列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:export')")
    @Log(title = "招商引资_附件", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZsyzFj zsyzFj)
    {
        List<ZsyzFj> list = zsyzFjService.selectZsyzFjList(zsyzFj);
        ExcelUtil<ZsyzFj> util = new ExcelUtil<ZsyzFj>(ZsyzFj.class);
        return util.exportExcel(list, "fj");
    }

    /**
     * 获取招商引资_附件详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzFjService.selectZsyzFjById(id));
    }

    /**
     * 新增招商引资_附件
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:add')")
    @Log(title = "招商引资_附件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzFj zsyzFj)
    {
        return toAjax(zsyzFjService.insertZsyzFj(zsyzFj));
    }

    /**
     * 修改招商引资_附件
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:edit')")
    @Log(title = "招商引资_附件", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzFj zsyzFj)
    {
        return toAjax(zsyzFjService.updateZsyzFj(zsyzFj));
    }

    /**
     * 删除招商引资_附件
     */
    @PreAuthorize("@ss.hasPermi('projectV2:fj:remove')")
    @Log(title = "招商引资_附件", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsyzFjService.deleteZsyzFjByIds(ids));
    }
}
