package com.dsk.system.service.impl;

import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.BaseEntity;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.mapper.BusinessInfoMapper;
import com.dsk.system.service.IBusinessOverviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author lcl
 * @create 2023/8/14
 */
@Service
public class BusinessOverviewServiceImpl implements IBusinessOverviewService {

    @Resource
    private BusinessInfoMapper businessInfoMapper;

    @Override
    @DataScope(userAlias = "u",deptAlias = "d")
    public Map<String, Object> statistics(BusinessSearchDto dto) {
        Map<String, Object> resultMap = new HashMap<>();
        //总
        resultMap.put("totalCount",businessInfoMapper.selectCountByStatus(dto));
        //储备
        dto.setStatus(0);
        resultMap.put("reserveCount",businessInfoMapper.selectCountByStatus(dto));
        //跟进
        dto.setStatus(1);
        resultMap.put("followUpCount",businessInfoMapper.selectCountByStatus(dto));
        //中标(已合作)
        dto.setStatus(2);
        resultMap.put("bidCount",businessInfoMapper.selectCountByStatus(dto));
        return resultMap;
    }
}
