| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemTypeDao; |
| | | import com.iailab.module.model.mcs.pre.dao.MmModelArithSettingsDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | @Autowired |
| | | private MmModelArithSettingsDao mmModelArithSettingsDao; |
| | | |
| | | private static Map<String, List<MmModelArithSettingsEntity>> modelIdMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Override |
| | | public void saveList(List<MmModelArithSettingsEntity> list) { |
| | | QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper(); |
| | |
| | | item.setId(UUID.randomUUID().toString()); |
| | | }); |
| | | mmModelArithSettingsDao.insertList(list); |
| | | } |
| | | |
| | | public List<MmModelArithSettingsEntity> getByModelid(String modelid) { |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("modelid", modelid); |
| | | List<MmModelArithSettingsEntity> list = mmModelArithSettingsDao.getMmModelArithSettings(params); |
| | | |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | // 清空缓存 |
| | | modelIdMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmModelArithSettingsEntity> getByModelId(String modelId) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | if (modelIdMap.containsKey(modelId)) { |
| | | return modelIdMap.get(modelId); |
| | | } |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("modelid", modelId); |
| | | return mmModelArithSettingsDao.getMmModelArithSettings(params); |
| | | List<MmModelArithSettingsEntity> list = mmModelArithSettingsDao.getMmModelArithSettings(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | modelIdMap.put(modelId, list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void updatePyFile(String pyModule, String fileName) { |
| | | baseMapper.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")+1),pyModule + "." + fileName); |
| | | } |
| | | } |