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.ZsyzKgxx;
import com.ruoyi.system.service.projectV2.IZsyzKgxxService;
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/kgxx")
public class ZsyzKgxxController extends BaseController
{
    @Autowired
    private IZsyzKgxxService zsyzKgxxService;

    /**
     * 查询招商引资_开工信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzKgxx zsyzKgxx)
    {
        startPage();
        List<ZsyzKgxx> list = zsyzKgxxService.selectZsyzKgxxList(zsyzKgxx);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_开工信息列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:export')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZsyzKgxx zsyzKgxx)
    {
        List<ZsyzKgxx> list = zsyzKgxxService.selectZsyzKgxxList(zsyzKgxx);
        ExcelUtil<ZsyzKgxx> util = new ExcelUtil<ZsyzKgxx>(ZsyzKgxx.class);
        return util.exportExcel(list, "kgxx");
    }

    /**
     * 获取招商引资_开工信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzKgxxService.selectZsyzKgxxById(id));
    }

    /**
     * 获取招商引资_开工信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:queryYj')")
    @GetMapping(value = "/queryYj/{id}")
    public AjaxResult getInfoYj(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsyzKgxxService.selectZsyzKgxxById(id));
    }

    /**
     * 新增招商引资_开工信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:add')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.insertZsyzKgxx(zsyzKgxx));
    }

    /**
     * 新增招商引资_开工信息,引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:addYj')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.INSERT)
    @PostMapping("/addYj")
    public AjaxResult addYj(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.insertZsyzKgxx(zsyzKgxx));
    }

    /**
     * 修改招商引资_开工信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:edit')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.updateZsyzKgxx(zsyzKgxx));
    }

    /**
     * 修改招商引资_开工信息_拟投产信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:editKg')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.UPDATE)
    @PostMapping("/putKg")
    public AjaxResult editTc(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.updateZsyzKgxxTc(zsyzKgxx));
    }

    /**
     * 修改招商引资_开工信息_拟投产信息,引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:editYjKg')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put/editYjKg")
    public AjaxResult editYjKg(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.updateZsyzKgxxTc(zsyzKgxx));
    }

    /**
     * 修改招商引资_开工信息,引荐单位使用
     */
    @PreAuthorize("@ss.hasPermi('projectV2:kgxx:editYj')")
    @Log(title = "招商引资_开工信息", businessType = BusinessType.UPDATE)
    @PostMapping("/put/editYj")
    public AjaxResult editYj(@RequestBody ZsyzKgxx zsyzKgxx)
    {
        return toAjax(zsyzKgxxService.updateZsyzKgxx(zsyzKgxx));
    }

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