package com.leromro.core.controller;

import com.leromro.common.core.domain.R;
import com.leromro.core.domain.dto.RegionTreeDTO;
import com.leromro.core.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 地址信息接口
 *
 * @author Chopper
 */
@RestController
@Api(tags = "省市区信息接口")
@RequestMapping("/utils/common/region")
public class RegionController {

    @Autowired
    private RegionService regionService;


    @GetMapping("/tree")
    @ApiOperation("获取地区树")
    public R<List<RegionTreeDTO>> getRegionTree() {
        List<RegionTreeDTO> regionTree = regionService.getRegionTree();
        return R.ok(regionTree);
    }

 /*   @GetMapping(value = "/item/{id}")
    @ApiImplicitParam(name = "id", value = "地区ID", required = true, dataType = "String", paramType = "path")
    @ApiOperation(value = "通过id获取子地区")
    public R<List<Region>> getItem(@PathVariable String id) {
        return R.ok(regionService.getItem(id));
    }

    @GetMapping("/tree")
    @ApiOperation("获取地区树")
    public List<RegionTreeDTO> getRegionTree() {
        return regionService.getRegionTree();
    }*/

}
