package com.izouma.awesomeAdmin.web;

import com.izouma.awesomeAdmin.domain.District;
import com.izouma.awesomeAdmin.dto.PageQuery;
import com.izouma.awesomeAdmin.enums.DistrictLevel;
import com.izouma.awesomeAdmin.exception.BusinessException;
import com.izouma.awesomeAdmin.repo.DistrictRepo;
import com.izouma.awesomeAdmin.service.DistrictService;
import com.izouma.awesomeAdmin.utils.ObjUtils;
import com.izouma.awesomeAdmin.utils.excel.ExcelUtils;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/district")
@AllArgsConstructor
public class DistrictController extends BaseController {
    private final DistrictService districtService;

    @GetMapping({"/", ""})
    public List<District> get(@RequestParam(required = false) DistrictLevel level,
                              @RequestParam(required = false) DistrictLevel maxLevel,
                              @RequestParam(required = false) Long parent) {
        return districtService.get(level, maxLevel, parent);
    }
}

