springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/BcRegionApi.java
@@ -30,7 +30,7 @@ @ApiOperation("四级联动接口") @GetMapping("levelList") public R levelList(){ return this.communityService.levelList(); public R levelList(@RequestParam("level")Integer level,@RequestParam("code")String code){ return this.communityService.levelList(level,code); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -9878,5 +9878,8 @@ R updateComActAcidCheckRecord(@RequestBody ComActAcidCheckRecordVO comActAcidCheckRecordVO); @GetMapping("/bcRegion/levelList") R levelList(); R levelList(@RequestParam("level")Integer level,@RequestParam("code")String code); @GetMapping("/bcRegion/levelListBackstage") R levelListBackstage(); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BcRegionApi.java
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -33,6 +34,6 @@ @ApiOperation("四级联动接口") @GetMapping("levelList") public R levelList(){ return this.communityService.levelList(); return this.communityService.levelListBackstage(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/BcRegionApi.java
@@ -43,7 +43,12 @@ return this.bcRegionService.pageList(province,city,country,town); } @GetMapping("levelList") public R levelList(){ return this.bcRegionService.levelList(); public R levelList(@RequestParam("level")Integer level,@RequestParam("code")String code){ return this.bcRegionService.levelList(level,code); } @GetMapping("levelListBackstage") public R levelListBackstage(){ return this.bcRegionService.levelListBackstage(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/BcRegionService.java
@@ -25,5 +25,11 @@ * 四级联动列表 * @return */ R levelList(); R levelList(Integer level,String code); /** * 四级联动列表 * @return */ R levelListBackstage(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BcRegionServiceImpl.java
@@ -35,7 +35,48 @@ } @Override public R levelList() { public R levelList(Integer level,String code) { if(level==1){ List<ProvinceCityReturnVO> firstLevel=this.baseMapper.selectFirst(); return R.ok(firstLevel); } if(level==2){ List<ProvinceCityReturnVO> secondLevel=this.baseMapper.selectSecond(code); return R.ok(secondLevel); } if(level==3){ List<ProvinceCityReturnVO> thirdLevel=this.baseMapper.selectThird(code); return R.ok(thirdLevel); } if(level==4){ List<ProvinceCityReturnVO> fourthLevel=this.baseMapper.selectFourth(code); return R.ok(fourthLevel); } return R.fail("参数错误"); // if(stringRedisTemplate.hasKey("levelList")){ // return R.ok(stringRedisTemplate.opsForValue().get("levelList")); // } // else { // List<ProvinceCityReturnVO> firstLevel=this.baseMapper.selectFirst(); // firstLevel.forEach(provinceCityReturnVO -> { // List<ProvinceCityReturnVO> secondLevel=this.baseMapper.selectSecond(provinceCityReturnVO.getCode()); // secondLevel.forEach(provinceCityReturnVO1 -> { // List<ProvinceCityReturnVO> thirdLevel=this.baseMapper.selectThird(provinceCityReturnVO1.getCode()); // thirdLevel.forEach(provinceCityReturnVO2 -> { // List<ProvinceCityReturnVO> fourthLevel=this.baseMapper.selectFourth(provinceCityReturnVO2.getCode()); // provinceCityReturnVO2.setProvinceCityReturnVOList(fourthLevel); // }); // provinceCityReturnVO1.setProvinceCityReturnVOList(thirdLevel); // }); // provinceCityReturnVO.setProvinceCityReturnVOList(secondLevel); // }); // stringRedisTemplate.opsForValue().set("levelList", JSON.toJSONString(firstLevel)); // return R.ok(firstLevel); // } } @Override public R levelListBackstage() { if(stringRedisTemplate.hasKey("levelList")){ return R.ok(stringRedisTemplate.opsForValue().get("levelList")); }