@ -4,6 +4,7 @@ import cn.zgfxrc.boot.common.core.entity.interfaces.AddGroup;
import cn.zgfxrc.boot.common.core.entity.interfaces.DelGroup ;
import cn.zgfxrc.boot.common.core.entity.interfaces.EditGroup ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page ;
@ -16,14 +17,14 @@ import com.seepine.wrap.WrapException;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
import io.swagger.annotations.ApiParam ;
import java.sql.Timestamp ;
import java.time.LocalDateTime ;
import java.util.List ;
import javax.validation.Valid ;
import lombok.AllArgsConstructor ;
import org.springframework.lang.Nullable ;
import org.springframework.validation.annotation.Validated ;
import org.springframework.web.bind.annotation.PostMapping ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.RestController ;
import org.springframework.web.bind.annotation.* ;
/ * *
* @author huanghs @zgfxrc.cn
@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor
public class RecruitResumeController {
RecruitResumeService service ;
/ * *
* 分页查询
*
@ -108,4 +110,67 @@ public class RecruitResumeController {
throw new WrapException ( " 删除失败 " ) ;
}
}
/ * *
* 把简历投给职位 , 通过外键去关联表
*
* @param entity 实体类
* @author wangjx
* @data 2025 . 2 . 21
* /
@Log ( " 投递 " )
@ApiOperation ( " 根据外键去关联,将简历投给职位 " )
@PostMapping ( " add_delivery " )
public void addDelivery (
@ApiParam ( " 简历信息,包含关联职位的外键 positionId " ) @RequestBody @Valid RecruitResume entity ) {
/ / 检查职位 ID 是否为空 , 如果为空则抛出异常
if ( entity . getPositionId ( ) = = null ) {
throw new RuntimeException ( " 关联的职位 ID 不能为空 " ) ;
}
/ / 检查简历 id 是否为空 , 如果为空则抛出异常
if ( entity . getId ( ) = = null ) {
throw new RuntimeException ( " 关联的简历 ID 不能为空 " ) ;
}
/ / 创建更新条件包装器 , 根据简历 id 进行更新
UpdateWrapper < RecruitResume > updateWrapper = new UpdateWrapper < > ( ) ;
updateWrapper . eq ( " id " , entity . getId ( ) ) ;
/ / 创建要更新的字段
RecruitResume updateEntity = new RecruitResume ( ) ;
updateEntity . setPositionId ( entity . getPositionId ( ) ) ;
/ / 设置更新时间为当前时间
updateEntity . setUpdateTime ( Timestamp . valueOf ( LocalDateTime . now ( ) ) . toLocalDateTime ( ) ) ;
/ / 调用服务层的 update 方法更新简历信息
boolean result = service . update ( updateEntity , updateWrapper ) ;
if ( ! result ) {
throw new RuntimeException ( " 简历投递失败 " ) ;
}
}
/ * *
* 根据传进来的职位id查询目标下面的简历
*
* @param positionId 职位id
* @author wangjx
* @data 2025 . 2 . 22
* /
@Log ( " 查询岗位下的简历 " )
@ApiOperation ( " 根据传进来的职位id查询目标下面的简历 " )
@GetMapping ( " getResumesByPositionId " )
public List < RecruitResume > getResumesByPositionId (
@ApiParam ( " 职位id " ) @RequestParam String positionId ) {
/ / 检查职位 ID 是否为空 , 如果为空则抛出异常
if ( positionId = = null | | positionId . isEmpty ( ) | | positionId . equals ( " null " ) ) {
throw new RuntimeException ( " 职位 ID 不能为空 " ) ;
}
/ / 创建查询条件包装器 , 根据职位id进行查询
LambdaQueryWrapper < RecruitResume > queryWrapper = Wrappers . lambdaQuery ( ) ;
queryWrapper . eq ( RecruitResume : : getPositionId , positionId ) ;
/ / 调用服务层的 list 方法查询简历信息
return service . list ( queryWrapper ) ;
}
}