1.修改任务跟踪中,部门不显示的bug

2.优化主页和面试管理里的代码
This commit is contained in:
lw 2024-07-02 19:46:26 +08:00
parent ac3c8c1617
commit 6af7e4207c
11 changed files with 177 additions and 93 deletions

View File

@ -7,8 +7,8 @@ ruoyi:
# 版权年份 # 版权年份
copyrightYear: 2024 copyrightYear: 2024
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
#profile: D:/zeroerr/uploadPath profile: D:/zeroerr/uploadPath
profile: /home/zeroerr_oa/uploadPath #profile: /home/zeroerr_oa/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证 # 验证码类型 math 数字计算 char 字符验证
@ -69,15 +69,15 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: 192.168.1.189 #host: 192.168.1.189
#host: localhost host: localhost
# 端口默认为6379 # 端口默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码 # 密码
password: 123456 #password: 123456
#password: password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:

View File

@ -67,16 +67,22 @@ public class HomePageController extends BaseController {
List<ResumeHandleRecord> resumeHandleRecordList = resumeHandleRecordService.getBySelect(req.getHrId(), firstDay, lastDay); List<ResumeHandleRecord> resumeHandleRecordList = resumeHandleRecordService.getBySelect(req.getHrId(), firstDay, lastDay);
//寻找该月份实际到面的人数 //寻找该月份实际到面的人数
List<ResumeFollowRecord> resumeFollowRecordActualArrivedList =resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay,0); List<ResumeFollowRecord> resumeFollowRecordActualArrivedList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 0);
//寻找该月份终试通过人数 //寻找该月份终试通过人数
List<ResumeFollowRecord> resumeFollowRecordFinalPassList =resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay,1); List<ResumeFollowRecord> resumeFollowRecordFinalPassList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 1);
//寻找该月份实际入职人数 //寻找该月份实际入职人数
List<ResumeFollowRecord> resumeFollowRecordActualEntryList =resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay,2); List<ResumeFollowRecord> resumeFollowRecordActualEntryList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 2);
//寻找该月份初试通过人数 //寻找该月份初试通过人数
List<ResumeFollowRecord> resumeFollowRecordFirstPassList =resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay,3); List<ResumeFollowRecord> resumeFollowRecordFirstPassList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 3);
//寻找该月份内部推荐的人数
List<ResumeFollowRecord> resumeFollowRecordInternalRecommendedList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 7);
//寻找该月份内部竞聘的人数
List<ResumeFollowRecord> resumeFollowRecordInternalCompetitionList = resumeFollowRecordService.getBySelectMonth(req.getHrName(), firstDay, lastDay, 8);
ResumeStatVO resumeStatVO = new ResumeStatVO(); ResumeStatVO resumeStatVO = new ResumeStatVO();
//1.合格简历数量 //1.合格简历数量
@ -92,7 +98,15 @@ public class HomePageController extends BaseController {
//6.简历来源下载 //6.简历来源下载
resumeStatVO.setDownLoadCounts(resumeFollowRecordList.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "2".equals(record.getResumeSource())).count()); resumeStatVO.setDownLoadCounts(resumeFollowRecordList.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "2".equals(record.getResumeSource())).count());
//7.简历来源自投 //7.简历来源自投
resumeStatVO.setSelfCounts(resumeFollowRecordList.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "1".equals(record.getResumeSource())).count()); if(resumeHandleRecordList!=null){
resumeStatVO.setSelfCounts(resumeHandleRecordList.stream()
.filter(record -> record.getSelfCounts() != null)
.mapToInt(ResumeHandleRecord::getSelfCounts)
.sum());
}else {
resumeStatVO.setSelfCounts(0);
}
//8.封装实际到面人数 //8.封装实际到面人数
resumeStatVO.setActualArriveCounts(resumeFollowRecordActualArrivedList.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count()); resumeStatVO.setActualArriveCounts(resumeFollowRecordActualArrivedList.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count());
// 9. 通过比例终面=通过人数终面/初面实际到面人数 // 9. 通过比例终面=通过人数终面/初面实际到面人数
@ -105,7 +119,7 @@ public class HomePageController extends BaseController {
resumeStatVO.setPassPercent(0d); resumeStatVO.setPassPercent(0d);
} }
} }
//7.入职比例=入职人数/初面实际到面人数 //10.入职比例=入职人数/初面实际到面人数
if (resumeStatVO.getActualArriveCounts() != null) { if (resumeStatVO.getActualArriveCounts() != null) {
if (resumeStatVO.getActualArriveCounts() != 0L) { if (resumeStatVO.getActualArriveCounts() != 0L) {
BigDecimal entryPercentage = new BigDecimal(resumeStatVO.getEntryCount()).divide(new BigDecimal(resumeStatVO.getActualArriveCounts()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); BigDecimal entryPercentage = new BigDecimal(resumeStatVO.getEntryCount()).divide(new BigDecimal(resumeStatVO.getActualArriveCounts()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
@ -114,6 +128,18 @@ public class HomePageController extends BaseController {
} else { } else {
resumeStatVO.setEntryPercent(0d); resumeStatVO.setEntryPercent(0d);
} }
//11. 处理 内竞数/内推数
int internalRecommendedSize = 0;
int internalCompetitionSize = 0;
if (resumeFollowRecordInternalRecommendedList != null) {
internalRecommendedSize = resumeFollowRecordInternalRecommendedList.size();
}
if (resumeFollowRecordInternalCompetitionList != null) {
internalCompetitionSize = resumeFollowRecordInternalCompetitionList.size();
}
resumeStatVO.setInternalRecommendedSize(internalRecommendedSize);
resumeStatVO.setInternalCompetitionSize(internalCompetitionSize);
// // 使用流进行分组并求和 // // 使用流进行分组并求和
// Map<Long, Integer> groupedSum = resumeHandleRecordList.stream() // Map<Long, Integer> groupedSum = resumeHandleRecordList.stream()
// .collect(Collectors.groupingBy(ResumeHandleRecord::getPostId, // .collect(Collectors.groupingBy(ResumeHandleRecord::getPostId,
@ -174,7 +200,6 @@ public class HomePageController extends BaseController {
// resumeStatVO.setPostNameList(postNameList); // resumeStatVO.setPostNameList(postNameList);
//11.合格简历百分比100 电话面试通过百分比电话通过人数/简历合格数 初试通过百分比 初试通过人数/初试到面人数 终试通过百分比终试通过人数/终试到面人数 //11.合格简历百分比100 电话面试通过百分比电话通过人数/简历合格数 初试通过百分比 初试通过人数/初试到面人数 终试通过百分比终试通过人数/终试到面人数
@ -197,111 +222,111 @@ public class HomePageController extends BaseController {
.map(ResumeHandleRecord::getPostId) .map(ResumeHandleRecord::getPostId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
List<PostDetailDTO> postDetailDTOList=new ArrayList<>(); List<PostDetailDTO> postDetailDTOList = new ArrayList<>();
// 将Set转换为List // 将Set转换为List
List<Long> uniquePostIdList = new ArrayList<>(uniquePostIds); List<Long> uniquePostIdList = new ArrayList<>(uniquePostIds);
//某月份某岗位查看简历数 //某月份某岗位查看简历数
List<Integer> postLookResumeCounts=new ArrayList<>(); List<Integer> postLookResumeCounts = new ArrayList<>();
//某月份某岗位合格简历数 //某月份某岗位合格简历数
List<Integer> postQualifiedResumeCounts=new ArrayList<>(); List<Integer> postQualifiedResumeCounts = new ArrayList<>();
//某月份某岗位简历自投数 //某月份某岗位简历自投数
List<Long> postSelfCounts=new ArrayList<>(); List<Long> postSelfCounts = new ArrayList<>();
//某月份某岗位简历下载数 //某月份某岗位简历下载数
List<Long> postDownLoadCounts=new ArrayList<>(); List<Long> postDownLoadCounts = new ArrayList<>();
//某月份某岗位约面人数 //某月份某岗位约面人数
List<Integer> postInviteCounts=new ArrayList<>(); List<Integer> postInviteCounts = new ArrayList<>();
//某月份某岗位到面人数 //某月份某岗位到面人数
List<Long> postArriveCounts=new ArrayList<>(); List<Long> postArriveCounts = new ArrayList<>();
//某月份岗位名字 //某月份岗位名字
List<String> postNameList=new ArrayList<>(); List<String> postNameList = new ArrayList<>();
//某月份岗位ids //某月份岗位ids
List<Long> postIdsList=new ArrayList<>(); List<Long> postIdsList = new ArrayList<>();
//筛除已经招聘到的岗位 //筛除已经招聘到的岗位
//List<Long> postIdList=recruitStructureService.filterByPostIdList(uniquePostIdList); //List<Long> postIdList=recruitStructureService.filterByPostIdList(uniquePostIdList);
if(!CollectionUtils.isEmpty(uniquePostIdList)){ if (!CollectionUtils.isEmpty(uniquePostIdList)) {
uniquePostIdList.forEach( uniquePostIdList.forEach(
uniquePostId->{ uniquePostId -> {
List<ResumeFollowRecord> resumeFollowRecordListByPostId = groupedResumeFollowRecords.get(uniquePostId); List<ResumeFollowRecord> resumeFollowRecordListByPostId = groupedResumeFollowRecords.get(uniquePostId);
List<ResumeHandleRecord> resumeHandleRecordListByPostId = groupedResumeHandleRecords.get(uniquePostId); List<ResumeHandleRecord> resumeHandleRecordListByPostId = groupedResumeHandleRecords.get(uniquePostId);
PostDetailDTO postDetailDTO = new PostDetailDTO(); PostDetailDTO postDetailDTO = new PostDetailDTO();
postDetailDTO.setPostId(uniquePostId); postDetailDTO.setPostId(uniquePostId);
if(!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) {
postDetailDTO.setPostName(resumeFollowRecordListByPostId.get(0).getPostName()); postDetailDTO.setPostName(resumeFollowRecordListByPostId.get(0).getPostName());
}else if(!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)) { } else if (!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)) {
postDetailDTO.setPostName(resumeHandleRecordListByPostId.get(0).getPostName()); postDetailDTO.setPostName(resumeHandleRecordListByPostId.get(0).getPostName());
}else { } else {
postDetailDTO.setPostName(""); postDetailDTO.setPostName("");
} }
//封装该岗位浏览简历数 //封装该岗位浏览简历数
if(!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)) {
postDetailDTO.setPostLookResumeCounts( resumeHandleRecordListByPostId.stream() postDetailDTO.setPostLookResumeCounts(resumeHandleRecordListByPostId.stream()
.mapToInt(ResumeHandleRecord::getSeenNum) .mapToInt(ResumeHandleRecord::getSeenNum)
.sum()); .sum());
}else { } else {
postDetailDTO.setPostLookResumeCounts(0); postDetailDTO.setPostLookResumeCounts(0);
} }
//封装该岗位合格简历数 //封装该岗位合格简历数
if(!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) {
// postDetailDTO.setPostQualifiedResumeCounts( resumeHandleRecordListByPostId.stream() // postDetailDTO.setPostQualifiedResumeCounts( resumeHandleRecordListByPostId.stream()
// .mapToInt(ResumeHandleRecord::getQualifiedNum) // .mapToInt(ResumeHandleRecord::getQualifiedNum)
// .sum()); // .sum());
postDetailDTO.setPostQualifiedResumeCounts(resumeFollowRecordListByPostId.size()); postDetailDTO.setPostQualifiedResumeCounts(resumeFollowRecordListByPostId.size());
}else { } else {
postDetailDTO.setPostQualifiedResumeCounts(0); postDetailDTO.setPostQualifiedResumeCounts(0);
} }
//封装该岗位的自投数 //封装该岗位的自投数
if(!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) {
postDetailDTO.setPostSelfCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "1".equals(record.getResumeSource())).count()); postDetailDTO.setPostSelfCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "1".equals(record.getResumeSource())).count());
}else { } else {
postDetailDTO.setPostSelfCounts(0L); postDetailDTO.setPostSelfCounts(0L);
} }
//封装该岗位的下载数 //封装该岗位的下载数
if(!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) {
postDetailDTO.setPostDownLoadCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "2".equals(record.getResumeSource())).count()); postDetailDTO.setPostDownLoadCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getResumeSource()) && "2".equals(record.getResumeSource())).count());
}else { } else {
postDetailDTO.setPostDownLoadCounts(0L); postDetailDTO.setPostDownLoadCounts(0L);
} }
//封装约面数 //封装约面数
if(!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeHandleRecordListByPostId)) {
postDetailDTO.setPostInviteCounts( resumeHandleRecordListByPostId.stream() postDetailDTO.setPostInviteCounts(resumeHandleRecordListByPostId.stream()
.mapToInt(ResumeHandleRecord::getReceiveInviteNum) .mapToInt(ResumeHandleRecord::getReceiveInviteNum)
.sum()); .sum());
}else { } else {
postDetailDTO.setPostInviteCounts(0); postDetailDTO.setPostInviteCounts(0);
} }
//封装到面数 //封装到面数
if(!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)){ if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) {
postDetailDTO.setPostArriveCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count()); postDetailDTO.setPostArriveCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count());
}else { } else {
postDetailDTO.setPostArriveCounts(0L); postDetailDTO.setPostArriveCounts(0L);
} }
postDetailDTOList.add(postDetailDTO); postDetailDTOList.add(postDetailDTO);
} }
); );
if(!CollectionUtils.isEmpty(postDetailDTOList)){ if (!CollectionUtils.isEmpty(postDetailDTOList)) {
//根据岗位查看简历数进行排序 //根据岗位查看简历数进行排序
List<PostDetailDTO> sortedList = postDetailDTOList.stream() List<PostDetailDTO> sortedList = postDetailDTOList.stream()
.sorted(Comparator.comparingInt(PostDetailDTO::getPostLookResumeCounts).reversed()) // 从大到小排序 .sorted(Comparator.comparingInt(PostDetailDTO::getPostLookResumeCounts).reversed()) // 从大到小排序
.collect(Collectors.toList()); .collect(Collectors.toList());
sortedList.forEach( sortedList.forEach(
post -> { post -> {
postIdsList.add(post.getPostId()); postIdsList.add(post.getPostId());
postNameList.add(post.getPostName()); postNameList.add(post.getPostName());
postArriveCounts.add(post.getPostArriveCounts()); postArriveCounts.add(post.getPostArriveCounts());
postInviteCounts.add(post.getPostInviteCounts()); postInviteCounts.add(post.getPostInviteCounts());
postDownLoadCounts.add(post.getPostDownLoadCounts()); postDownLoadCounts.add(post.getPostDownLoadCounts());
postSelfCounts.add(post.getPostSelfCounts()); postSelfCounts.add(post.getPostSelfCounts());
postQualifiedResumeCounts.add(post.getPostQualifiedResumeCounts()); postQualifiedResumeCounts.add(post.getPostQualifiedResumeCounts());
postLookResumeCounts.add(post.getPostLookResumeCounts()); postLookResumeCounts.add(post.getPostLookResumeCounts());
} }
); );
} }
} }

View File

@ -189,6 +189,7 @@ public class RecruitFollowController extends BaseController {
if (followVO.getPostId() == null) followVO.setPostId(0L); if (followVO.getPostId() == null) followVO.setPostId(0L);
if (followVO.getPostName() == null) followVO.setPostName(""); if (followVO.getPostName() == null) followVO.setPostName("");
if (followVO.getDeptId() == null) followVO.setDeptId(0L); if (followVO.getDeptId() == null) followVO.setDeptId(0L);
if (followVO.getDeptName() == null) followVO.setDeptName(handleDeptName(followVO.getPostId()));
if (followVO.getHrId() == null) followVO.setHrId(0L); if (followVO.getHrId() == null) followVO.setHrId(0L);
if (followVO.getHrName() == null) followVO.setHrName(""); if (followVO.getHrName() == null) followVO.setHrName("");
if (followVO.getPostCount() == null) followVO.setPostCount(0); if (followVO.getPostCount() == null) followVO.setPostCount(0);
@ -224,6 +225,10 @@ public class RecruitFollowController extends BaseController {
return AjaxResult.success(followVOList); return AjaxResult.success(followVOList);
} }
private String handleDeptName(Long postId) {
return recruitStructureService.findTopLevelDepartmentNameByNodeId(postId);
}
private void handleFollowRecords(FollowDTO req, List<FollowVO> followVOList) { private void handleFollowRecords(FollowDTO req, List<FollowVO> followVOList) {
String hrName = req.getHrName(); String hrName = req.getHrName();
LocalDate startDate = req.getStartDate(); LocalDate startDate = req.getStartDate();
@ -293,4 +298,6 @@ public class RecruitFollowController extends BaseController {
} }
} }

View File

@ -103,6 +103,12 @@ public class ResumeHandleRecord implements Serializable {
@TableField(value = "dept_name") @TableField(value = "dept_name")
private String deptName; private String deptName;
/**
* 自投数量
*/
@TableField(value = "self_counts")
private Integer selfCounts;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -27,6 +27,12 @@ public class ResumeStatVO {
@ApiModelProperty(value = "入职人数") @ApiModelProperty(value = "入职人数")
private Long entryCount; private Long entryCount;
@ApiModelProperty(value = "内推数")
private Integer internalRecommendedSize;
@ApiModelProperty(value = "内竞数")
private Integer internalCompetitionSize;
@ApiModelProperty(value = "通过比例(终面)") @ApiModelProperty(value = "通过比例(终面)")
private Double passPercent; private Double passPercent;
@ -79,7 +85,7 @@ public class ResumeStatVO {
private Integer findResumeCounts; private Integer findResumeCounts;
@ApiModelProperty(value = "自投数量") @ApiModelProperty(value = "自投数量")
private Long selfCounts; private Integer selfCounts;
@ApiModelProperty(value = "下载数量") @ApiModelProperty(value = "下载数量")
private Long downLoadCounts; private Long downLoadCounts;

View File

@ -174,6 +174,17 @@
and final_date <![CDATA[>=]]> #{firstDay} and final_date <![CDATA[>=]]> #{firstDay}
and final_date <![CDATA[<=]]> #{lastDay} and final_date <![CDATA[<=]]> #{lastDay}
</if> </if>
<if test="i == 7">
and recruitment_channel = 4
and receive_date <![CDATA[>=]]> #{firstDay}
and receive_date <![CDATA[<=]]> #{lastDay}
</if>
<if test="i == 8">
and recruitment_channel = 8
and receive_date <![CDATA[>=]]> #{firstDay}
and receive_date <![CDATA[<=]]> #{lastDay}
</if>
<if test="hrName!=null and hrName != ''">and hr_name like concat('%', #{hrName}, '%')</if> <if test="hrName!=null and hrName != ''">and hr_name like concat('%', #{hrName}, '%')</if>
</select> </select>

View File

@ -14,6 +14,7 @@
<result property="greetNum" column="greet_num" jdbcType="INTEGER"/> <result property="greetNum" column="greet_num" jdbcType="INTEGER"/>
<result property="submitNum" column="submit_num" jdbcType="INTEGER"/> <result property="submitNum" column="submit_num" jdbcType="INTEGER"/>
<result property="qualifiedNum" column="qualified_num" jdbcType="INTEGER"/> <result property="qualifiedNum" column="qualified_num" jdbcType="INTEGER"/>
<result property="selfCounts" column="self_counts" jdbcType="INTEGER"/>
<result property="receiveInviteNum" column="receive_invite_num" jdbcType="INTEGER"/> <result property="receiveInviteNum" column="receive_invite_num" jdbcType="INTEGER"/>
<result property="operatorId" column="operator_id" /> <result property="operatorId" column="operator_id" />
<result property="operatorName" column="operator_name" /> <result property="operatorName" column="operator_name" />
@ -25,7 +26,7 @@
id,post_id,post_name, id,post_id,post_name,
handle_date,recruitment_channel,seen_num, handle_date,recruitment_channel,seen_num,
greet_num,submit_num,qualified_num, greet_num,submit_num,qualified_num,
receive_invite_num,operator_id,operator_name,dept_id,dept_name receive_invite_num,operator_id,operator_name,dept_id,dept_name,self_counts
</sql> </sql>
<select id="listByCondition" resultMap="BaseResultMap"> <select id="listByCondition" resultMap="BaseResultMap">

View File

@ -59,4 +59,6 @@ public interface RecruitStructureMapper extends BaseMapper<RecruitStructure> {
RecruitStructure getDeptByNodeId(Long nodeId); RecruitStructure getDeptByNodeId(Long nodeId);
List<Long> filterByPostIdList(@Param("uniquePostIdList") List<Long> uniquePostIdList); List<Long> filterByPostIdList(@Param("uniquePostIdList") List<Long> uniquePostIdList);
String findTopLevelDepartmentNameByNodeId(Long postId);
} }

View File

@ -49,4 +49,6 @@ public interface RecruitStructureService extends IService<RecruitStructure> {
RecruitStructure getDeptByNodeId(Long nodeId); RecruitStructure getDeptByNodeId(Long nodeId);
List<Long> filterByPostIdList(List<Long> uniquePostIdList); List<Long> filterByPostIdList(List<Long> uniquePostIdList);
String findTopLevelDepartmentNameByNodeId(Long postId);
} }

View File

@ -191,6 +191,11 @@ public class RecruitStructureServiceImpl extends ServiceImpl<RecruitStructureMap
return recruitStructureMapper.filterByPostIdList(uniquePostIdList); return recruitStructureMapper.filterByPostIdList(uniquePostIdList);
} }
@Override
public String findTopLevelDepartmentNameByNodeId(Long postId) {
return recruitStructureMapper.findTopLevelDepartmentNameByNodeId(postId);
}
private List<TreeSelect> buildDeptTreeSelect(List<RecruitStructure> depts) { private List<TreeSelect> buildDeptTreeSelect(List<RecruitStructure> depts) {
List<RecruitStructure> deptTrees = buildDeptTree(depts); List<RecruitStructure> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());

View File

@ -208,7 +208,8 @@
<update id="updatePostType"> <update id="updatePostType">
update recruit_structure update recruit_structure
set post_type=#{i},task_id=#{taskId} set post_type=#{i},
task_id=#{taskId}
where node_id = #{structurePostId} where node_id = #{structurePostId}
</update> </update>
@ -223,11 +224,12 @@
<select id="getByNodeId" resultMap="RecruitStructureResult"> <select id="getByNodeId" resultMap="RecruitStructureResult">
select * select *
from recruit_structure from recruit_structure
where node_id=#{nodeId} where node_id = #{nodeId}
</select> </select>
<select id="selectDeptList" parameterType="cn.zeroerr.common.core.domain.entity.RecruitStructure" resultMap="RecruitStructureResult"> <select id="selectDeptList" parameterType="cn.zeroerr.common.core.domain.entity.RecruitStructure"
resultMap="RecruitStructureResult">
<include refid="selectNodeVo"/> <include refid="selectNodeVo"/>
where d.del_flag = '0' where d.del_flag = '0'
and type=0 and type=0
@ -249,16 +251,18 @@
</select> </select>
<select id="selectPostAll" resultMap="RecruitStructureResult"> <select id="selectPostAll" resultMap="RecruitStructureResult">
<include refid="selectNodeVo"/> where type =1 and status =0 <include refid="selectNodeVo"/>
where type =1 and status =0
</select> </select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long"> <select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.node_id select p.node_id
from recruit_structure p from recruit_structure p
left join sys_user_post up on up.post_id = p.node_id left join sys_user_post up on up.post_id = p.node_id
left join sys_user u on u.user_id = up.user_id left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId} and p.type=1 where u.user_id = #{userId}
and p.type = 1
</select> </select>
<select id="getList" parameterType="String" resultMap="RecruitStructureResult"> <select id="getList" parameterType="String" resultMap="RecruitStructureResult">
@ -266,44 +270,35 @@
from recruit_structure p from recruit_structure p
left join sys_user_post up on up.post_id = p.node_id left join sys_user_post up on up.post_id = p.node_id
left join sys_user u on u.user_id = up.user_id left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName} and p.type=1 where u.user_name = #{userName}
and p.type = 1
</select> </select>
<select id="getDeptByNodeId" parameterType="Long" resultMap="RecruitStructureResult"> <select id="getDeptByNodeId" parameterType="Long" resultMap="RecruitStructureResult">
WITH RECURSIVE cte AS ( WITH RECURSIVE cte AS (
SELECT SELECT node_id,
node_id, parent_id,
parent_id, type,
type, node_name
node_name FROM recruit_structure
FROM WHERE node_id = #{nodeId}
recruit_structure
WHERE
node_id = #{nodeId}
UNION ALL UNION ALL
SELECT SELECT rs.node_id,
rs.node_id, rs.parent_id,
rs.parent_id, rs.type,
rs.type, rs.node_name
rs.node_name FROM recruit_structure rs
FROM INNER JOIN
recruit_structure rs cte ON rs.node_id = cte.parent_id
INNER JOIN
cte ON rs.node_id = cte.parent_id
) )
SELECT SELECT node_id,
node_id, parent_id,
parent_id, type,
type, node_name
node_name FROM cte
FROM WHERE type = 0
cte ORDER BY parent_id ASC LIMIT 1
WHERE
type = 0
ORDER BY
parent_id ASC
LIMIT 1
</select> </select>
@ -320,4 +315,28 @@
</if> </if>
</select> </select>
<select id="findTopLevelDepartmentNameByNodeId" parameterType="long" resultType="string">
WITH RECURSIVE hierarchy AS (
SELECT node_id,
parent_id,
node_name,
type
FROM recruit_structure
WHERE node_id = #{nodeId}
UNION ALL
SELECT rs.node_id,
rs.parent_id,
rs.node_name,
rs.type
FROM recruit_structure rs
INNER JOIN
hierarchy h ON rs.node_id = h.parent_id
)
SELECT node_name
FROM hierarchy
WHERE type = 0
ORDER BY node_id LIMIT 1
</select>
</mapper> </mapper>