重构地区相关
This commit is contained in:
+11
-11
@@ -2,7 +2,7 @@ package org.jiayunet.controller;
|
|||||||
|
|
||||||
import org.jiayunet.pojo.vo.RegionTreeVo;
|
import org.jiayunet.pojo.vo.RegionTreeVo;
|
||||||
import org.jiayunet.pojo.vo.RegionVo;
|
import org.jiayunet.pojo.vo.RegionVo;
|
||||||
import org.jiayunet.service.DictService;
|
import org.jiayunet.service.RegionService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -12,39 +12,39 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典接口
|
* 地区接口
|
||||||
*
|
*
|
||||||
* @author zk
|
* @author zk
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dict")
|
@RequestMapping("/regions")
|
||||||
public class DictController {
|
public class RegionController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictService dictService;
|
private RegionService regionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部地区树(省-市-区三层嵌套)
|
* 获取全部地区树(省-市-区三层嵌套)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/regions/tree")
|
@GetMapping("/tree")
|
||||||
public List<RegionTreeVo> getRegionTree() {
|
public List<RegionTreeVo> getRegionTree() {
|
||||||
return dictService.getRegionTree();
|
return regionService.getRegionTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按父级查询地区列表
|
* 按父级查询地区列表
|
||||||
* @param parentCode 父级编码,不传=查省级
|
* @param parentCode 父级编码,不传=查省级
|
||||||
*/
|
*/
|
||||||
@GetMapping("/regions")
|
@GetMapping
|
||||||
public List<RegionVo> getRegionsByParent(@RequestParam(required = false) String parentCode) {
|
public List<RegionVo> getRegionsByParent(@RequestParam(required = false) String parentCode) {
|
||||||
return dictService.getRegionsByParent(parentCode);
|
return regionService.getRegionsByParent(parentCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊搜索地区
|
* 模糊搜索地区
|
||||||
* @param keyword 地区名关键字
|
* @param keyword 地区名关键字
|
||||||
*/
|
*/
|
||||||
@GetMapping("/regions/search")
|
@GetMapping("/search")
|
||||||
public List<RegionVo> searchRegions(@RequestParam String keyword) {
|
public List<RegionVo> searchRegions(@RequestParam String keyword) {
|
||||||
return dictService.searchRegions(keyword);
|
return regionService.searchRegions(keyword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -15,16 +15,16 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典服务
|
* 地区服务
|
||||||
* <p>主要功能:地区、岗位分类、行业等字典数据查询</p>
|
* <p>主要功能:地区数据查询(树形、层级、搜索)</p>
|
||||||
* <p>依赖:无</p>
|
* <p>依赖:无</p>
|
||||||
* <p>使用表:bg_china_regions_code、bg_job_category、bg_industry</p>
|
* <p>使用表:bg_china_regions_code</p>
|
||||||
*
|
*
|
||||||
* @author zk
|
* @author zk
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DictService {
|
public class RegionService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ChinaRegionsCodeMapper regionMapper;
|
private ChinaRegionsCodeMapper regionMapper;
|
||||||
|
|
||||||
Reference in New Issue
Block a user