package cn.com.ty.lift.ud.areaCode.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.com.ty.lift.ud.areaCode.mapper.entity.AreaCode;
import cn.com.ty.lift.ud.areaCode.service.IAreaCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 行政区划 API
 * 
 * @author Xson
 * @date 2020-04-30
 */
@Api(tags = "行政区划 API")
@RestController
@RequestMapping("/api/areaCodes")
public class AreaCodeController {

    private final Logger log = LoggerFactory.getLogger(AreaCodeController.class);
    
    private @Autowired IAreaCodeService areaCodeService;
    
    @ApiOperation(value = "获取所有的区域数据")
    @GetMapping("/allAreaCode")
    public List<AreaCode> allAreaCode(){
        return areaCodeService.areaTree();
    }
    
    @ApiOperation(value = "获取市级数据")
    @GetMapping("/allCityCode")
    public List<AreaCode> allCityCode(){
        return areaCodeService.allCityCode();
    }

}