package com.fengdu.gas.repository.mapper; import com.fengdu.gas.repository.BasicMapper;import com.fengdu.gas.repository.po.FacilityRunTimePO; import org.apache.ibatis.annotations.Select; import java.util.List; /** * 设备运行时长 mapper * @author zr */ public interface FacilityRunTimeMapper extends BasicMapper { @Select("SELECT r.*\n" + " FROM facility_run_time r\n" + " INNER JOIN (\n" + " SELECT facility_id, MAX(create_time) AS max_timestamp\n" + " FROM facility_run_time WHERE open_time IS NOT NULL AND open_time<>'' AND close_time IS NOT NULL AND close_time <>''\n" + " GROUP BY facility_id\n" + " ) AS latest ON r.facility_id = latest.facility_id AND r.create_time = latest.max_timestamp;") List getDataTime(); @Select("select * from facility_run_time where is_delete=0 and open_time IS NOT NULL AND open_time<>'' AND close_time IS NOT NULL AND close_time <>'' ") ListselectByDataTime(); }