package cn.com.oa.service.impl;

import cn.com.oa.common.constant.DataService;
import cn.com.oa.mapper.ProjectInfoMapper;
import cn.com.oa.model.Group;
import cn.com.oa.model.ProjectInfo;
import cn.com.oa.model.vo.FlowInstanceVo;
import cn.com.oa.model.vo.ProjectInfoVo;
import cn.com.oa.service.IProjectInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 *  服务实现类
 * </p>
 */
@Service
public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements IProjectInfoService {

    @Override
    public Integer getProjectCount() {
        Map constantData = DataService.getConstantData();
        Group group = (Group)constantData.get("defaultGroup");
        ProjectInfoVo projectInfo = new ProjectInfoVo();
        projectInfo.setUnitId(group.getUNIVERSALID());
        Integer projectCount = baseMapper.getProjectCount(projectInfo);
        return projectCount;
    }

    @Override
    public List<Map<String, Object>> getWeekProjectTaskCount() {
        Map constantData = DataService.getConstantData();
        Group group = (Group)constantData.get("defaultGroup");
        ProjectInfoVo projectInfo = new ProjectInfoVo();
        projectInfo.setUnitId(group.getUNIVERSALID());
        List<Map<String,Object>> taskList = baseMapper.getWeekProjectTaskCount(projectInfo);
        return taskList;
    }

    @Override
    public List<Map<String, Object>> getProjectTaskCount() {
        Map constantData = DataService.getConstantData();
        Group group = (Group)constantData.get("defaultGroup");
        ProjectInfoVo projectInfo = new ProjectInfoVo();
        projectInfo.setUnitId(group.getUNIVERSALID());
        List<Map<String,Object>> taskList = baseMapper.getProjectTaskCount(projectInfo);
        return taskList;
    }
}
