From 61640d9deb0218215fdf372bba0e2fc987914c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 31 Jul 2023 17:09:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BD=E5=AE=B6=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CountrySelectorController.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java new file mode 100644 index 0000000..3254ccf --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java @@ -0,0 +1,62 @@ +package com.hnac.hzims.operational.station.controller; + + +import io.swagger.annotations.Api; +import org.springblade.core.tool.api.R; +import org.springblade.system.entity.Dict; +import org.springblade.system.feign.IDictClient; +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; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/country/selector") +@Api(value = "国家管理", tags = "国家管理") +public class CountrySelectorController { + + + @Autowired + private IDictClient iDictClient; + + + /** + * 查询国家字典数据 + * + * @return + */ + @GetMapping("/countryOfIssue") + public R countryOfIssue() { + R> regionGlobal = iDictClient.getList("region_global"); + if (!regionGlobal.isSuccess()) { + return R.fail("查询数据不存在"); + } + List collect = regionGlobal.getData().stream() + .filter(item -> item.getParentId().longValue() == 1684523498650771L) + .collect(Collectors.toList()); + return R.data(collect); + } + + + /** + * 查询省份字典数据 + * + * @return + */ + @GetMapping("/loadProvince") + public R loadProvince() { + R> regionGlobal = iDictClient.getList("region_global"); + if (!regionGlobal.isSuccess()) { + return R.fail("查询数据不存在"); + } + List collect = regionGlobal.getData().stream() + .filter(item -> item.getParentId().longValue() == 1684523498650771459L) + .collect(Collectors.toList()); + return R.data(collect); + } + + +} \ No newline at end of file