huangzhen
2023-09-15 ea09629d8857e0afa329858f72cf1c93e25b813c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.gkhy.exam.coalmine.utils;
 
import com.ruoyi.file.entity.AttachmentInfo;
 
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
 
/**
 * @author Mr.huang
 * @decription
 * @date 2023/9/14 9:59
 */
public class AttachmentUtil {
 
    public static List<Long> stringConvertIds(String str){
        List<Long> list = Pattern.compile(",\\s*")
                .splitAsStream(str)
                .map(Long::parseLong)
                .collect(Collectors.toList());
        return list;
    }
 
    public static String idConvertString(List<AttachmentInfo> attachmentInfos){
        String attachmentIds = attachmentInfos.stream().map(AttachmentInfo::getId).map(Object::toString)
                .collect(Collectors.joining(","));
        return attachmentIds;
    }
}