重构地区相关
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.RegionVo;
|
||||
import org.jiayunet.service.DictService;
|
||||
import org.jiayunet.service.RegionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -12,39 +12,39 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典接口
|
||||
* 地区接口
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dict")
|
||||
public class DictController {
|
||||
@RequestMapping("/regions")
|
||||
public class RegionController {
|
||||
@Autowired
|
||||
private DictService dictService;
|
||||
private RegionService regionService;
|
||||
|
||||
/**
|
||||
* 获取全部地区树(省-市-区三层嵌套)
|
||||
*/
|
||||
@GetMapping("/regions/tree")
|
||||
@GetMapping("/tree")
|
||||
public List<RegionTreeVo> getRegionTree() {
|
||||
return dictService.getRegionTree();
|
||||
return regionService.getRegionTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按父级查询地区列表
|
||||
* @param parentCode 父级编码,不传=查省级
|
||||
*/
|
||||
@GetMapping("/regions")
|
||||
@GetMapping
|
||||
public List<RegionVo> getRegionsByParent(@RequestParam(required = false) String parentCode) {
|
||||
return dictService.getRegionsByParent(parentCode);
|
||||
return regionService.getRegionsByParent(parentCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊搜索地区
|
||||
* @param keyword 地区名关键字
|
||||
*/
|
||||
@GetMapping("/regions/search")
|
||||
@GetMapping("/search")
|
||||
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;
|
||||
|
||||
/**
|
||||
* 字典服务
|
||||
* <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
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DictService {
|
||||
public class RegionService {
|
||||
@Autowired
|
||||
private ChinaRegionsCodeMapper regionMapper;
|
||||
|
||||
Reference in New Issue
Block a user