| | |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleItemService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | private DmModuleItemDao dmModuleItemDao; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveModuleItem(DmModuleItemEntity moduleItem) { |
| | | moduleItem.setId(UUID.randomUUID().toString()); |
| | | dmModuleItemDao.insert(moduleItem); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(DmModuleItemEntity moduleItem) { |
| | | dmModuleItemDao.updateById(moduleItem); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getModuleIdByItemId(List<String> itemIds) { |
| | | List<String> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(itemIds)) { |
| | | return result; |
| | | } |
| | | QueryWrapper<DmModuleItemEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("itemid", itemIds); |
| | | List<DmModuleItemEntity> list = dmModuleItemDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | list.forEach(item -> result.add(item.getModuleid())); |
| | | return result; |
| | | } |
| | | |
| | | public DmModuleItemEntity getByItemid(String itemid) { |
| | | List<DmModuleItemEntity> list = dmModuleItemDao.selectList(new QueryWrapper<DmModuleItemEntity>().in("itemid", itemid)); |
| | | if (CollectionUtils.isEmpty(list)) { |