package com.ruoyi.web.controller.projectV2;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.system.domain.projectV2.ZsyzLdps;
import com.ruoyi.system.service.projectV2.IZsyzLdpsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 招商引资_领导批示Controller
 * 
 * @author ruoyi
 * @date 2023-02-26
 */
@RestController
@RequestMapping("/projectV2/ldps")
public class ZsyzLdpsController extends BaseController
{
    @Autowired
    private IZsyzLdpsService zsyzLdpsService;
    /**
     * 查询招商引资_领导批示列表
     */

    @PreAuthorize("@ss.hasPermi('system:ldps:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzLdps zsyzLdps)
    {
        startPage();
        List<ZsyzLdps> list = zsyzLdpsService.selectZsyzLdpsList(zsyzLdps);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_领导批示列表
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:export')")
    @Log(title = "招商引资_领导批示", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZsyzLdps zsyzLdps)
    {
        List<ZsyzLdps> list = zsyzLdpsService.selectZsyzLdpsList(zsyzLdps);
        ExcelUtil<ZsyzLdps> util = new ExcelUtil<ZsyzLdps>(ZsyzLdps.class);
        util.exportExcel(response, list, "招商引资_领导批示数据");
    }

    /**
     * 获取招商引资_领导批示详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zsyzLdpsService.selectZsyzLdpsById(id));
    }


    /**
     * 查询当前账号最新的暂存数据
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:queryZc')")
    @GetMapping(value = "/zc")
    public AjaxResult getInfoZc(ZsyzLdps zsyzLdps)
    {
        return success(zsyzLdpsService.getInfoZc(zsyzLdps));
    }


    /**
     * 新增招商引资_领导批示
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:add')")
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzLdps zsyzLdps)
    {
        return toAjax(zsyzLdpsService.insertZsyzLdps(zsyzLdps));
    }

    /**
     * 修改招商引资_领导批示
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:update')")
    @Log(title = "招商引资_领导批示", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzLdps zsyzLdps)
    {
        return toAjax(zsyzLdpsService.updateZsyzLdps(zsyzLdps));
    }

    /**
     * 删除招商引资_领导批示
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:delete')")
    @Log(title = "招商引资_领导批示", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsyzLdpsService.deleteZsyzLdpsByIds(ids));
    }

    /**
     * 删除招商引资_领导批示
     */
    @PreAuthorize("@ss.hasPermi('system:ldps:delete')")
    @GetMapping("delete")
    public AjaxResult remove(Long id,Long xmId)
    {
        return toAjax(zsyzLdpsService.deleteZsyzLdpsById(id,xmId));
    }
}
