package com.ruoyi.web.controller.fgw;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.projectV2.ZsyzLdps;
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.fgw.FgwLdps;
import com.ruoyi.system.service.fgw.IFgwLdpsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 发改委_领导批示Controller
 * 
 * @author ruoyi
 * @date 2023-03-24
 */
@RestController
@RequestMapping("/fgw/ldps")
public class FgwLdpsController extends BaseController
{
    @Autowired
    private IFgwLdpsService fgwLdpsService;

    /**
     * 查询发改委_领导批示列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:list')")
    @GetMapping("/list")
    public TableDataInfo list(FgwLdps fgwLdps)
    {
        startPage();
        List<FgwLdps> list = fgwLdpsService.selectFgwLdpsList(fgwLdps);
        return getDataTable(list);
    }

    /**
     * 导出发改委_领导批示列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:export')")
    @Log(title = "发改委_领导批示", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FgwLdps fgwLdps)
    {
        List<FgwLdps> list = fgwLdpsService.selectFgwLdpsList(fgwLdps);
        ExcelUtil<FgwLdps> util = new ExcelUtil<FgwLdps>(FgwLdps.class);
        util.exportExcel(response, list, "发改委_领导批示数据");
    }

    /**
     * 获取发改委_领导批示详细信息
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(fgwLdpsService.selectFgwLdpsById(id));
    }

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

    /**
     * 新增发改委_领导批示
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:add')")
    @Log(title = "发改委_领导批示", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FgwLdps fgwLdps)
    {
        return toAjax(fgwLdpsService.insertFgwLdps(fgwLdps));
    }

    /**
     * 修改发改委_领导批示
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:edit')")
    @Log(title = "发改委_领导批示", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody FgwLdps fgwLdps)
    {
        return toAjax(fgwLdpsService.updateFgwLdps(fgwLdps));
    }

    /**
     * 删除发改委_领导批示
     */
    @PreAuthorize("@ss.hasPermi('fgw:ldps:remove')")
    @Log(title = "发改委_领导批示", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fgwLdpsService.deleteFgwLdpsByIds(ids));
    }

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