package com.hzjt.service;

import com.hzjt.domain.Vehicle;
import com.hzjt.domain.Vehicles;
import com.hzjt.domain.Vehiclesdetail;
import com.hzjt.mapper.TraffFlowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

@Service
public class TraffFlowService {

    @Autowired
    private TraffFlowMapper traffFlowMapper;


    public void saveTraffFlow(Vehicles vehicles) {
        traffFlowMapper.add(vehicles);
    }
    public int saveTraffFlowDetail(Vehicle vehiclesdetail ) {
       return  traffFlowMapper.insertlist(vehiclesdetail);
    }

    public List<Map> selectFiveAndDayFlow(String videoid) {
       return  traffFlowMapper.selectFiveAndDayFlow(videoid);
    }
    public List<Map> selectFiveAndTypeDayFlow(String videoid) {
        return  traffFlowMapper.selectFiveAndTypeDayFlow(videoid);
    }

    public Integer statisVehiclesByDay(String starttime) {
        return  traffFlowMapper.statisVehiclesByDay(starttime);
    }
    @Transactional(rollbackFor = Exception.class)
    public void deleteBeforeTwoMonthVehicles(String starttime) {
        traffFlowMapper.deleteBeforeTwoMonthVehiclesDetails(starttime);
    }
    @Transactional(rollbackFor = Exception.class)
    public void deleteVehiclesByDay() {
        traffFlowMapper.deleteVehiclesByDay();
    }

    public Integer insertOrUpdatevehicleTodaystatistic() {
      return   traffFlowMapper.insertOrUpdatevehicleTodaystatistic();
    }






}