| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | |
| | | @Autowired |
| | | private MmItemTypeDao mmItemTypeDao; |
| | | |
| | | private Map<String, MmItemTypeEntity> typeIdMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Override |
| | | public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) { |
| | |
| | | public void saveItemType(MmItemTypeEntity itemType) { |
| | | itemType.setId(UUID.randomUUID().toString()); |
| | | mmItemTypeDao.insert(itemType); |
| | | typeIdMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public void update(MmItemTypeEntity itemType) { |
| | | mmItemTypeDao.updateById(itemType); |
| | | typeIdMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteBatch(String[] moduleIds) { |
| | | mmItemTypeDao.deleteBatchIds(Arrays.asList(moduleIds)); |
| | | typeIdMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public MmItemTypeEntity getItemTypeByItemId(String itemId) { |
| | | if (typeIdMap.containsKey(itemId)) { |
| | | return typeIdMap.get(itemId); |
| | | } |
| | | List<MmItemTypeEntity> list = mmItemTypeDao.getItemTypeByItemId(itemId); |
| | | if (CollectionUtils.isAnyEmpty(list)) { |
| | | return null; |
| | | } |
| | | typeIdMap.put(itemId, list.get(0)); |
| | | return list.get(0); |
| | | } |
| | | |