| | |
| | | */ |
| | | package org.springblade.modules.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 树列表(包含省市县三级) |
| | | * @return |
| | | */ |
| | | @GetMapping("/getBaseTree") |
| | | public R getBaseTree() { |
| | | return R.data(regionService.getBaseTree()); |
| | | } |
| | | |
| | | /** |
| | | * 树列表 |
| | | * @param parentCode |
| | | * @param region |
| | | * @return |
| | | */ |
| | | @GetMapping("/tree") |
| | | @ApiOperation(value = "树列表", notes = "传入menu") |
| | | public R getTree(String parentCode) { |
| | | return R.data(regionService.getTree(parentCode)); |
| | | public R getTree(RegionVO region) { |
| | | return R.data(regionService.getTree(region)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 树列表(获取当前树) |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @GetMapping("/getTownTree") |
| | | @ApiOperation(value = "树列表", notes = "传入menu") |
| | | public R getTownTree(String code) { |
| | | return R.data(regionService.getTownTree(code)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/select") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "下拉数据源", notes = "传入tenant") |
| | | public R<List<Region>> select(@RequestParam(required = false, defaultValue = "00") String code) { |
| | | List<Region> list = regionService.list(Wrappers.<Region>query().lambda().eq(Region::getParentCode, code)); |
| | | public R<List<Region>> select(@RequestParam(required = false, defaultValue = "00") String code,Integer level) { |
| | | LambdaQueryWrapper<Region> wrapper = Wrappers.<Region>query().lambda().eq(Region::getParentCode, code); |
| | | if (null!=level){ |
| | | wrapper.eq(Region::getRegionLevel,level); |
| | | } |
| | | List<Region> list = regionService.list(wrapper); |
| | | return R.data(list); |
| | | } |
| | | |