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


import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.yb.pad.dao.PieceDetailDao;
import com.sw.mes.yb.pad.entity.PieceDetail;
import com.sw.mes.yb.pad.service.PieceDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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


/**
 * @Author
 * @Description：
 * @Date: Create in
 * @Modified By:
 */
@Service
@Transactional
public class PieceDetailServiceImpl extends BaseServiceImpl<PieceDetail> implements PieceDetailService {
    PieceDetailDao dao;

    @Autowired
    public void setDao(PieceDetailDao dao) {
        super.setBaseDao(dao);
        this.dao = dao;
    }

    @Override
    public List<Map<String, Object>> queryProductionPieceDetail(String pieceNo,String startDate,String endDate) {
        return dao.queryProductionPieceDetail(pieceNo,startDate,endDate);
    }

    @Override
    public PieceDetail findByPieceNo(String pieceNo) {
        if (dao.findByPieceNo(pieceNo).isEmpty()) {
            return null;
        }
        return dao.findByPieceNo(pieceNo).get(0);
    }
}
