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.ZsyzQyxx;
import com.ruoyi.system.service.projectV2.IZsyzQyxxService;
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 boman
 * @date 2023-02-22
 */
@RestController
@RequestMapping("/projectV2/qyxx")
public class ZsyzQyxxController extends BaseController
{
    @Autowired
    private IZsyzQyxxService zsyzQyxxService;

    /**
     * 查询招商引资_签约信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzQyxx zsyzQyxx)
    {
        startPage();
        List<ZsyzQyxx> list = zsyzQyxxService.selectZsyzQyxxList(zsyzQyxx);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_签约信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:export')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZsyzQyxx zsyzQyxx)
    {
        List<ZsyzQyxx> list = zsyzQyxxService.selectZsyzQyxxList(zsyzQyxx);
        ExcelUtil<ZsyzQyxx> util = new ExcelUtil<ZsyzQyxx>(ZsyzQyxx.class);
        return util.exportExcel(list, "qyxx");
    }

    /**
     * 获取招商引资_签约信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzQyxxService.selectZsyzQyxxById(id));
    }

    /**
     * 获取招商引资_签约信息详细信息_引荐单位
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:queryYj')")
    @GetMapping(value = "/queryYj/{id}")
    public AjaxResult getInfoYj(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzQyxxService.selectZsyzQyxxById(id));
    }

    /**
     * 新增招商引资_签约信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:add')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzQyxx zsyzQyxx)
    {
        return toAjax(zsyzQyxxService.insertZsyzQyxx(zsyzQyxx));
    }

    /**
     * 新增招商引资_签约信息,引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:addYj')")
    @Log(title = "招商引资_签约信息,引荐单位使用", businessType = BusinessType.INSERT)
    @PostMapping("/addYj")
    public AjaxResult addYj(@RequestBody ZsyzQyxx zsyzQyxx)
    {
        return toAjax(zsyzQyxxService.insertZsyzQyxx(zsyzQyxx));
    }

    /**
     * 修改招商引资_签约信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:edit')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzQyxx zsyzQyxx)
    {
        return toAjax(zsyzQyxxService.updateZsyzQyxx(zsyzQyxx));
    }

    /**
     * 修改招商引资_签约信息,引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:editYj')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put/editYj")
    public AjaxResult editYj(@RequestBody ZsyzQyxx zsyzQyxx)
    {
        return toAjax(zsyzQyxxService.updateZsyzQyxx(zsyzQyxx));
    }

    /**
     * 删除招商引资_签约信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:remove')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsyzQyxxService.deleteZsyzQyxxByIds(ids));
    }

    /**
     * 删除招商引资_签约信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:qyxx:remove')")
    @Log(title = "招商引资_签约信息", businessType = BusinessType.DELETE)
    @GetMapping("/delete")
    public AjaxResult remove(Long id)
    {
        return toAjax(zsyzQyxxService.deleteZsyzQyxxById(id));
    }
}
