添加求职意向管理
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package org.jiayunet.controller;
|
||||
|
||||
import org.jiayunet.pojo.dto.job.JobIntentionDto;
|
||||
import org.jiayunet.pojo.param.job.JobIntentionParam;
|
||||
import org.jiayunet.service.JobIntentionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 求职意向接口
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/job-intention")
|
||||
public class JobIntentionController {
|
||||
@Autowired
|
||||
private JobIntentionService intentionService;
|
||||
|
||||
/**
|
||||
* 查询当前用户的求职意向
|
||||
*/
|
||||
@GetMapping
|
||||
public JobIntentionDto getJobIntention() {
|
||||
return intentionService.getJobIntention();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存/更新求职意向
|
||||
*/
|
||||
@PostMapping
|
||||
public void saveJobIntention(@RequestBody JobIntentionParam param) {
|
||||
intentionService.saveJobIntention(param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.jiayunet.pojo.dto.job;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 求职意向出参
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class JobIntentionDto {
|
||||
/**
|
||||
* 期望岗位分类ID列表
|
||||
*/
|
||||
private List<Long> categoryIds;
|
||||
|
||||
/**
|
||||
* 期望地区编码列表
|
||||
*/
|
||||
private List<String> regionCodes;
|
||||
|
||||
/**
|
||||
* 期望行业ID列表
|
||||
*/
|
||||
private List<Long> industryIds;
|
||||
|
||||
/**
|
||||
* 就业类型:0=全职,1=实习
|
||||
*/
|
||||
private Integer employmentType;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.jiayunet.pojo.param.job;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 求职意向入参
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class JobIntentionParam {
|
||||
/**
|
||||
* 期望岗位分类ID列表(可以是任意层级)
|
||||
*/
|
||||
private List<Long> categoryIds;
|
||||
|
||||
/**
|
||||
* 期望地区编码列表(可以是省/市/区任意层级)
|
||||
*/
|
||||
private List<String> regionCodes;
|
||||
|
||||
/**
|
||||
* 期望行业ID列表(可以是一级/二级任意层级)
|
||||
*/
|
||||
private List<Long> industryIds;
|
||||
|
||||
/**
|
||||
* 就业类型:0=全职,1=实习
|
||||
*/
|
||||
private Integer employmentType;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.jiayunet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jiayunet.mapper.UserJobIntentionMapper;
|
||||
import org.jiayunet.pojo.dto.job.JobIntentionDto;
|
||||
import org.jiayunet.pojo.param.job.JobIntentionParam;
|
||||
import org.jiayunet.pojo.po.UserJobIntention;
|
||||
import org.jiayunet.tool.UserSecurityTool;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 求职意向服务
|
||||
* 主要功能:用户求职意向的查询和保存
|
||||
* 依赖服务:无
|
||||
* 使用的表:bg_user_job_intention
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Service
|
||||
public class JobIntentionService {
|
||||
@Autowired
|
||||
private UserJobIntentionMapper intentionMapper;
|
||||
|
||||
/**
|
||||
* 查询当前用户的求职意向
|
||||
* 逻辑:根据userId查询,不存在返回null
|
||||
*/
|
||||
public JobIntentionDto getJobIntention() {
|
||||
Long userId = UserSecurityTool.getUserId();
|
||||
UserJobIntention po = intentionMapper.selectOne(new LambdaQueryWrapper<UserJobIntention>().eq(UserJobIntention::getUserId, userId));
|
||||
if (po == null) {
|
||||
return null;
|
||||
}
|
||||
JobIntentionDto dto = new JobIntentionDto();
|
||||
BeanUtils.copyProperties(po, dto);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存/更新求职意向
|
||||
* 逻辑:先查询是否存在,存在则更新,不存在则新增
|
||||
*/
|
||||
public void saveJobIntention(JobIntentionParam param) {
|
||||
Long userId = UserSecurityTool.getUserId();
|
||||
UserJobIntention po = intentionMapper.selectOne(new LambdaQueryWrapper<UserJobIntention>().eq(UserJobIntention::getUserId, userId));
|
||||
if (po == null) {
|
||||
po = new UserJobIntention();
|
||||
po.setUserId(userId);
|
||||
BeanUtils.copyProperties(param, po);
|
||||
intentionMapper.insert(po);
|
||||
} else {
|
||||
BeanUtils.copyProperties(param, po);
|
||||
intentionMapper.updateById(po);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user