|
|
@@ -129,4 +129,36 @@ public class MainBackCandidateServiceImpl implements IMainBackCandidateService {
|
|
|
|
|
|
return mainBackCandidateMapper.updateById(update) > 0;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean applyPosition(Long studentId, Long postId) {
|
|
|
+ // 查询岗位信息获取 tenantId
|
|
|
+ MainPosition position = mainPositionMapper.selectById(postId);
|
|
|
+ if (position == null) {
|
|
|
+ throw new ServiceException("岗位不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否已投递过
|
|
|
+ LambdaQueryWrapper<MainBackCandidate> existsWrapper = new LambdaQueryWrapper<>();
|
|
|
+ existsWrapper.eq(MainBackCandidate::getStudentId, studentId)
|
|
|
+ .eq(MainBackCandidate::getPostId, postId)
|
|
|
+ .eq(MainBackCandidate::getDelFlag, "0");
|
|
|
+ Long count = mainBackCandidateMapper.selectCount(existsWrapper);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new ServiceException("您已投递过该岗位");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建候选记录
|
|
|
+ MainBackCandidate candidate = new MainBackCandidate();
|
|
|
+ candidate.setStudentId(studentId);
|
|
|
+ candidate.setPostId(postId);
|
|
|
+ candidate.setTenantId(position.getTenantId());
|
|
|
+ candidate.setSource("student_apply");
|
|
|
+ candidate.setEnterpriseStatus("pending");
|
|
|
+ candidate.setStudentStatus("pending");
|
|
|
+ candidate.setStatus("pending");
|
|
|
+
|
|
|
+ return mainBackCandidateMapper.insert(candidate) > 0;
|
|
|
+ }
|
|
|
}
|