package com.zd.chemical.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zd.chemical.mapper.ActApplytaskNodeMapper;
import com.zd.chemical.domain.ActApplytaskNode;
import com.zd.chemical.service.IActApplytaskNodeService;

/**
 * 化学品申购任务节点Service业务层处理
 *
 * @author zd
 * @date 2022-08-17
 */
@Service
public class ActApplytaskNodeServiceImpl implements IActApplytaskNodeService
{
    @Autowired
    private ActApplytaskNodeMapper actApplytaskNodeMapper;

    /**
     * 查询化学品申购任务节点
     *
     * @param id 化学品申购任务节点主键
     * @return 化学品申购任务节点
     */
    @Override
    public ActApplytaskNode selectActApplytaskNodeById(Long id)
    {
        return actApplytaskNodeMapper.selectActApplytaskNodeById(id);
    }

    /**
     * 查询化学品申购任务节点列表
     *
     * @param actApplytaskNode 化学品申购任务节点
     * @return 化学品申购任务节点
     */
    @Override
    public List<ActApplytaskNode> selectActApplytaskNodeList(ActApplytaskNode actApplytaskNode)
    {
        return actApplytaskNodeMapper.selectActApplytaskNodeList(actApplytaskNode);
    }

    @Override
    public List<ActApplytaskNode> getListByIds(List<Long> ids){
        if (ids.isEmpty()){
            new ArrayList <>();
        }
        return actApplytaskNodeMapper.getListByIds(ids);
    }

    /**
     * 新增化学品申购任务节点
     *
     * @param actApplytaskNode 化学品申购任务节点
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertActApplytaskNode(ActApplytaskNode actApplytaskNode)
    {
        return actApplytaskNodeMapper.insertActApplytaskNode(actApplytaskNode);
    }

    /**
     * 修改化学品申购任务节点
     *
     * @param actApplytaskNode 化学品申购任务节点
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateActApplytaskNode(ActApplytaskNode actApplytaskNode)
    {
        return actApplytaskNodeMapper.updateActApplytaskNode(actApplytaskNode);
    }

    /**
     * 批量删除化学品申购任务节点
     *
     * @param ids 需要删除的化学品申购任务节点主键
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteActApplytaskNodeByIds(Long[] ids)
    {
        return actApplytaskNodeMapper.deleteActApplytaskNodeByIds(ids);
    }

    /**
     * 删除化学品申购任务节点信息
     *
     * @param id 化学品申购任务节点主键
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteActApplytaskNodeById(Long id)
    {
        return actApplytaskNodeMapper.deleteActApplytaskNodeById(id);
    }
}
