冠县态势感知平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
927 B

package com.example.upsecuritydata.cache;
import com.example.upsecuritydata.entity.SysDict;
import com.example.upsecuritydata.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class CodeCache {
public static Map<String, String> codeMap = new HashMap<String, String>();
@Autowired
private SysDictService codeService;
@PostConstruct
public void init(){
System.out.println("系统启动中。。。加载codeMap");
List<SysDict> codeList = codeService.selectAll();
for (SysDict code : codeList) {
codeMap.put(code.getDictCode(), code.getDictValue());
}
}
@PreDestroy
public void destroy(){
System.out.println("系统运行结束");
}
}