查询岗位列表-返回附件信息

This commit is contained in:
sh
2025-12-03 16:15:15 +08:00
parent 5f76945039
commit 6adda93d5d
3 changed files with 49 additions and 0 deletions

View File

@@ -22,4 +22,6 @@ public interface FileMapper extends BaseMapper<File>
public List<File> selectFileList(File file);
public int updateBussinessids(@Param("longs") List<Long> longs,@Param("newBussinessid") Long bussinessid);
public List<File> selectFileListByBussinessIds(@Param("longs") List<Long> longs);
}

View File

@@ -30,6 +30,7 @@ import com.ruoyi.common.utils.SiteSecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.easyes.core.biz.EsPageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -251,6 +252,39 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
public List<Job> selectJobList(Job job)
{
List<Job> jobs = jobMapper.selectJobList(job);
if (CollectionUtils.isNotEmpty(jobs)) {
String baseFilePath = StringUtil.getFilePath();
List<Long> jobIds = jobs.stream().filter(Objects::nonNull)
.map(Job::getJobId).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
List<File> allFiles = CollectionUtils.isNotEmpty(jobIds)
? Optional.ofNullable(fileMapper.selectFileListByBussinessIds(jobIds))
.orElseGet(Collections::emptyList)
: Collections.emptyList();
Map<Long, List<File>> fileGroupMap = allFiles.stream()
.filter(Objects::nonNull)
.filter(file -> Objects.nonNull(file.getBussinessid()))
.filter(file -> StringUtils.isNotBlank(file.getFileUrl()))
.peek(file -> {
String fullFileUrl = StringUtils.join(baseFilePath, file.getFileUrl().trim());
file.setFileUrl(fullFileUrl);
})
.collect(Collectors.groupingBy(
File::getBussinessid,
Collectors.collectingAndThen(Collectors.toList(),Collections::unmodifiableList)
));
jobs.forEach(jobItem -> {
if (Objects.nonNull(jobItem)) {
Long jobItemId = jobItem.getJobId();
List<File> jobFiles = fileGroupMap.getOrDefault(jobItemId, Collections.emptyList());
jobItem.setFilesList(jobFiles);
}
});
}
return jobs;
}

View File

@@ -49,4 +49,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</update>
<select id="selectFileListByBussinessIds" resultMap="FileResult">
<include refid="selectFileVo"/>
<where> del_flag = '0'
<if test="longs != null and longs.size() > 0">
and bussinessid in (
<foreach collection="longs" item="oldId" separator=",">
#{oldId}
</foreach>
)
</if>
</where>
</select>
</mapper>