添加企业收藏求职者

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,118 @@
package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollect;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollectDTO;
import com.ruoyi.cms.service.ICompanyService;
import com.ruoyi.cms.service.msg.IHCompanyTalentCollectService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.Company;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 企业人才库收藏管理
*/
@RestController
@RequestMapping("/cms/hrTalentCollect")
public class HrCompanyTalentCollectController extends BaseController
{
@Autowired
private IHCompanyTalentCollectService hrCompanyTalentCollectService;
@Autowired
private ICompanyService companyService;
/**
* 人才库收藏列表分页
*/
@PreAuthorize("@ss.hasPermi('cms:hrTalentCollect:list')")
@GetMapping("/list")
public TableDataInfo list(HrCompanyTalentCollectDTO hrCompanyTalentCollect)
{
//未登录
if(!SecurityUtils.isLogin()){
return getDataTable(new ArrayList<>());
}
//未绑定
Company company=companyService.queryCodeCompany(SecurityUtils.getIdcard());
if(company==null){
return getDataTable(new ArrayList<>());
}
startPage();
hrCompanyTalentCollect.setCompanyId(company.getCompanyId());
List<HrCompanyTalentCollectDTO> list=hrCompanyTalentCollectService.selectHrCompanyTalentCollectList(hrCompanyTalentCollect);
return getDataTable(list);
}
/**
* 获取单条详情
*/
@PreAuthorize("@ss.hasPermi('cms:hrTalentCollect:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable Long id)
{
return AjaxResult.success(hrCompanyTalentCollectService.selectHrCompanyTalentCollectById(id));
}
/**
* 收藏求职者(加入人才库)
*/
@PreAuthorize("@ss.hasPermi('cms:hrTalentCollect:add')")
@Log(title = "收藏人才", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HrCompanyTalentCollect hrCompanyTalentCollect)
{
if(!SecurityUtils.isLogin()){
return error("未登录!");
}
Company company=companyService.queryCodeCompany(SecurityUtils.getIdcard());
if(company==null){
return error("未查询到当前企业信息!");
}
hrCompanyTalentCollect.setCompanyId(company.getCompanyId());
int res = hrCompanyTalentCollectService.insertHrCompanyTalentCollect(hrCompanyTalentCollect);
if (res == 2)
{
return AjaxResult.error("该求职者已加入人才库,请勿重复收藏");
}
return AjaxResult.success();
}
/**
* 修改收藏信息(意向等级、标签、备注等)
*/
@PreAuthorize("@ss.hasPermi('cms:hrTalentCollect:edit')")
@Log(title = "编辑人才收藏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HrCompanyTalentCollect hrCompanyTalentCollect)
{
if(!SecurityUtils.isLogin()){
return error("未登录!");
}
Company company=companyService.queryCodeCompany(SecurityUtils.getIdcard());
if(company==null){
return error("未查询到当前企业信息!");
}
hrCompanyTalentCollect.setCompanyId(company.getCompanyId());
return toAjax(hrCompanyTalentCollectService.updateHrCompanyTalentCollect(hrCompanyTalentCollect));
}
/**
* 移出人才库(逻辑删除)
*/
@PreAuthorize("@ss.hasPermi('cms:hrTalentCollect:remove')")
@Log(title = "移出人才库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(hrCompanyTalentCollectService.deleteHrCompanyTalentCollectByIds(ids));
}
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.cms.domain.msg;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -16,6 +17,7 @@ import lombok.Data;
*/
@Data
@ApiModel("人力中介咨询消息实体")
@TableName(value = "hr_agency_consult_msg")
public class HrAgencyConsultMsg extends BaseEntity
{
@TableField(exist = false)

View File

@@ -0,0 +1,53 @@
package com.ruoyi.cms.domain.msg;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 企业人才库收藏记录表 hr_company_talent_collect
*/
@Data
@ApiModel("企业人才库收藏记录表")
@TableName(value = "hr_company_talent_collect")
public class HrCompanyTalentCollect extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
@ApiModelProperty("主键ID")
private Long id;
/** 企业后台用户ID */
@ApiModelProperty("企业后台用户ID")
private Long companyId;
/** 求职者简历ID */
@ApiModelProperty("用户ID")
private Long userId;
/** 意向等级 1高 2中 3低 */
@ApiModelProperty("意向等级 1=高意向,2=中等意向,3=低意向")
private String intentionLevel;
/** 意向岗位ID 逗号分隔 */
@Excel(name = "意向岗位ID")
@ApiModelProperty("意向岗位ID")
private String intendJobIds;
/** 自定义标签 逗号分隔 */
@ApiModelProperty("人才标签")
private String collectTags;
/** 收藏来源 1简历搜索 2投递 3面试邀约 4手动新增 */
@ApiModelProperty("收藏来源 1=简历搜索,2=投递记录,3=邀约面试,4=手动录入")
private String sourceType;
}

View File

@@ -0,0 +1,52 @@
package com.ruoyi.cms.domain.msg;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.AppUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 企业人才库收藏记录表 hr_company_talent_collect
*/
@Data
public class HrCompanyTalentCollectDTO extends AppUser
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
@ApiModelProperty("主键ID")
private Long id;
/** 企业后台用户ID */
@ApiModelProperty("企业后台用户ID")
private Long companyId;
/** 求职者简历ID */
@ApiModelProperty("用户ID")
private Long userId;
/** 意向等级 1高 2中 3低 */
@ApiModelProperty("意向等级 1=高意向,2=中等意向,3=低意向")
private String intentionLevel;
/** 意向岗位ID 逗号分隔 */
@Excel(name = "意向岗位ID")
@ApiModelProperty("意向岗位ID")
private String intendJobIds;
/** 自定义标签 逗号分隔 */
@ApiModelProperty("人才标签")
private String collectTags;
/** 收藏来源 1简历搜索 2投递 3面试邀约 4手动新增 */
@ApiModelProperty("收藏来源 1=简历搜索,2=投递记录,3=邀约面试,4=手动录入")
private String sourceType;
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.cms.mapper.msg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollect;
import com.ruoyi.cms.domain.msg.HrCompanyTalentCollectDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 企业人才收藏Mapper
*/
public interface HrCompanyTalentCollectMapper extends BaseMapper<HrCompanyTalentCollect>
{
/**
* 查询收藏列表(企业人才库分页)
*/
List<HrCompanyTalentCollectDTO> selectHrCompanyTalentCollectList(HrCompanyTalentCollectDTO hrCompanyTalentCollect);
/**
* 查询企业是否已收藏该简历(防重复)
*/
HrCompanyTalentCollect selectExistCollect(@Param("companyId") Long companyUserId, @Param("userId") Long userId);
}

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));
}
}

View File

@@ -180,7 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
then t.update_time else null end reject_time,t.is_imp_company,t.imp_company_type,t.enterprise_type,t.legal_person,t.legal_id_card,t.legal_phone,t.is_hrs,
su.lc_userid from company t
left join sys_user su on t.code=su.id_card
<where> t.del_flag = '0'
<where> t.del_flag = '0' and su.lc_userid is not null
<if test="name != null and name != ''"> and t.name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<if test="scale != null and scale != ''"> and t.scale = #{scale}</if>
<if test="nature != null and nature != ''"> and t.nature = #{nature}</if>

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.cms.mapper.msg.HrCompanyTalentCollectMapper">
<resultMap type="HrCompanyTalentCollect" id="HrCompanyTalentCollectResult">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="user_id" property="userId"/>
<result column="intention_level" property="intentionLevel"/>
<result column="intend_job_ids" property="intendJobIds"/>
<result column="collect_tags" property="collectTags"/>
<result column="remark" property="remark"/>
<result column="source_type" property="sourceType"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<resultMap type="HrCompanyTalentCollectDto" id="AppUserResultDto">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="user_id" property="userId" />
<result column="intention_level" property="intentionLevel"/>
<result column="intend_job_ids" property="intendJobIds"/>
<result column="collect_tags" property="collectTags"/>
<result column="remark" property="remark"/>
<result column="source_type" property="sourceType"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<!--个人信息-->
<result property="name" column="name" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="birthDate" column="birth_date" />
<result property="education" column="education" />
<result property="politicalAffiliation" column="political_affiliation" />
<result property="phone" column="phone" />
<result property="avatar" column="avatar" />
<result property="salaryMin" column="salary_min" />
<result property="salaryMax" column="salary_max" />
<result property="area" column="area" />
<result property="status" column="status" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="jobTitleId" column="job_title_id" />
<result property="isRecommend" column="is_recommend" />
<result property="idCard" column="id_card" />
<result property="workExperience" column="work_experience" />
<result property="isCompanyUser" column="is_company_user" />
<result property="lcUserid" column="lc_userid" />
<result property="email" column="email" />
</resultMap>
<sql id="selectHrCompanyTalentCollectVo">
select id, company_id, user_id, intention_level, intend_job_ids, collect_tags, remark,
source_type, del_flag, create_by, create_time, update_by, update_time
from hr_company_talent_collect
</sql>
<sql id="selectHrCompanyTalentCollectVoDto">
select htc.id, htc.company_id, htc.user_id, htc.intention_level, htc.intend_job_ids, htc.collect_tags, htc.remark,
htc.source_type, htc.del_flag, htc.create_by, htc.create_time, htc.update_by, htc.update_time,
au.name, au.age, au.sex, au.birth_date, au.education, au.political_affiliation, au.phone, au.avatar, au.salary_min,
au.salary_max, au.area, au.status, au.login_ip, au.login_date,au.job_title_id,au.is_recommend,au.id_card,au.work_experience,
au.is_company_user,au.lc_userid,au.email
from hr_company_talent_collect htc
left join app_user au on htc.user_id=au.user_id
</sql>
<select id="selectHrCompanyTalentCollectList" resultMap="AppUserResultDto" parameterType="HrCompanyTalentCollectDto">
<include refid="selectHrCompanyTalentCollectVoDto"/>
<where>
htc.del_flag = '0'
<if test="companyId != null">
and htc.company_id = #{companyId}
</if>
<if test="userId != null">
and htc.user_id = #{userId}
</if>
<if test="intentionLevel != null">
and htc.intention_level = #{intentionLevel}
</if>
<if test="sourceType != null">
and htc.source_type = #{sourceType}
</if>
<if test="collectTags != null and collectTags != ''">
and htc.collect_tags like concat('%',#{collectTags},'%')
</if>
</where>
order by htc.create_time desc
</select>
<select id="selectExistCollect" resultMap="HrCompanyTalentCollectResult">
<include refid="selectHrCompanyTalentCollectVo"/>
where company_id = #{companyId} and user_id = #{userId} and del_flag = '0'
</select>
</mapper>