鞍钢鲅鱼圈能源管控系统后端代码
houzhongjian
2024-12-26 07073fa5e1e14b1f9d5d4f3253d9403ab311ae3c
提交 | 用户 | 时间
07073f 1 package com.iailab.module.ansteel.controller.app.ip;
H 2
3 import cn.hutool.core.lang.Assert;
4 import com.iailab.framework.common.pojo.CommonResult;
5 import com.iailab.framework.common.util.object.BeanUtils;
6 import com.iailab.framework.ip.core.Area;
7 import com.iailab.framework.ip.core.utils.AreaUtils;
8 import com.iailab.module.ansteel.controller.app.ip.vo.AppAreaNodeRespVO;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.tags.Tag;
11 import org.springframework.validation.annotation.Validated;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController;
15
16 import java.util.List;
17
18 import static com.iailab.framework.common.pojo.CommonResult.success;
19
20 @Tag(name = "用户 App - 地区")
21 @RestController
22 @RequestMapping("/system/area")
23 @Validated
24 public class AppAreaController {
25
26     @GetMapping("/tree")
27     @Operation(summary = "获得地区树")
28     public CommonResult<List<AppAreaNodeRespVO>> getAreaTree() {
29         Area area = AreaUtils.getArea(Area.ID_CHINA);
30         Assert.notNull(area, "获取不到中国");
31         return success(BeanUtils.toBean(area.getChildren(), AppAreaNodeRespVO.class));
32     }
33
34 }