package com.yccrc.kede.controller.admin;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.*;
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.yccrc.common.annotation.Log;
import com.yccrc.common.core.controller.BaseController;
import com.yccrc.common.core.domain.entity.SysUser;
import com.yccrc.common.vo.*;
import io.swagger.annotations.*;
import com.yccrc.common.enums.BusinessType;
import com.yccrc.common.utils.PageUtils;
import com.yccrc.kede.domain.Attach;
import com.yccrc.kede.domain.Project;
import com.yccrc.kede.enums.AttachTypeEnum;
import com.yccrc.kede.service.IAttachService;
import com.yccrc.kede.service.IProjectService;
import com.yccrc.kede.vo.ProjectDetailVO;
import com.yccrc.kede.vo.ProjectListVO;
import com.yccrc.kede.vo.ProjectQueryVO;


/**
 * 项目信息Controller
 * 
 * @author yccrc
 * @date 2022-04-25
 */
@Api(tags = "项目管理")
@RestController
@RequestMapping("/admin/project")
public class ProjectAdminController extends BaseController
{
    @Autowired
    private IProjectService projectService;

    @Autowired
    private IAttachService attachService;
    
    @ApiOperation(value = "查询项目列表")
    @GetMapping("/list")
    public Result<Page<ProjectListVO>> list(ProjectQueryVO project)
    {
       return new Result<Page<ProjectListVO>>().ok(projectService.selectProject(project));
     
    }
    

    @ApiOperation(value = "项目回退(申报里的)")
	@PutMapping("cancel/{ids}")
    public Result<Boolean> cancel(@PathVariable Integer[] ids)
    {
        return new Result<Boolean>().ok(projectService.cancel(ids));
    }
//    
//    @ApiOperation(value = "查询项目信息列表")
//    @GetMapping("/list")
//    public Result<Page<Project>> list(ProjectQueryVO project)
//    {
//    	SysUser user = super.getLoginUser().getUser();
//		switch(user.getUserType()) {
//			case GOV_PROV:
//				project.setProvinceId(user.getScopeId());
//				break;
//			case GOV_CITY:
//				project.setCityId(user.getScopeId());
//				break;
//			case GOV_DISTRI:
//				project.setDistrictId(user.getScopeId());
//				break;
//			default:
//				break;
//		}
//		
//       return new Result<Page<Project>>().ok(projectService.selectReportProject(project));
//     
//    }
    

//    @ApiOperation(value = "获取项目信息详细信息")
//    @GetMapping(value = "/{id}")
//    public Result<ProjectDetailVO> getInfo(@PathVariable("id") Integer id)
//    {
//        return new Result<ProjectDetailVO>().ok(projectService.getProject(id));
//    }
//
    @ApiOperation(value = "删除项目信息")
    @Log(title = "项目信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result<Boolean> remove(@PathVariable Integer[] ids)
    {
    	
        return new Result<Boolean>().ok(projectService.remove(ids));
    }
}
