<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huatek.busi.mapper.BusiSemiAutomaticEvaluateDataMapper">

    <select id="getLatestByEquipmentType" resultType="com.huatek.busi.vo.BusiSemiAutomaticEvaluateDataVo">

        SELECT
            site_id as siteId,
            main_equipment_id as mainEquipmentId,
            equipment_type as equipmentType,
            current,
            voltage,
            duration,
            break_times as breakTimes,
            create_time as createTime
        FROM
            busi_semi_automatic_evaluate_data
        WHERE
            equipment_type = #{equipmentType}
            and main_equipment_id=#{mainEquipmentId}
            and site_id=#{siteId}
        order by
            create_time desc
        limit 1
    </select>

    <select id="getAllByEquipmentID" resultType="com.huatek.busi.vo.BusiSemiAutomaticEvaluateDataVo">

        SELECT
            site_id as siteId,
            main_equipment_id as mainEquipmentId,
            equipment_type as equipmentType,
            current,
            voltage,
            duration,
            break_times as breakTimes,
            create_time as createTime
        FROM
            busi_semi_automatic_evaluate_data
        WHERE
            equipment_type = #{equipmentType}
            and main_equipment_id=#{mainEquipmentId}
            and site_id=#{siteId}
    </select>
</mapper>
