Browse Source

添加国家字典数据接口

zhongwei
段飞宇 1 year ago
parent
commit
61640d9deb
  1. 62
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java

62
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<List<Dict>> regionGlobal = iDictClient.getList("region_global");
if (!regionGlobal.isSuccess()) {
return R.fail("查询数据不存在");
}
List<Dict> collect = regionGlobal.getData().stream()
.filter(item -> item.getParentId().longValue() == 1684523498650771L)
.collect(Collectors.toList());
return R.data(collect);
}
/**
* 查询省份字典数据
*
* @return
*/
@GetMapping("/loadProvince")
public R loadProvince() {
R<List<Dict>> regionGlobal = iDictClient.getList("region_global");
if (!regionGlobal.isSuccess()) {
return R.fail("查询数据不存在");
}
List<Dict> collect = regionGlobal.getData().stream()
.filter(item -> item.getParentId().longValue() == 1684523498650771459L)
.collect(Collectors.toList());
return R.data(collect);
}
}
Loading…
Cancel
Save