1.0
xin
2025-04-15 e718afd02965c6a4018506acb1ae99baca0c5645
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.oying.config.properties;
 
import lombok.Data;
import com.oying.utils.ElConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
 
/**
 * @author Z
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "file")
public class FileProperties {
 
    /** 文件大小限制 */
    private Long maxSize;
 
    /** 头像大小限制 */
    private Long avatarMaxSize;
 
    private ElPath mac;
 
    private ElPath linux;
 
    private ElPath windows;
 
    public ElPath getPath(){
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith(ElConstant.WIN)) {
            return windows;
        } else if(os.toLowerCase().startsWith(ElConstant.MAC)){
            return mac;
        }
        return linux;
    }
 
    @Data
    public static class ElPath{
 
        private String path;
 
        private String avatar;
    }
}