package com.its.op.service.its.rse;

import com.its.op.dao.mapper.its.rse.RseOdStatHhMapper;
import com.its.op.dto.its.rse.RseOdStatDto;
import com.its.op.dto.its.rse.RseOdStatListDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Slf4j
@RequiredArgsConstructor
@Service
public class TbRseOdStatHhService {

    private final RseOdStatHhMapper mapper;

    /**
     * RSE OD 교통량 통계(RSE 기준 출발-도착 교통량)
     * @param fromDt
     * @param toDt
     * @return
     */
    @Transactional(readOnly = true)
    public List<RseOdStatDto> findAllOdListByDateRange(String fromDt, String toDt) {
        Map<String, String> param = new HashMap<>();
        param.put("FROM_DT", fromDt);
        param.put("TO_DT", toDt);
        return this.mapper.findAllOdListByDateRange(param);
    }

    /**
     * RSE OD 교통량 통계(출발 RSE, 도착 RSE 교통량)
     * @param fromDt
     * @param toDt
     * @return
     */
    @Transactional(readOnly = true)
    public List<RseOdStatListDto> findAllListByDateRange(String fromDt, String toDt) {
        Map<String, String> param = new HashMap<>();
        param.put("FROM_DT", fromDt);
        param.put("TO_DT", toDt);
        return this.mapper.findAllListByDateRange(param);
    }
}
