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.ZsyzTcxx;
import com.ruoyi.system.service.projectV2.IZsyzTcxxService;
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/tcxx")
public class ZsyzTcxxController extends BaseController
{
    @Autowired
    private IZsyzTcxxService zsyzTcxxService;

    /**
     * 查询招商引资_投产信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzTcxx zsyzTcxx)
    {
        startPage();
        List<ZsyzTcxx> list = zsyzTcxxService.selectZsyzTcxxList(zsyzTcxx);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_投产信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:export')")
    @Log(title = "招商引资_投产信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZsyzTcxx zsyzTcxx)
    {
        List<ZsyzTcxx> list = zsyzTcxxService.selectZsyzTcxxList(zsyzTcxx);
        ExcelUtil<ZsyzTcxx> util = new ExcelUtil<ZsyzTcxx>(ZsyzTcxx.class);
        return util.exportExcel(list, "tcxx");
    }

    /**
     * 获取招商引资_投产信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzTcxxService.selectZsyzTcxxById(id));
    }

    /**
     * 获取招商引资_投产信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:queryYj')")
    @GetMapping(value = "/queryYj/{id}")
    public AjaxResult getInfoYj(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzTcxxService.selectZsyzTcxxById(id));
    }

    /**
     * 新增招商引资_投产信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:add')")
    @Log(title = "招商引资_投产信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzTcxx zsyzTcxx)
    {
        return toAjax(zsyzTcxxService.insertZsyzTcxx(zsyzTcxx));
    }

    /**
     * 新增招商引资_投产信息_引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:addYj')")
    @Log(title = "招商引资_投产信息", businessType = BusinessType.INSERT)
    @PostMapping("/addYj")
    public AjaxResult addYj(@RequestBody ZsyzTcxx zsyzTcxx)
    {
        return toAjax(zsyzTcxxService.insertZsyzTcxx(zsyzTcxx));
    }

    /**
     * 修改招商引资_投产信息_引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:editYj')")
    @Log(title = "招商引资_投产信息", businessType = BusinessType.UPDATE)
    @PostMapping("/editYj")
    public AjaxResult editYj(@RequestBody ZsyzTcxx zsyzTcxx)
    {
        return toAjax(zsyzTcxxService.updateZsyzTcxx(zsyzTcxx));
    }

    /**
     * 修改招商引资_投产信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:tcxx:edit')")
    @Log(title = "招商引资_投产信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzTcxx zsyzTcxx)
    {
        return toAjax(zsyzTcxxService.updateZsyzTcxx(zsyzTcxx));
    }

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