Browse Source

fix(all): 优化获取全部区划

pull/1/head
zhaoqiaobo 12 months ago
parent
commit
2466fa7ee4
  1. 3
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
  2. 12
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
  3. 1
      blade-service/blade-system/src/main/java/org/springblade/system/controller/RegionController.java
  4. 24
      blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
  5. 2
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RegionServiceImpl.java

3
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java

@ -19,6 +19,7 @@ package org.springblade.system.feign;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.*;
import org.springblade.system.vo.RegionAllVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -290,6 +291,6 @@ public interface ISysClient {
* @return
*/
@GetMapping(REGIONS)
R<String> getRegionALL();
R<List<RegionAllVO>> getRegionALL();
}

12
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java

@ -17,7 +17,15 @@
package org.springblade.system.feign;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.*;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Menu;
import org.springblade.system.entity.Param;
import org.springblade.system.entity.Post;
import org.springblade.system.entity.Region;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springblade.system.entity.TenantPackage;
import org.springblade.system.vo.RegionAllVO;
import org.springframework.stereotype.Component;
import java.util.List;
@ -151,7 +159,7 @@ public class ISysClientFallback implements ISysClient {
}
@Override
public R<String> getRegionALL() {
public R<List<RegionAllVO>> getRegionALL() {
return R.fail("获取数据失败");
}

1
blade-service/blade-system/src/main/java/org/springblade/system/controller/RegionController.java

@ -110,7 +110,6 @@ public class RegionController extends BladeController {
// })
// @ApiOperationSupport(order = 3)
@ApiOperation(value = "加载全部省市区")
@Cacheable(cacheNames = "lazyListAll")
public R<List<RegionAllVO>> lazyListAll() {
List<RegionAllVO> list = regionService.lazyListAll();
return R.data(list);

24
blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java

@ -19,8 +19,23 @@ package org.springblade.system.feign;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.*;
import org.springblade.system.service.*;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Menu;
import org.springblade.system.entity.Param;
import org.springblade.system.entity.Post;
import org.springblade.system.entity.Region;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springblade.system.entity.TenantPackage;
import org.springblade.system.service.IDeptService;
import org.springblade.system.service.IMenuService;
import org.springblade.system.service.IParamService;
import org.springblade.system.service.IPostService;
import org.springblade.system.service.IRegionService;
import org.springblade.system.service.IRoleService;
import org.springblade.system.service.ITenantPackageService;
import org.springblade.system.service.ITenantService;
import org.springblade.system.vo.RegionAllVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@ -192,9 +207,8 @@ public class SysClient implements ISysClient {
}
@Override
public R<String> getRegionALL() {
return R.data(regionService.selectAllStr());
public R<List<RegionAllVO>> getRegionALL() {
return R.data(regionService.lazyListAll());
}
}

2
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RegionServiceImpl.java

@ -37,6 +37,7 @@ import org.springblade.system.service.IRegionService;
import org.springblade.system.vo.RegionAllVO;
import org.springblade.system.vo.RegionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -128,6 +129,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
@Override
@Cacheable(cacheNames = "blade:sys:regions")
public List<RegionAllVO> lazyListAll() {
List<RegionAllVO> list = new ArrayList<>();

Loading…
Cancel
Save