3.1.2 新增人才类型
对于新增人才类型的业务,前端传来父节点 id
、类型名称和排序值,即可完成新增操作,代码如下。
@RequestMapping(value = "/insertType", method = RequestMethod.POST) @ApiOperation(value = "新增类型") public Result<TalentPoolType> insert(@RequestParam String id,@RequestParam String title,@RequestParam(required = false,defaultValue = "10") float sortOrder){ if(!Objects.equals("0",id)) { TalentPoolType type = iTalentPoolTypeService.getById(id); if(type == null) { return ResultUtil.error("上级类型已被删除"); } } TalentPoolType talentPoolType = new TalentPoolType(); talentPoolType.setTitle(title); talentPoolType.setParentId(id); talentPoolType.setSortOrder(BigDecimal.valueOf(sortOrder)); iTalentPoolTypeService.saveOrUpdate(talentPoolType); return ResultUtil.success(); }
3.1.3 编辑人才类型
对于编辑人才类型的业务,前端传来类型 id
、父节点 id
、类型名称和排序值,即可完成编辑操作,代码如下。
@RequestMapping(value = "/editType", method = RequestMethod.POST) @ApiOperation(value = "编辑类型") public Result<TalentPoolType> editType(@RequestParam String id,@RequestParam String title,@RequestParam String parentId,@RequestParam float sortOrder){ if(!Objects.equals("0",id)) { TalentPoolType type = iTalentPoolTypeService.getById(parentId); if(type == null) { return ResultUtil.error("上级类型已被删除"); } } if(Objects.equals(id,parentId)) { return ResultUtil.error("自己不能是自己的父节点"); } TalentPoolType talentPoolType = iTalentPoolTypeService.getById(id); if(talentPoolType == null) { return ResultUtil.error("类型已被删除"); } talentPoolType.setTitle(title); talentPoolType.setParentId(parentId); talentPoolType.setSortOrder(BigDecimal.valueOf(sortOrder)); iTalentPoolTypeService.saveOrUpdate(talentPoolType); return ResultUtil.success(); }
3.1.4 删除人才类型
对于删除人才类型的业务,前端传来类型 id
,即可调用 removeById
方法完成删除操作,代码如下。
@RequestMapping(value = "/deleteType", method = RequestMethod.POST) @ApiOperation(value = "删除类型") public Result<Object> deleteType(@RequestParam String id){ iTalentPoolTypeService.removeById(id); return ResultUtil.success(); }
3.2 人才库标签接口
人才库标签是用于对个人简历或职位信息进行分类和标记的关键词或短语。通过给人才库中的信息打上标签,可以方便地进行分类、筛选和搜索,提高招聘效率和准确性。
人才类型控制器用于提供人才类型的一级新增、子节点新增、编辑、删除接口。
首先创建 TalentPoolLabelController
类,注入 ITalentPoolLabelService
服务,代码如下。
@RestController @Api(tags = "人才库标签接口") @RequestMapping("/zwz/talentPoolLabel") @Transactional public class TalentPoolLabelController { @Autowired private ITalentPoolLabelService iTalentPoolLabelService; }
3.2.1 查询人才库标签
查询人才库标签的核心代码如下。
@RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "查询人才库标签") public Result<IPage<TalentPoolLabel>> getByPage(@ModelAttribute TalentPoolLabel label,@ModelAttribute PageVo page) { QueryWrapper<TalentPoolLabel> qw = new QueryWrapper<>(); if(!ZwzNullUtils.isNull(label.getTitle())) { qw.like("title",label.getTitle()); } if(!ZwzNullUtils.isNull(label.getType())) { qw.eq("type",label.getType()); } IPage<TalentPoolLabel> data = iTalentPoolLabelService.page(PageUtil.initMpPage(page),qw); return new ResultUtil<IPage<TalentPoolLabel>>().setData(data); }
3.2.2 新增人才库标签
新增人才库标签的核心代码如下。
@RequestMapping(value = "/insert", method = RequestMethod.POST) @ApiOperation(value = "新增人才库标签") public Result<TalentPoolLabel> insert(TalentPoolLabel talentPoolLabel){ iTalentPoolLabelService.saveOrUpdate(talentPoolLabel); return ResultUtil.success(); }
3.2.3 编辑人才库标签
编辑人才库标签的核心代码如下。
@RequestMapping(value = "/update", method = RequestMethod.POST) @ApiOperation(value = "编辑人才库标签") public Result<TalentPoolLabel> update(TalentPoolLabel talentPoolLabel){ if(iTalentPoolLabelService.saveOrUpdate(talentPoolLabel)){ return ResultUtil.success(); } return ResultUtil.error(); }
3.2.4 删除人才库标签
删除人才库标签的核心代码如下。
@RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation(value = "删除人才库标签") public Result<Object> delByIds(@RequestParam String[] ids){ for(String id : ids){ iTalentPoolLabelService.removeById(id); } return ResultUtil.success(); }
3.3 人才库档案接口
人才库是企业用于储存和管理潜在候选人信息的数据库,也称为人才储备库或简历库。通常情况下,这些候选人可能已经应聘过公司的职位。
首先创建 TalentPoolController
类,注入相关服务,代码如下。
@Slf4j @RestController @Api(tags = "人才库档案管理接口") @RequestMapping("/zwz/talentPool") @Transactional public class TalentPoolController { @Autowired private ITalentPoolService iTalentPoolService; @Autowired private ITalentPoolAndLabelService iTalentPoolAndLabelService; @Autowired private ITalentPoolInterviewRecordService iTalentPoolInterviewRecordService; @Autowired private ITalentPoolLabelService iTalentPoolLabelService; @Autowired private ITalentPoolResumeService iTalentPoolResumeService; @Autowired private ITalentPoolSayRecordService iTalentPoolSayRecordService; @Autowired private IZwzRosterUserService iZwzRosterUserService; @Autowired private ITalentPoolAndTypeService iTalentPoolAndTypeService; @Autowired private ITalentPoolTypeService iTalentPoolTypeService; }
3.3.1 查询人才
查询人才库的代码如下,需要在查询时带出岗位、面试记录、沟通记录、简历档案和标签信息。
@RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "查询人才库") public Result<IPage<TalentPool>> getByPage(@ModelAttribute TalentPool talentPool,@ModelAttribute PageVo page) { QueryWrapper<TalentPool> qw = new QueryWrapper<>(); if(!ZwzNullUtils.isNull(talentPool.getUserName())) { qw.like("user_name",talentPool.getUserName()); } if(!ZwzNullUtils.isNull(talentPool.getUserMean())) { qw.eq("user_mean",talentPool.getUserMean()); } if(!ZwzNullUtils.isNull(talentPool.getStatus())) { qw.eq("status",talentPool.getStatus()); } if(!ZwzNullUtils.isNull(talentPool.getUserSex())) { qw.eq("user_sex",talentPool.getUserSex()); } if(!ZwzNullUtils.isNull(talentPool.getPostOffer())) { qw.inSql("id","SELECT id FROM t_talent_pool WHERE id IN(SELECT DISTINCT talent_id FROM t_talent_pool_and_type WHERE type_id IN (" + changePostOfferSplitToStr(talentPool.getPostOffer()) + "))"); } IPage<TalentPool> data = iTalentPoolService.page(PageUtil.initMpPage(page),qw); List<TalentPoolLabel> labelList = iTalentPoolLabelService.list(); for (TalentPool tp : data.getRecords()) { /** * 查询岗位 */ ZwzPair zwzPair = getTypeTitleByTalentId(tp.getId()); tp.setPostOffer(zwzPair.getTitle()); tp.setPostTitle(zwzPair.getValue()); /** * 面试记录 */ QueryWrapper<TalentPoolInterviewRecord> intQw = new QueryWrapper<>(); intQw.eq("talent_id",tp.getId()); tp.setInterviewList(iTalentPoolInterviewRecordService.list(intQw)); /** * 沟通记录 */ QueryWrapper<TalentPoolSayRecord> sayQw = new QueryWrapper<>(); sayQw.eq("talent_id",tp.getId()); tp.setSayList(iTalentPoolSayRecordService.list(sayQw)); /** * 简历档案 */ QueryWrapper<TalentPoolResume> resQw = new QueryWrapper<>(); resQw.eq("talent_id",tp.getId()); tp.setResumeList(iTalentPoolResumeService.list(resQw)); /** * 标签 */ QueryWrapper<TalentPoolAndLabel> labelQw = new QueryWrapper<>(); labelQw.eq("talent_id",tp.getId()); tp.setLabelList(getTalentInLabelList(labelList,iTalentPoolAndLabelService.list(labelQw))); } return new ResultUtil<IPage<TalentPool>>().setData(data); }
3.3.2 新增人才
新增人才的核心代码如下。
@RequestMapping(value = "/insert", method = RequestMethod.POST) @ApiOperation(value = "新增人才") public Result<TalentPool> insert(TalentPool talentPool) { String postOffer = talentPool.getPostOffer(); if(postOffer == null) { return ResultUtil.error("应聘岗位不能为空"); } iTalentPoolService.saveOrUpdate(talentPool); /** * 新增现有岗位 */ String[] offerList = postOffer.split(","); for (String offer : offerList) { TalentPoolType type = iTalentPoolTypeService.getById(offer); if(type != null) { TalentPoolAndType tpat = new TalentPoolAndType(); tpat.setTalentId(talentPool.getId()); tpat.setTypeId(type.getId()); iTalentPoolAndTypeService.saveOrUpdate(tpat); } } return ResultUtil.success(); }
3.3.3 编辑人才
编辑人才的核心代码如下。
@RequestMapping(value = "/update", method = RequestMethod.POST) @ApiOperation(value = "编辑人才") public Result<TalentPool> update(TalentPool talentPool) { String postOffer = talentPool.getPostOffer(); if(postOffer == null) { return ResultUtil.error("应聘岗位不能为空"); } iTalentPoolService.saveOrUpdate(talentPool); /** * 删除原有岗位 */ QueryWrapper<TalentPoolAndType> qw = new QueryWrapper<>(); qw.eq("talent_id",talentPool.getId()); iTalentPoolAndTypeService.remove(qw); /** * 新增现有岗位 */ String[] offerList = postOffer.split(","); for (String offer : offerList) { TalentPoolType type = iTalentPoolTypeService.getById(offer); if(type != null) { TalentPoolAndType tpat = new TalentPoolAndType(); tpat.setTalentId(talentPool.getId()); tpat.setTypeId(type.getId()); iTalentPoolAndTypeService.saveOrUpdate(tpat); } } return ResultUtil.success(); }
3.3.4 删除人才
删除人才的核心代码如下。
@RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation(value = "删除人才") public Result<Object> delByIds(@RequestParam String[] ids){ for(String id : ids){ iTalentPoolService.removeById(id); } return ResultUtil.success(); }
3.4 面试记录接口
人才库是企业用于储存和管理潜在候选人信息的数据库,也称为人才储备库或简历库。通常情况下,这些候选人可能已经应聘过公司的职位。
面试记录相关接口也在 TalentPoolController
类中编写。
3.4.1 新增面试记录
新增面试记录的核心代码如下。
@RequestMapping(value = "/addInterview", method = RequestMethod.POST) @ApiOperation(value = "新增面试记录") public Result<Object> addInterview(@RequestParam String id,@RequestParam String interviewDate,@RequestParam String inMean,@RequestParam String interviewAns,@RequestParam String remark) { TalentPoolInterviewRecord record = new TalentPoolInterviewRecord(); record.setTalentId(id); record.setInterviewDate(interviewDate); record.setInMean(inMean); record.setInterviewAns(interviewAns); record.setRemark(remark); iTalentPoolInterviewRecordService.saveOrUpdate(record); return ResultUtil.success(); }
3.4.2 编辑面试记录
编辑面试记录的核心代码如下。
@RequestMapping(value = "/editInterview", method = RequestMethod.POST) @ApiOperation(value = "编辑面试记录") public Result<Object> editInterview(@RequestParam String id,@RequestParam String interviewDate,@RequestParam String inMean,@RequestParam String interviewAns,@RequestParam String remark) { TalentPoolInterviewRecord record = iTalentPoolInterviewRecordService.getById(id); if(record == null) { return ResultUtil.error("面试记录已被删除"); } record.setInterviewDate(interviewDate); record.setInMean(inMean); record.setInterviewAns(interviewAns); record.setRemark(remark); iTalentPoolInterviewRecordService.saveOrUpdate(record); return ResultUtil.success(); }
3.4.3 删除面试记录
@RequestMapping(value = "/deleteInterview", method = RequestMethod.POST) @ApiOperation(value = "删除面试记录") public Result<Object> deleteInterview(@RequestParam String id) { iTalentPoolInterviewRecordService.removeById(id); return ResultUtil.success(); }
3.5 沟通记录接口
3.5.1 新增沟通记录
新增沟通记录的核心代码如下。
@RequestMapping(value = "/addSay", method = RequestMethod.POST) @ApiOperation(value = "新增沟通记录") public Result<Object> addSay(@RequestParam String id,@RequestParam String sayDate,@RequestParam String sayContent,@RequestParam String sayAns,@RequestParam String remark) { TalentPoolSayRecord record = new TalentPoolSayRecord(); record.setTalentId(id); record.setSayDate(sayDate); record.setSayContent(sayContent); record.setSayAns(sayAns); record.setRemark(remark); iTalentPoolSayRecordService.saveOrUpdate(record); return ResultUtil.success(); }
3.5.2 编辑沟通记录
编辑沟通记录的核心代码如下。
@RequestMapping(value = "/editSay", method = RequestMethod.POST) @ApiOperation(value = "编辑沟通记录") public Result<Object> editSay(@RequestParam String id,@RequestParam String sayDate,@RequestParam String sayContent,@RequestParam String sayAns,@RequestParam String remark) { TalentPoolSayRecord record = iTalentPoolSayRecordService.getById(id); if(record == null) { return ResultUtil.error("面试记录已被删除"); } record.setSayDate(sayDate); record.setSayContent(sayContent); record.setSayAns(sayAns); record.setRemark(remark); iTalentPoolSayRecordService.saveOrUpdate(record); return ResultUtil.success(); }
3.5.3 删除沟通记录
删除沟通记录的核心代码如下。
@RequestMapping(value = "/deleteSay", method = RequestMethod.POST) @ApiOperation(value = "删除沟通记录") public Result<Object> deleteSay(@RequestParam String id) { iTalentPoolSayRecordService.removeById(id); return ResultUtil.success(); }
3.6 简历接口
3.6.1 新增简历
新增简历的核心代码如下,传入 id
、日期、简历文件、备注数据,即可实现新增操作。
@RequestMapping(value = "/addResume", method = RequestMethod.POST) @ApiOperation(value = "新增简历") public Result<Object> addResume(@RequestParam String id,@RequestParam String date,@RequestParam String url,@RequestParam String remark) { TalentPoolResume record = new TalentPoolResume(); record.setTalentId(id); record.setDate(date); record.setUrl(url); record.setRemark(remark); iTalentPoolResumeService.saveOrUpdate(record); return ResultUtil.success(); }
3.6.2 编辑简历
编辑简历的核心代码如下。
@RequestMapping(value = "/editResume", method = RequestMethod.POST) @ApiOperation(value = "编辑简历") public Result<Object> editResume(@RequestParam String id,@RequestParam String date,@RequestParam String url,@RequestParam String remark) { TalentPoolResume record = new TalentPoolResume(); if(record == null) { return ResultUtil.error("简历已被删除"); } record.setDate(date); record.setUrl(url); record.setRemark(remark); iTalentPoolResumeService.saveOrUpdate(record); return ResultUtil.success(); }
3.6.3 删除简历
删除简历的核心代码如下。
@RequestMapping(value = "/deleteResume", method = RequestMethod.POST) @ApiOperation(value = "删除简历记录") public Result<Object> deleteResume(@RequestParam String id) { iTalentPoolResumeService.removeById(id); return ResultUtil.success(); }
四、总结
本文讲解了人才招聘库设计开发的后端部分,完成了八大实体的设计和实现,将在后续更新人才招聘库的前端开发内容。