package com.xinelu.manage.service.scriptinfonode.impl;

import com.xinelu.manage.domain.scriptinfonode.ScriptInfoNode;
import com.xinelu.manage.mapper.scriptinfonode.ScriptInfoNodeMapper;
import com.xinelu.manage.service.scriptinfonode.IScriptInfoNodeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 话术信息节点Service业务层处理
 *
 * @author xinelu
 * @date 2024-06-12
 */
@Service
public class ScriptInfoNodeServiceImpl implements IScriptInfoNodeService {
    @Resource
    private ScriptInfoNodeMapper scriptInfoNodeMapper;

    /**
     * 查询话术信息节点
     *
     * @param id 话术信息节点主键
     * @return 话术信息节点
     */
    @Override
    public ScriptInfoNode selectScriptInfoNodeById(Long id) {
        return scriptInfoNodeMapper.selectScriptInfoNodeById(id);
    }

    /**
     * 查询话术信息节点列表
     *
     * @param scriptInfoNode 话术信息节点
     * @return 话术信息节点
     */
    @Override
    public List<ScriptInfoNode> selectScriptInfoNodeList(ScriptInfoNode scriptInfoNode) {
        return scriptInfoNodeMapper.selectScriptInfoNodeList(scriptInfoNode);
    }

    /**
     * 新增话术信息节点
     *
     * @param scriptInfoNode 话术信息节点
     * @return 结果
     */
    @Override
    public int insertScriptInfoNode(ScriptInfoNode scriptInfoNode) {
        scriptInfoNode.setCreateTime(LocalDateTime.now());
        return scriptInfoNodeMapper.insertScriptInfoNode(scriptInfoNode);
    }

    /**
     * 修改话术信息节点
     *
     * @param scriptInfoNode 话术信息节点
     * @return 结果
     */
    @Override
    public int updateScriptInfoNode(ScriptInfoNode scriptInfoNode) {
        scriptInfoNode.setUpdateTime(LocalDateTime.now());
        return scriptInfoNodeMapper.updateScriptInfoNode(scriptInfoNode);
    }

    /**
     * 批量删除话术信息节点
     *
     * @param ids 需要删除的话术信息节点主键
     * @return 结果
     */
    @Override
    public int deleteScriptInfoNodeByIds(Long[] ids) {
        return scriptInfoNodeMapper.deleteScriptInfoNodeByIds(ids);
    }

    /**
     * 删除话术信息节点信息
     *
     * @param id 话术信息节点主键
     * @return 结果
     */
    @Override
    public int deleteScriptInfoNodeById(Long id) {
        return scriptInfoNodeMapper.deleteScriptInfoNodeById(id);
    }
}
