添加企业收藏求职者

This commit is contained in:
chenshaohua
2026-07-12 13:13:07 +08:00
parent 45842d94b7
commit cb38c9abd9
10 changed files with 498 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
package com.ruoyi.cms.service.msg;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollect;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollectDTO;
import java.util.List;
/**
* 企业人才收藏Service接口
*/
public interface IHCompanyTalentCollectService extends IService<HrCompanyTalentCollect>
{
/**
* 查询人才收藏列表(分页)
*/
List<HrCompanyTalentCollectDTO> selectHrCompanyTalentCollectList(HrCompanyTalentCollectDTO hrCompanyTalentCollect);
/**
* 根据ID获取详情
*/
HrCompanyTalentCollectDTO selectHrCompanyTalentCollectById(Long id);
/**
* 新增收藏(收藏求职者进人才库,校验重复)
* @return 0成功 1已收藏
*/
int insertHrCompanyTalentCollect(HrCompanyTalentCollect hrCompanyTalentCollect);
/**
* 修改收藏信息
*/
int updateHrCompanyTalentCollect(HrCompanyTalentCollect hrCompanyTalentCollect);
/**
* 批量移出人才库
*/
int deleteHrCompanyTalentCollectByIds(Long[] ids);
}

View File

@@ -0,0 +1,91 @@
package com.ruoyi.cms.service.msg.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollect;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollectDTO;
import com.ruoyi.cms.mapper.AppSkillMapper;
import com.ruoyi.cms.mapper.AppUserMapper;
import com.ruoyi.cms.mapper.UserWorkExperiencesMapper;
import com.ruoyi.cms.mapper.msg.HrCompanyTalentCollectMapper;
import com.ruoyi.cms.service.msg.IHCompanyTalentCollectService;
import com.ruoyi.common.core.domain.entity.AppSkill;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* 企业人才收藏Service实现
*/
@Service
public class HrCompanyTalentCollectServiceImpl extends ServiceImpl<HrCompanyTalentCollectMapper, HrCompanyTalentCollect> implements IHCompanyTalentCollectService
{
@Autowired
private HrCompanyTalentCollectMapper hrCompanyTalentCollectMapper;
@Autowired
private AppSkillMapper skillMapper;
@Autowired
private UserWorkExperiencesMapper userWorkExperiencesMapper;
@Autowired
private AppUserMapper appUserMapper;
@Override
public List<HrCompanyTalentCollectDTO> selectHrCompanyTalentCollectList(HrCompanyTalentCollectDTO hrCompanyTalentCollect)
{
return hrCompanyTalentCollectMapper.selectHrCompanyTalentCollectList(hrCompanyTalentCollect);
}
@Override
public HrCompanyTalentCollectDTO selectHrCompanyTalentCollectById(Long id)
{
HrCompanyTalentCollect talentCollect=hrCompanyTalentCollectMapper.selectById(id);
if(talentCollect==null){
return null;
}
HrCompanyTalentCollectDTO dto=new HrCompanyTalentCollectDTO();
AppUser appUser=appUserMapper.selectById(talentCollect.getUserId());
BeanUtils.copyProperties(talentCollect, dto);
if(appUser!=null){
BeanUtils.copyProperties(appUser, dto);
}
if(talentCollect.getUserId()!=null){
//获取技能信息
AppSkill appSkill=new AppSkill();
appSkill.setUserId(talentCollect.getUserId());
List<AppSkill> skills=skillMapper.getList(appSkill);
UserWorkExperiences userWorkExperiences=new UserWorkExperiences();
userWorkExperiences.setUserId(talentCollect.getUserId());
List<UserWorkExperiences> userWorkExperiencesList=userWorkExperiencesMapper.getWorkExperiencesList(userWorkExperiences);
dto.setAppSkillsList(skills);
dto.setExperiencesList(userWorkExperiencesList);
}
return dto;
}
@Override
public int insertHrCompanyTalentCollect(HrCompanyTalentCollect collect)
{
// 校验是否已收藏
HrCompanyTalentCollect exist = hrCompanyTalentCollectMapper.selectExistCollect(collect.getCompanyId(), collect.getUserId());
if (exist != null)
{
return 2;
}
return hrCompanyTalentCollectMapper.insert(collect);
}
@Override
public int updateHrCompanyTalentCollect(HrCompanyTalentCollect collect)
{
return hrCompanyTalentCollectMapper.updateById(collect);
}
@Override
public int deleteHrCompanyTalentCollectByIds(Long[] ids)
{
return hrCompanyTalentCollectMapper.deleteBatchIds(Arrays.asList(ids));
}
}