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

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

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

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface AccessoryOrderDao extends BaseDao<AccessoryOrder, Integer> {
    //各热场件平均使用天数和定额天数对比（正常损耗）
    @Query(value = "call pro_report_accessory_life_avg(:accessoryTypeName,:startTime,:endTime)", nativeQuery = true)
    List<Map<String,Object>> accessoryLifeAvg(@Param("accessoryTypeName") String accessoryTypeName, @Param("startTime") String startTime, @Param("endTime") String endTime);

    //同一热场件不同厂家寿命对比（正常损耗）
    @Query(value = "call pro_report_accessory_supplier_life_avg(:accessoryTypeName,:startTime,:endTime)", nativeQuery = true)
    List<Map<String,Object>> accessorySupplierLifeAvg(@Param("accessoryTypeName") String accessoryTypeName, @Param("startTime") String startTime, @Param("endTime") String endTime);

    //质量问题损失占比
    @Query(value = "call pro_report_accessory_quality(:accessoryTypeName,:startTime,:endTime)", nativeQuery = true)
    List<Map<String,Object>> accessoryQuality(@Param("accessoryTypeName") String accessoryTypeName, @Param("startTime") String startTime, @Param("endTime") String endTime);

}
