package com.ruoyi.web.controller.projectV2;

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

import com.ruoyi.system.domain.projectV2.Vo.ZsyzQktjDc;
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.ZsyzQktj;
import com.ruoyi.system.service.projectV2.IZsyzQktjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 招商引资_情况月统计Controller
 * 
 * @author ruoyi
 * @date 2023-03-10
 */
@RestController
@RequestMapping("/system/qktj")
public class ZsyzQktjController extends BaseController
{
    @Autowired
    private IZsyzQktjService zsyzQktjService;

    /**
     * 查询招商引资_情况月统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzQktj zsyzQktj)
    {
        startPage();
        List<ZsyzQktj> list = zsyzQktjService.selectZsyzQktjList(zsyzQktj);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_情况月统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:export')")
    @Log(title = "招商引资_情况月统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZsyzQktj zsyzQktj)
    {
        List<ZsyzQktjDc> list = zsyzQktjService.selectZsyzQktjListTj(zsyzQktj);
        ExcelUtil<ZsyzQktjDc> util = new ExcelUtil<ZsyzQktjDc>(ZsyzQktjDc.class);
        util.exportExcel(response, list, "招商引资_情况月统计数据","招商引资_情况月统计数据("+zsyzQktj.getYear()+"-"+zsyzQktj.getMonth()+")");
        //util.exportExcel(list, "招商引资_情况月统计数据", "招商引资_情况月统计数据("+zsyzQktj.getYear()+"-"+zsyzQktj.getMonth()+")");
    }

    /**
     * 获取招商引资_情况月统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zsyzQktjService.selectZsyzQktjById(id));
    }

    /**
     * 新增招商引资_情况月统计
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:add')")
    @Log(title = "招商引资_情况月统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzQktj zsyzQktj)
    {
        return zsyzQktjService.insertZsyzQktj(zsyzQktj);
    }

    /**
     * 修改招商引资_情况月统计
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:edit')")
    @Log(title = "招商引资_情况月统计", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzQktj zsyzQktj)
    {
        return toAjax(zsyzQktjService.updateZsyzQktj(zsyzQktj));
    }

    /**
     * 删除招商引资_情况月统计
     */
    @PreAuthorize("@ss.hasPermi('system:qktj:remove')")
    @Log(title = "招商引资_情况月统计", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsyzQktjService.deleteZsyzQktjByIds(ids));
    }
}
