package cn.com.oa.controller;

import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.oa.service.IProjectInfoService;
import io.swagger.annotations.ApiOperation;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/projectInfo")
public class ProjectInfoController extends BaseController {
    @Autowired
    private IProjectInfoService projectInfoService;

    @ApiOperation(value = "获取项目总数", notes = "获取项目总数")
    @GetMapping("/getProjectCount")
    @ResponseBody
    public AjaxResult getProjectCount()
    {
        Integer projectCount = projectInfoService.getProjectCount();
        //return projectCount;
        return AjaxResult.successData(200,projectCount).put("msg","获取成功");
    }

    @ApiOperation(value = "获取本周项目任务数量", notes = "获取本周项目任务数量")
    @GetMapping("/getWeekProjectTaskCount")
    @ResponseBody
    public AjaxResult getWeekProjectTaskCount()
    {
        List<Map<String,Object>> taskList = projectInfoService.getWeekProjectTaskCount();
        //return taskList;
        return AjaxResult.successData(200,taskList).put("msg","获取成功");
    }

    @ApiOperation(value = "获取项目任务数量", notes = "获取项目任务数量")
    @GetMapping("/getProjectTaskCount")
    @ResponseBody
    public AjaxResult getProjectTaskCount()
    {
        List<Map<String,Object>> taskList = projectInfoService.getProjectTaskCount();
        //return taskList;
        return AjaxResult.successData(200,taskList).put("msg","获取成功");
    }
}
