package com.sw.mes.production.dao;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.production.entity.FormulaMaterialClass;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface FormulaMaterialClassDao extends BaseDao<FormulaMaterialClass, Long> {

    FormulaMaterialClass findByName(String name);

    @Query(value = "SELECT pfmc.* from production_formula_material_class as pfmc left join production_formula_material_class_detail pfmcd on pfmc.id =pfmcd.formula_material_class_id \n" +
            "where pfmcd.material_code = ?1 ", nativeQuery = true)
    List<FormulaMaterialClass> findFormulaMaterialClassByMaterialCode(String materialCode);
}