package	com.sw.mes.yb.report.service.impl;


import com.sw.mes.core.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.sw.mes.yb.report.entity.CastMaterialInfo;
import com.sw.mes.yb.report.dao.CastMaterialInfoDao;
import com.sw.mes.yb.report.service.CastMaterialInfoService;

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


/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Service
@Transactional
public class CastMaterialInfoServiceImpl extends BaseServiceImpl<CastMaterialInfo> implements CastMaterialInfoService {
    CastMaterialInfoDao dao;
	@Autowired
    public void setDao(CastMaterialInfoDao dao) {
        super.setBaseDao(dao);
        this.dao=dao;
    }

    @Override
    public CastMaterialInfo findByLotNoAndMaterialType(String lotNo, String materialType) {
        List<CastMaterialInfo> list = dao.findByLotNoAndMaterialTypeOrderByIdDesc(lotNo, materialType);
        if (list != null && list.size() > 0){
            return list.get(0);
        }
        return null;
    }

    @Override
    public List<Map<String, Object>> energyStatisticsInfo() {
        return dao.findenergyStatisticsInfoAll();
    }
}
