From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001
From: lee <4766465@qq.com>
Date: Wed, 18 Dec 2024 13:27:00 +0800
Subject: [PATCH] init

---
 yami-shop-api/src/main/java/com/yami/shop/api/controller/AreaController.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/AreaController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/AreaController.java
new file mode 100644
index 0000000..4a8eafa
--- /dev/null
+++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/AreaController.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
+ *
+ * https://www.mall4j.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+package com.yami.shop.api.controller;
+
+import com.yami.shop.bean.dto.AreaDto;
+import com.yami.shop.bean.model.Area;
+import com.yami.shop.common.response.ServerResponseEntity;
+import com.yami.shop.service.AreaService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.Operation;
+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 java.util.List;
+
+/**
+ * @author lgh on 2018/10/26.
+ */
+@RestController
+@RequestMapping("/p/area")
+@Tag(name = "省市区接口")
+public class AreaController {
+
+    @Autowired
+    private AreaService areaService;
+
+    /**
+     * 分页获取
+     */
+    @GetMapping("/listByPid")
+    @Operation(summary = "获取省市区信息" , description = "根据省市区的pid获取地址信息")
+    @Parameters({
+            @Parameter(name = "level", description = "省市区的level(level为1获取所有省份)" ),
+            @Parameter(name = "pid", description = "省市区的pid" , required = true)
+    })
+    public ServerResponseEntity<List<Area>> listByPid(Long pid, Integer level) {
+        List<Area> list = areaService.listByPid(pid, level);
+        return ServerResponseEntity.success(list);
+    }
+
+    @GetMapping("/getAreaListInfo")
+    @Operation(summary = "获取省市区信息" , description = "获取完整层级的地址信息")
+    public ServerResponseEntity<List<AreaDto>> getAreaListInfo() {
+        List<AreaDto> areaDtoList = areaService.getAreaListInfo();
+        return ServerResponseEntity.success(areaDtoList);
+    }
+
+}

--
Gitblit v1.9.3