package com.sw.mes.yb.accessory.dao;

import com.sw.mes.yb.accessory.entity.AccessoryMaterial;
import com.sw.mes.core.base.BaseDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface AccessoryMaterialDao extends BaseDao<AccessoryMaterial, Integer> {

    List<AccessoryMaterial> findByCodesOrderByCreateDateDesc(String productNo);

    @Query(value = "SELECT * FROM zhxx_accessory_material zam WHERE zam.material_model_id = ?1 AND zam.del = 0", nativeQuery = true)
    List<AccessoryMaterial> findMaterialId(Long materialModelId);
    @Query(value = "SELECT * FROM zhxx_accessory_material zam WHERE zam.codes = ?1 AND zam.del = 0", nativeQuery = true)
    List<AccessoryMaterial> getByMaterialCode(String materialCode);
}
