package org.jeecg.modules.appInterface.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.appInterface.entity.FbsWorkingStatistics;
import org.jeecg.modules.appInterface.mapper.FbsWorkingStatisticsMapper;
import org.jeecg.modules.appInterface.service.IFbsWorkingStatisticsService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

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

/**
 * @Description: 工时统计接口
 * @author： jeecg-boot
 * @date：   2020-10-15
 * @version： V1.0
 */
@Service
//@DS("multi-datasource1")
public class FbsWorkingStatisticsServiceImpl extends ServiceImpl<FbsWorkingStatisticsMapper, FbsWorkingStatistics> implements IFbsWorkingStatisticsService {

    @Resource
    FbsWorkingStatisticsMapper fbsWorkingStatisticsMapper;

    @Override
    public Map<String,Object> getByMaterial(String dateString) {
        List<FbsWorkingStatistics> fbsWorkingStatisticsList=fbsWorkingStatisticsMapper.getByMaterial(dateString);
        Map<String,Object> map=new HashMap<>();
        if(fbsWorkingStatisticsList!=null){
            for(FbsWorkingStatistics fbsWorkingStatistics:fbsWorkingStatisticsList){
                map.put(fbsWorkingStatistics.getProduct(),fbsWorkingStatistics.getWorkingHours());
            }
        }
        return map;
    }
}
