| | |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.collection.CollectionUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemTypeDao; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<MmItemTypeEntity> list(Map<String, Object> params) { |
| | | return Collections.emptyList(); |
| | | return mmItemTypeDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | } |