package com.pm.topology.service.impl;

import java.util.List;
import com.pm.common.utils.DateUtils;
import com.pm.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pm.topology.mapper.ItemTopologyMapper;
import com.pm.topology.service.IItemTopologyService;
import com.pm.common.config.PageData;

/**
 * 项目拓扑Service业务层处理
 *
 * @author pm
 * @date 2025-04-24
 */
@Service
public class ItemTopologyServiceImpl implements IItemTopologyService
{
    @Autowired
    private ItemTopologyMapper itemTopologyMapper;

    /**
     * 查询项目拓扑
     *
     * @param itemId 项目拓扑主键
     * @return 项目拓扑
     */
    @Override
    public PageData selectItemTopologyByItemId(String itemId)
    {
        return itemTopologyMapper.selectItemTopologyByItemId(itemId);
    }

    /**
     * 查询项目拓扑列表
     *
     * @param pd
     * @return 项目拓扑
     */
    @Override
    public List<PageData> selectItemTopologyList(PageData pd)
    {
        List<PageData> list = itemTopologyMapper.selectItemTopologyList(pd);

        return list;
    }

    /**
     * 新增项目拓扑
     *
     * @param pd
     * @return 结果
     */
    @Override
    public int insertItemTopology(PageData pd)
    {
        pd.put("createTime", DateUtils.getTime());
        pd.put("itemId", System.nanoTime());

        return itemTopologyMapper.insertItemTopology(pd);
    }

    /**
     * 修改项目拓扑
     *
     * @param pd
     * @return 结果
     */
    @Override
    public int updateItemTopology(PageData pd)
    {
        pd.put("updateTime", DateUtils.getTime());
        return itemTopologyMapper.updateItemTopology(pd);
    }

    /**
     * 批量删除项目拓扑
     *
     * @param itemIds 需要删除的项目拓扑主键
     * @return 结果
     */
    @Override
    public int deleteItemTopologyByItemIds(Long[] itemIds)
    {
        return itemTopologyMapper.deleteItemTopologyByItemIds(itemIds);
    }

    /**
     * 删除项目拓扑信息
     *
     * @param itemId 项目拓扑主键
     * @return 结果
     */
    @Override
    public int deleteItemTopologyByItemId(Long itemId)
    {
        return itemTopologyMapper.deleteItemTopologyByItemId(itemId);
    }
}
