package com.cirle.scientific.service.impl;

import com.cirle.scientific.dao.RegionDao;
import com.cirle.scientific.po.SysRegion;
import com.cirle.scientific.service.SysRegionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;


@Service
@Slf4j
@Transactional
public class SysRegionServiceImpl implements SysRegionService {


    @Autowired
    RegionDao regionDao;

    @Override
    public List<SysRegion> getRegion(Integer pid) {
        if (pid == null) {
            return Collections.emptyList();
        }
        return regionDao.findByParentId(pid);
    }
}
