| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | @Service |
| | | public class StScheduleModelParamServiceImpl extends BaseServiceImpl<StScheduleModelParamDao, StScheduleModelParamEntity> |
| | | implements StScheduleModelParamService { |
| | | |
| | | private static Map<String, List<StScheduleModelParamEntity>> modelInputParamMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Override |
| | | public List<StScheduleModelParamEntity> getByModelId(String modelId) { |
| | |
| | | entity.setModelid(modelId); |
| | | baseDao.insert(entity); |
| | | }); |
| | | clearCache(); |
| | | } |
| | | |
| | | @Override |
| | | public List<StScheduleModelParamEntity> getByModelidFromCache(String modelId) { |
| | | if (!modelInputParamMap.containsKey(modelId)) { |
| | | List<StScheduleModelParamEntity> list = getByModelId(modelId); |
| | | if (list != null) { |
| | | modelInputParamMap.put(modelId, list); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return modelInputParamMap.get(modelId); |
| | | } |
| | | |
| | | public void clearCache() { |
| | | modelInputParamMap.clear(); |
| | | } |
| | | } |