package com.yanzhu.jh.bigscreen.web.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.yanzhu.jh.project.domain.SurProjectChecking;
import com.yanzhu.jh.project.service.ISurProjectCheckingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目验收Conller
 */
@RestController
@RequestMapping("/bgscreen/projectChecking")
public class ProjectCheckingController extends BaseController {

    @Autowired
    private ISurProjectCheckingService surProjectCheckingService;

    /**
     * 根据条件查询项目举牌验收列表
     * @param deptId
     * @param projectId
     * @return
     */
    @GetMapping("/getProjectCheckingList")
    public TableDataInfo getProjectCheckingList(String deptId, String projectId){
        SurProjectChecking surProjectChecking = new SurProjectChecking();
        if(deptId!=null && !"0".equals(deptId)){
            surProjectChecking.setProjectDeptId(deptId);
        }
        if(projectId!=null && !"0".equals(projectId)){
            surProjectChecking.setProjectId(Convert.toLong(projectId));
        }
        return getDataTable(surProjectCheckingService.selectBgscreenProjectCheckingList(surProjectChecking));
    }

    /**
     * 根据条件查询项目举牌验收统计
     * @param deptId
     * @param projectId
     * @return
     */
    @GetMapping("/getProjectCheckingView")
    public AjaxResult getProjectCheckingView(String deptId, String projectId){
        SurProjectChecking surProjectChecking = new SurProjectChecking();
        if(deptId!=null && !"0".equals(deptId)){
            surProjectChecking.setProjectDeptId(deptId);
        }
        if(projectId!=null && !"0".equals(projectId)){
            surProjectChecking.setProjectId(Convert.toLong(projectId));
        }
        return success(surProjectCheckingService.selectBgscreenProjectCheckingView(surProjectChecking));
    }
}
