package com.ltgk.web.controller.system;

import com.ltgk.common.core.domain.AjaxResult;
import com.ltgk.system.domain.dto.SysAreaDto;
import com.ltgk.system.service.SysAreaInfoService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @Author: wan kun
 * @Description: 获取地区列表
 * @Date: 2024/12/11 16:19
 * @Version: 1.0
 */
@Api(tags = "地区管理")
@RestController
@RequestMapping("/system/area")
public class SysAreaController {
    @Autowired
    private SysAreaInfoService sysAreaInfoService;

    /**
     * 获取行政区树
     *
     * @param areaCode 区域编码 最高级传0
     * @Return {@link List<SysAreaDto>}
     */
    @GetMapping(value = "/getAreaTree/{areaCode}")
    public AjaxResult getAreaTree(@PathVariable("areaCode") String areaCode) {
        return AjaxResult.success(sysAreaInfoService.getAreaTree(areaCode));
    }
}
