package com.sw.mes.production.service.impl;


import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.production.dao.FormulaProductSchemeWeightDetailDao;
import com.sw.mes.production.entity.FormulaProductSchemeWeightDetail;
import com.sw.mes.production.service.FormulaProductSchemeWeightDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;


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

    @Override
    public void deleteByFpsId(Long fpsId) {
        dao.deleteAllByFormulaProductSchemeId(fpsId);
    }

    @Override
    public List<FormulaProductSchemeWeightDetail> getListByFpsId(Long fpsId) {
        return dao.findByFormulaProductSchemeId(fpsId);
    }

    @Override
    public FormulaProductSchemeWeightDetail findByFpsIdAndScope(Long fpsId, BigDecimal weight) {
        return dao.findByFpsIdAndScope(fpsId, weight);
    }
}
