|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.PostConstruct; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  | Code code = CODE_ID_CACHE.get(id); | 
|---|
|  |  |  | if (code == null) { | 
|---|
|  |  |  | code = this.getById(id); | 
|---|
|  |  |  | if (code != null) { | 
|---|
|  |  |  | CODE_ID_CACHE.put(id, code); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return code; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | Code code = CODE_DATA_CACHE.get(data); | 
|---|
|  |  |  | if (code == null) { | 
|---|
|  |  |  | code = this.selectByData(data); | 
|---|
|  |  |  | if (null != code) { | 
|---|
|  |  |  | CODE_DATA_CACHE.put(data, code); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return code; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return this.baseMapper.selectDistinctCountFromY(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Code> getAllLocCode() { | 
|---|
|  |  |  | List<Long> ids = this.baseMapper.selectAllLocCode(); | 
|---|
|  |  |  | List<Code> codeList = new ArrayList<>(); | 
|---|
|  |  |  | for (Long id : ids) { | 
|---|
|  |  |  | codeList.add(this.getById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return codeList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|