huang
2025-11-17 92a5d16f0474ead87744b4ca5cb04417247a0619
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
package com.mes.job.config;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
import java.util.Map;
 
/**
 * @author huang
 * @since 2025/10/31
 */
@Component
@ConfigurationProperties(prefix = "plc.address")
@Data
public class PlcAddressYmlConfig {
 
    /**
     * key:项目标识(比如YML中的 "vertical")
     * value:该项目的所有PLC配置(对应YML中 "vertical" 下的所有字段)
     */
    private Map<String, PlcAddressItem> projects;
 
    /**
     * 单个项目的配置项(对应YML中 "projects" 下某个项目的子配置)
     * 字段名必须和YML中的配置项完全一致(大小写敏感)
     */
    @Data
    public static class PlcAddressItem {
        private String dbArea;        // 对应YML中的 dbArea
        private Integer beginIndex;   // 对应YML中的 beginIndex
        private String plcIp;         // 对应YML中的 plcIp
        private String plcType;       // 对应YML中的 plcType
        private Map<String, Integer> addressMapping;  // 对应YML中的 addressMapping(嵌套Map)
    }
}