package com.ruoyi.web.controller.fgw;

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

/**
 * 发改委_申报_主Controller
 * 
 * @author boman
 * @date 2023-03-22
 */
@RestController
@RequestMapping("/fgw/xmsb")
public class FgwXmsbController extends BaseController
{
    @Autowired
    private IFgwXmsbService fgwXmsbService;

    /**
     * 查询发改委_申报_主列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:list')")
    @GetMapping("/list")
    public TableDataInfo list(FgwXmsb fgwXmsb)
    {
        startPage();
        List<FgwXmsb> list = fgwXmsbService.selectFgwXmsbList(fgwXmsb);
        return getDataTable(list);
    }

    /**
     * 领导批示列表
     */
    @GetMapping("/ldps/list")
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:ldps:list')")
    public TableDataInfo ldpsList(FgwXmsb fgwXmsb)
    {
        startPage();
        List<FgwXmsb> list = fgwXmsbService.ldpsList(fgwXmsb);
        return getDataTable(list);
    }

    /**
     * 项目预警列表
     */
    @GetMapping("/xmyj/list")
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:xmyj:list')")
    public TableDataInfo xmyjList(FgwXmsb fgwXmsb)
    {
        List<FgwXmsb> list = fgwXmsbService.xmyjList(fgwXmsb);
        return getDataTable(list);
    }


    /**
     * 超期项目列表
     */
    @GetMapping("/cqxm/list")
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:cqxm:list')")
    public TableDataInfo cqxmList(FgwXmsb fgwXmsb)
    {
        List<FgwXmsb> list = fgwXmsbService.cqxmList(fgwXmsb);
        return getDataTable(list);
    }

    /**
     * 导出发改委_申报_主列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:export')")
    @Log(title = "发改委_申报_主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FgwXmsb fgwXmsb)
    {
        List<FgwXmsb> list = fgwXmsbService.selectFgwXmsbList(fgwXmsb);
        ExcelUtil<FgwXmsb> util = new ExcelUtil<FgwXmsb>(FgwXmsb.class);
        util.exportExcel(response, list, "发改委_申报_主数据");
    }

    /**
     * 获取发改委_申报_主详细信息
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(fgwXmsbService.selectFgwXmsbById(id));
    }

    /**
     * 新增发改委_申报_主
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:add')")
    @Log(title = "发改委_申报_主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FgwXmsb fgwXmsb)
    {
        return toAjax(fgwXmsbService.insertFgwXmsb(fgwXmsb));
    }

    /**
     * 修改发改委_申报_主
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:edit')")
    @Log(title = "发改委_申报_主", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody FgwXmsb fgwXmsb)
    {
        return fgwXmsbService.updateFgwXmsb(fgwXmsb);
    }

    /**
     * 删除发改委_申报_主
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:remove')")
    @Log(title = "发改委_申报_主", businessType = BusinessType.DELETE)
    @GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fgwXmsbService.deleteFgwXmsbByIds(ids));
    }

    /**
     * 查询发改委_申报_主列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmsb:num')")
    @GetMapping("/num")
    public AjaxResult num(FgwXmsb fgwXmsb)
    {
        return fgwXmsbService.selectFgwXmsbListAll(fgwXmsb);
    }
}
