package com.yanzhu.jh.project.controller;

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

import com.ruoyi.system.domain.FlowTaskEntity;
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.yanzhu.jh.project.domain.SurProjectAuditinfo;
import com.yanzhu.jh.project.service.ISurProjectAuditinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 项目审核信息Controller
 * 
 * @author JiangYuQi
 * @date 2023-09-20
 */
@RestController
@RequestMapping("/project/projectAuditinfo")
public class SurProjectAuditinfoController extends BaseController
{
    @Autowired
    private ISurProjectAuditinfoService surProjectAuditinfoService;

    /**
     * 查询项目审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(SurProjectAuditinfo surProjectAuditinfo)
    {
        startPage();
        List<SurProjectAuditinfo> list = surProjectAuditinfoService.selectSurProjectAuditinfoList(surProjectAuditinfo);
        return getDataTable(list);
    }

    /**
     * 查询项目审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:list')")
    @GetMapping("/findList")
    public TableDataInfo findList(FlowTaskEntity flowTaskEntity)
    {
        startPage();
        flowTaskEntity.setNowUserName(getUsername());
        return getDataTable(surProjectAuditinfoService.selectMyAwaitFlowTask(flowTaskEntity));
    }

    /**
     * 统计审核信息
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:list')")
    @GetMapping("/findAuditCount")
    public AjaxResult findAuditCount(FlowTaskEntity flowTaskEntity)
    {
        flowTaskEntity.setNowUserName(getUsername());
        return success(surProjectAuditinfoService.queryCount(flowTaskEntity));
    }

    /**
     * 导出项目审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:export')")
    @Log(title = "项目审核信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SurProjectAuditinfo surProjectAuditinfo)
    {
        List<SurProjectAuditinfo> list = surProjectAuditinfoService.selectSurProjectAuditinfoList(surProjectAuditinfo);
        ExcelUtil<SurProjectAuditinfo> util = new ExcelUtil<SurProjectAuditinfo>(SurProjectAuditinfo.class);
        util.exportExcel(response, list, "项目审核信息数据");
    }

    /**
     * 获取项目审核信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(surProjectAuditinfoService.selectSurProjectAuditinfoById(id));
    }

    /**
     * 新增项目审核信息
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:add')")
    @Log(title = "项目审核信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SurProjectAuditinfo surProjectAuditinfo)
    {
        return toAjax(surProjectAuditinfoService.insertSurProjectAuditinfo(surProjectAuditinfo));
    }

    /**
     * 修改项目审核信息
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:edit')")
    @Log(title = "项目审核信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SurProjectAuditinfo surProjectAuditinfo)
    {
        return toAjax(surProjectAuditinfoService.updateSurProjectAuditinfo(surProjectAuditinfo));
    }

    /**
     * 删除项目审核信息
     */
    @PreAuthorize("@ss.hasPermi('project:projectAuditinfo:remove')")
    @Log(title = "项目审核信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(surProjectAuditinfoService.deleteSurProjectAuditinfoByIds(ids));
    }
}
