添加批量查询 行业 岗位 地区 接口

This commit is contained in:
zk
2026-03-20 14:59:47 +08:00
parent f533d7a9fb
commit 5417aa6105
6 changed files with 85 additions and 12 deletions
@@ -4,10 +4,7 @@ import org.jiayunet.pojo.vo.IndustryTreeVo;
import org.jiayunet.pojo.vo.IndustryVo;
import org.jiayunet.service.IndustryService;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -47,4 +44,13 @@ public class IndustryController {
public List<IndustryVo> searchIndustries(@RequestParam String keyword) {
return industryService.searchIndustries(keyword);
}
/**
* 批量查询行业
* @param ids 行业ID列表
*/
@PostMapping("/batch")
public List<IndustryVo> getIndustriesByIds(@RequestBody List<Long> ids) {
return industryService.getIndustriesByIds(ids);
}
}
@@ -4,10 +4,7 @@ import org.jiayunet.pojo.vo.JobCategoryTreeVo;
import org.jiayunet.pojo.vo.JobCategoryVo;
import org.jiayunet.service.JobCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -47,4 +44,13 @@ public class JobCategoryController {
public List<JobCategoryVo> searchCategories(@RequestParam String keyword) {
return categoryService.searchCategories(keyword);
}
/**
* 批量查询岗位分类
* @param ids 分类ID列表
*/
@PostMapping("/batch")
public List<JobCategoryVo> getCategoriesByIds(@RequestBody List<Long> ids) {
return categoryService.getCategoriesByIds(ids);
}
}
@@ -4,10 +4,7 @@ import org.jiayunet.pojo.vo.RegionTreeVo;
import org.jiayunet.pojo.vo.RegionVo;
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;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -47,4 +44,13 @@ public class RegionController {
public List<RegionVo> searchRegions(@RequestParam String keyword) {
return regionService.searchRegions(keyword);
}
/**
* 批量查询地区
* @param codes 地区编码列表
*/
@PostMapping("/batch")
public List<RegionVo> getRegionsByCodes(@RequestBody List<String> codes) {
return regionService.getRegionsByCodes(codes);
}
}
@@ -90,4 +90,23 @@ public class IndustryService {
return vo;
}).collect(Collectors.toList());
}
/**
* 批量查询行业
* <p>根据ID列表批量查询行业详情</p>
*/
public List<IndustryVo> getIndustriesByIds(List<Long> ids) {
if (ids == null || ids.isEmpty()) {
return new ArrayList<>();
}
List<Industry> industries = industryMapper.selectList(new LambdaQueryWrapper<Industry>().in(Industry::getId, ids));
return industries.stream().map(i -> {
IndustryVo vo = new IndustryVo();
vo.setId(i.getId());
vo.setName(i.getName());
vo.setLevel(i.getLevel());
vo.setParentId(i.getParentId());
return vo;
}).collect(Collectors.toList());
}
}
@@ -99,4 +99,23 @@ public class JobCategoryService {
return vo;
}).collect(Collectors.toList());
}
/**
* 批量查询岗位分类
* <p>根据ID列表批量查询分类详情</p>
*/
public List<JobCategoryVo> getCategoriesByIds(List<Long> ids) {
if (ids == null || ids.isEmpty()) {
return new ArrayList<>();
}
List<JobCategory> categories = categoryMapper.selectList(new LambdaQueryWrapper<JobCategory>().in(JobCategory::getId, ids));
return categories.stream().map(c -> {
JobCategoryVo vo = new JobCategoryVo();
vo.setId(c.getId());
vo.setName(c.getName());
vo.setLevel(c.getLevel());
vo.setParentId(c.getParentId());
return vo;
}).collect(Collectors.toList());
}
}
@@ -95,4 +95,21 @@ public class RegionService {
return vo;
}).collect(Collectors.toList());
}
/**
* 批量查询地区
* <p>根据code列表批量查询地区详情</p>
*/
public List<RegionVo> getRegionsByCodes(List<String> codes) {
if (codes == null || codes.isEmpty()) {
return new ArrayList<>();
}
List<ChinaRegionsCode> regions = regionMapper.selectList(new LambdaQueryWrapper<ChinaRegionsCode>().in(ChinaRegionsCode::getCode, codes));
return regions.stream().map(r -> {
RegionVo vo = new RegionVo();
vo.setCode(r.getCode());
vo.setName(r.getName());
return vo;
}).collect(Collectors.toList());
}
}