添加简历列表接口

This commit is contained in:
zk
2026-04-01 16:17:02 +08:00
parent 93f19e5f80
commit d9a854fbf2
4 changed files with 110 additions and 1 deletions
@@ -0,0 +1,38 @@
package org.jiayunet.controller;
import lombok.AllArgsConstructor;
import org.jiayunet.pojo.dto.resume.ResumeListItemDto;
import org.jiayunet.service.UserResumeService;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户简历接口
* 提供简历列表查询等功能
*
* @author zk
*/
@RestController
@RequestMapping("/resume")
@AllArgsConstructor
@Validated
public class UserResumeController {
private UserResumeService userResumeService;
/**
* 查询当前用户的简历列表
*/
@GetMapping("/list")
public List<ResumeListItemDto> listResume() {
return userResumeService.listResume().stream().map(po -> {
ResumeListItemDto dto = new ResumeListItemDto();
BeanUtils.copyProperties(po, dto);
return dto;
}).collect(Collectors.toList());
}
}
@@ -0,0 +1,31 @@
package org.jiayunet.pojo.dto.resume;
import lombok.Data;
import java.time.Instant;
/**
* 简历列表项返回
*
* @author zk
*/
@Data
public class ResumeListItemDto {
private Long id;
/** 简历名称 */
private String resumeName;
/** 目标岗位 */
private String targetPosition;
/** 是否默认简历 0=否 1=是 */
private Integer isDefault;
/** 简历整体修改时间 */
private Instant updateTime;
/** 简历创建时间 */
private Instant createTime;
}
@@ -0,0 +1,38 @@
package org.jiayunet.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.jiayunet.mapper.*;
import org.jiayunet.pojo.po.*;
import org.jiayunet.tool.UserSecurityTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户简历服务
* <p>依赖:无</p>
* <p>使用表:bg_user_resume(简历主表查询)</p>
*
* @author zk
*/
@Service
@Slf4j
public class UserResumeService {
@Autowired
private UserResumeMapper userResumeMapper;
/**
* 查询当前用户的简历列表
* <p>按sort_order升序、create_time降序排列</p>
*/
public List<UserResume> listResume() {
Long userId = UserSecurityTool.getUserId();
return userResumeMapper.selectList(new LambdaQueryWrapper<UserResume>()
.eq(UserResume::getUserId, userId)
.orderByAsc(UserResume::getSortOrder)
.orderByDesc(UserResume::getCreateTime));
}
}