添加详情接口
This commit is contained in:
@@ -2,6 +2,7 @@ package org.jiayunet.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.jiayunet.pojo.PageResult;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementDetailDto;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementDto;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementStatisticsDto;
|
||||
import org.jiayunet.pojo.param.recruitAnnouncement.RecruitAnnouncementQueryParam;
|
||||
@@ -49,6 +50,12 @@ public class RecruitAnnouncementController {
|
||||
return recruitAnnouncementService.pageAnnouncement(param);
|
||||
}
|
||||
|
||||
/** 查询公告详情 */
|
||||
@GetMapping("/detail")
|
||||
public RecruitAnnouncementDetailDto getDetail(@RequestParam Long id) {
|
||||
return recruitAnnouncementService.getDetail(id);
|
||||
}
|
||||
|
||||
/** 根据公告id查询公告地址 */
|
||||
@GetMapping("/announcementUrl")
|
||||
public String getAnnouncementUrl(@RequestParam Long id) {
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package org.jiayunet.pojo.dto.recruitAnnouncement;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招聘公告详情返回
|
||||
* <p>公告主表字段(不含公告地址/投递地址/投递邮箱)+ 公司logo与类型 + 全部多值维度</p>
|
||||
*
|
||||
* @author zk
|
||||
*/
|
||||
@Data
|
||||
public class RecruitAnnouncementDetailDto {
|
||||
|
||||
/** 公告ID */
|
||||
private Long id;
|
||||
|
||||
/** 公司ID */
|
||||
private Long companyId;
|
||||
|
||||
/** 公司名称 */
|
||||
private String companyName;
|
||||
|
||||
/** 公司logo */
|
||||
private String logoUrl;
|
||||
|
||||
/** 公司类型 */
|
||||
private String companyType;
|
||||
|
||||
/** 公告标题 */
|
||||
private String title;
|
||||
|
||||
/** 公司简介 */
|
||||
private String companyIntro;
|
||||
|
||||
/** 面向对象,如2027届本硕博 */
|
||||
private String targetAudience;
|
||||
|
||||
/** 专业要求 */
|
||||
private String majorRequire;
|
||||
|
||||
/** 招聘岗位 */
|
||||
private String recruitPosition;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否笔试:有 / 无 / 未明确 */
|
||||
private String writtenExam;
|
||||
|
||||
/** 投递开始时间 */
|
||||
private Instant applyStartTime;
|
||||
|
||||
/** 投递结束时间 */
|
||||
private Instant applyEndTime;
|
||||
|
||||
/** 投递截止描述 */
|
||||
private String applyEndDesc;
|
||||
|
||||
/** 专属内推码 */
|
||||
private String inviteCode;
|
||||
|
||||
/** 信息来源说明 */
|
||||
private String source;
|
||||
|
||||
/** 公告发布/更新时间 */
|
||||
private Instant publishTime;
|
||||
|
||||
/** 清洗状态:0-清洗中 1-清洗完成 */
|
||||
private Integer cleanStatus;
|
||||
|
||||
/** 状态:0-失效 1-有效 */
|
||||
private Integer status;
|
||||
|
||||
/** 创建时间 */
|
||||
private Instant createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
private Instant updateTime;
|
||||
|
||||
/** 行业列表 */
|
||||
private List<String> industryNames;
|
||||
|
||||
/** 岗位大类列表 */
|
||||
private List<String> categoryNames;
|
||||
|
||||
/** 热招城市列表 */
|
||||
private List<String> cityNames;
|
||||
|
||||
/** 学历要求列表 */
|
||||
private List<String> educationNames;
|
||||
|
||||
/** 招聘届数列表 */
|
||||
private List<Integer> recruitYears;
|
||||
|
||||
/** 批次列表 */
|
||||
private List<String> batchNames;
|
||||
|
||||
/** 标签列表 */
|
||||
private List<String> tagNames;
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package org.jiayunet.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jiayunet.exception.BusinessException;
|
||||
import org.jiayunet.exception.BusinessExpCodeEnum;
|
||||
import org.jiayunet.mapper.CompanyMapper;
|
||||
import org.jiayunet.mapper.RecruitAnnouncementBatchMapper;
|
||||
import org.jiayunet.mapper.RecruitAnnouncementMapper;
|
||||
import org.jiayunet.mapper.RecruitAnnouncementCategoryMapper;
|
||||
@@ -12,15 +15,18 @@ import org.jiayunet.mapper.RecruitAnnouncementIndustryMapper;
|
||||
import org.jiayunet.mapper.RecruitAnnouncementTagMapper;
|
||||
import org.jiayunet.mapper.RecruitAnnouncementYearMapper;
|
||||
import org.jiayunet.pojo.PageResult;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementDetailDto;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementDto;
|
||||
import org.jiayunet.pojo.dto.recruitAnnouncement.RecruitAnnouncementStatisticsDto;
|
||||
import org.jiayunet.pojo.param.recruitAnnouncement.RecruitAnnouncementQueryParam;
|
||||
import org.jiayunet.pojo.po.Company;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncement;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementBatch;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementCategory;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementCity;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementEducation;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementIndustry;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementTag;
|
||||
import org.jiayunet.pojo.po.RecruitAnnouncementYear;
|
||||
import org.jiayunet.pojo.vo.RecruitAnnouncementListItemVo;
|
||||
import org.jiayunet.pojo.vo.RecruitAnnouncementStatisticsVo;
|
||||
@@ -55,6 +61,9 @@ public class RecruitAnnouncementService {
|
||||
@Autowired
|
||||
private RecruitAnnouncementMapper recruitAnnouncementMapper;
|
||||
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
@Autowired
|
||||
private RecruitAnnouncementBatchMapper batchMapper;
|
||||
|
||||
@@ -124,6 +133,40 @@ public class RecruitAnnouncementService {
|
||||
return new PageResult<>(page.getCurrent(), page.getSize(), page.getTotal(), dtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告详情
|
||||
* <p>1. 查公告主表(不存在或已失效则报错) 2. 补公司logo与类型 3. 按公告id查7张从表组装多值维度</p>
|
||||
*/
|
||||
public RecruitAnnouncementDetailDto getDetail(Long id) {
|
||||
|
||||
// 查询公告
|
||||
RecruitAnnouncement announcement = recruitAnnouncementMapper.selectById(id);
|
||||
if (announcement == null || announcement.getStatus() == 0 || announcement.getCleanStatus() == 0) {
|
||||
throw new BusinessException(BusinessExpCodeEnum.DATA_NOT_EXIST, "公告不存在");
|
||||
}
|
||||
RecruitAnnouncementDetailDto dto = new RecruitAnnouncementDetailDto();
|
||||
BeanUtils.copyProperties(announcement, dto);
|
||||
|
||||
// 补公司logo与类型
|
||||
if (announcement.getCompanyId() != null) {
|
||||
Company company = companyMapper.selectOne(new LambdaQueryWrapper<Company>().select(Company::getLogoUrl, Company::getCompanyType).eq(Company::getId, announcement.getCompanyId()));
|
||||
if (company != null) {
|
||||
dto.setLogoUrl(company.getLogoUrl());
|
||||
dto.setCompanyType(company.getCompanyType());
|
||||
}
|
||||
}
|
||||
|
||||
// 组装多值维度
|
||||
dto.setIndustryNames(industryMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementIndustry>().eq(RecruitAnnouncementIndustry::getAnnouncementId, id)).stream().map(RecruitAnnouncementIndustry::getIndustryName).collect(Collectors.toList()));
|
||||
dto.setCategoryNames(categoryMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementCategory>().eq(RecruitAnnouncementCategory::getAnnouncementId, id)).stream().map(RecruitAnnouncementCategory::getCategoryName).collect(Collectors.toList()));
|
||||
dto.setCityNames(cityMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementCity>().eq(RecruitAnnouncementCity::getAnnouncementId, id)).stream().map(RecruitAnnouncementCity::getCityName).collect(Collectors.toList()));
|
||||
dto.setEducationNames(educationMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementEducation>().eq(RecruitAnnouncementEducation::getAnnouncementId, id)).stream().map(RecruitAnnouncementEducation::getEducationName).collect(Collectors.toList()));
|
||||
dto.setRecruitYears(yearMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementYear>().eq(RecruitAnnouncementYear::getAnnouncementId, id)).stream().map(RecruitAnnouncementYear::getRecruitYear).collect(Collectors.toList()));
|
||||
dto.setBatchNames(batchMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementBatch>().eq(RecruitAnnouncementBatch::getAnnouncementId, id)).stream().map(RecruitAnnouncementBatch::getBatchName).collect(Collectors.toList()));
|
||||
dto.setTagNames(tagMapper.selectList(new LambdaQueryWrapper<RecruitAnnouncementTag>().eq(RecruitAnnouncementTag::getAnnouncementId, id)).stream().map(RecruitAnnouncementTag::getTagName).collect(Collectors.toList()));
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公告id查询公告地址
|
||||
* <p>只查单列,公告不存在时返回null</p>
|
||||
|
||||
Reference in New Issue
Block a user