package com.ruoyi.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BpmNodeScriptRelevanceMapper;
import com.ruoyi.system.entity.BpmNodeScriptRelevance;
import com.ruoyi.system.service.IBpmNodeScriptRelevanceService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 流程节点脚本关联Service业务层处理
 *
 * @author hzh
 * @date 2023-10-26
 */
@Service
public class BpmNodeScriptRelevanceServiceImpl implements IBpmNodeScriptRelevanceService {

    @Autowired
    private BpmNodeScriptRelevanceMapper bpmNodeScriptRelevanceMapper;

    /**
     * 查询流程节点脚本关联
     *
     * @param id 流程节点脚本关联主键
     * @return 流程节点脚本关联
     */
    @Override
    public BpmNodeScriptRelevance selectBpmNodeScriptRelevanceById(Long id) {
        return bpmNodeScriptRelevanceMapper.selectBpmNodeScriptRelevanceById(id);
    }

    /**
     * 查询流程节点脚本关联列表
     *
     * @param bpmNodeScriptRelevance 流程节点脚本关联
     * @return 流程节点脚本关联
     */
    @Override
    public List<BpmNodeScriptRelevance> selectBpmNodeScriptRelevanceList(BpmNodeScriptRelevance bpmNodeScriptRelevance) {
        return bpmNodeScriptRelevanceMapper.selectBpmNodeScriptRelevanceList(bpmNodeScriptRelevance);
    }

    /**
     * 新增流程节点脚本关联
     *
     * @param bpmNodeScriptRelevance 流程节点脚本关联
     * @return 结果
     */
    @Override
    @Transactional
    public int insertBpmNodeScriptRelevance(List<BpmNodeScriptRelevance> bpmNodeScriptRelevance) {
        return bpmNodeScriptRelevanceMapper.insertBpmNodeScriptRelevance(bpmNodeScriptRelevance);
    }

    /**
     * 修改流程节点脚本关联
     *
     * @param bpmNodeScriptRelevance 流程节点脚本关联
     * @return 结果
     */
    @Override
    public int updateBpmNodeScriptRelevance(List<BpmNodeScriptRelevance> bpmNodeScriptRelevance) {
        bpmNodeScriptRelevance.forEach(item -> {
            bpmNodeScriptRelevanceMapper.updateBpmNodeScriptRelevance(item);
        });
        return 1;
    }

    /**
     * 批量删除流程节点脚本关联
     *
     * @param ids 需要删除的流程节点脚本关联主键
     * @return 结果
     */
    @Override
    public int deleteBpmNodeScriptRelevanceByIds(Long[] ids) {
        return bpmNodeScriptRelevanceMapper.deleteBpmNodeScriptRelevanceByIds(ids);
    }

    /**
     * 删除流程节点脚本关联信息
     *
     * @param id 流程节点脚本关联主键
     * @return 结果
     */
    @Override
    public int deleteBpmNodeScriptRelevanceById(Long id) {
        return bpmNodeScriptRelevanceMapper.deleteBpmNodeScriptRelevanceById(id);
    }
}
