| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.trafficaudit.observation.dto.ObservationDateSummary; |
| | | import com.trafficaudit.observation.dto.ObservationDailyOperation; |
| | | import com.trafficaudit.observation.entity.ObservationStationFlow; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | import java.time.LocalDate; |
| | | |
| | | @Mapper |
| | | public interface ObservationStationFlowMapper extends BaseMapper<ObservationStationFlow> { |
| | |
| | | + "MAX(updated_at) AS imported_at " |
| | | + "FROM observation_station_flow GROUP BY obs_date ORDER BY obs_date ASC") |
| | | List<ObservationDateSummary> selectDateSummary(); |
| | | |
| | | @Select("SELECT obs_date, COUNT(*) AS station_count, " |
| | | + "AVG(vehicle_speed) AS average_speed, " |
| | | + "AVG(congestion_degree) AS average_congestion " |
| | | + "FROM observation_station_flow " |
| | | + "WHERE obs_date BETWEEN #{startDate} AND #{endDate} " |
| | | + "GROUP BY obs_date ORDER BY obs_date ASC") |
| | | List<ObservationDailyOperation> selectDailyOperations(@Param("startDate") LocalDate startDate, |
| | | @Param("endDate") LocalDate endDate); |
| | | } |