package com.ruoyi.web.controller.projectV2;

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

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.projectV2.ZsyzSkDzje;
import com.ruoyi.system.service.projectV2.IZsyzSkDzjeService;
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-28
 */
@RestController
@RequestMapping("/projectV2/dzje")
public class ZsyzSkDzjeController extends BaseController
{
    @Autowired
    private IZsyzSkDzjeService zsyzSkDzjeService;

    /**
     * 查询招商引资_省库项目_到资金额列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsyzSkDzje zsyzSkDzje)
    {
        startPage();
        List<ZsyzSkDzje> list = zsyzSkDzjeService.selectZsyzSkDzjeList(zsyzSkDzje);
        return getDataTable(list);
    }

    /**
     * 导出招商引资_省库项目_到资金额列表
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:export')")
    @Log(title = "招商引资_省库项目_到资金额", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZsyzSkDzje zsyzSkDzje)
    {
        List<ZsyzSkDzje> list = zsyzSkDzjeService.selectZsyzSkDzjeList(zsyzSkDzje);
        ExcelUtil<ZsyzSkDzje> util = new ExcelUtil<ZsyzSkDzje>(ZsyzSkDzje.class);
        util.exportExcel(response, list, "招商引资_省库项目_到资金额数据");
    }

    /**
     * 获取招商引资_省库项目_到资金额详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zsyzSkDzjeService.selectZsyzSkDzjeById(id));
    }

    /**
     * 新增招商引资_省库项目_到资金额
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:add')")
    @Log(title = "招商引资_省库项目_到资金额", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsyzSkDzje zsyzSkDzje)
    {
        return toAjax(zsyzSkDzjeService.insertZsyzSkDzje(zsyzSkDzje));
    }

    /**
     * 修改招商引资_省库项目_到资金额
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:edit')")
    @Log(title = "招商引资_省库项目_到资金额", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody ZsyzSkDzje zsyzSkDzje)
    {
        return toAjax(zsyzSkDzjeService.updateZsyzSkDzje(zsyzSkDzje));
    }

    /**
     * 删除招商引资_省库项目_到资金额
     */
    @PreAuthorize("@ss.hasPermi('projectV2:dzje:remove')")
    @Log(title = "招商引资_省库项目_到资金额", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsyzSkDzjeService.deleteZsyzSkDzjeByIds(ids));
    }
}
