| | |
| | | } |
| | | |
| | | @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")); |
| | | } |