package com.sptg.gateway.controller.permissions;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.permissions.api.entity.Street;
import com.sptg.permissions.api.feigns.StreetFeign;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created By lidexi in 2020/12/25
 * 街道控制器
 **/
@RestController
@RequestMapping(value = "/permissions/street")
@RequiredArgsConstructor
public class StreetController {

    private final StreetFeign streetFeign;

    @GetMapping("getListByAreaCode")
    public ResultBean<Street> getListByAreaCode(@RequestParam(value = "areaCode",required = false)String areaCode){

        List<Street> streetList = streetFeign.getStreetList(areaCode);

        return new ResultBean<>(ResultEnum.SUCCESS,streetList);
    }
}
