package com.sundot.airport.system.service.approval.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sundot.airport.system.mapper.approval.ApprovalWorkflowDefinitionMapper;
import com.sundot.airport.system.domain.approval.ApprovalWorkflowDefinition;
import com.sundot.airport.system.service.approval.IApprovalWorkflowService;

/**
 * 审批流程定义Service业务层处理
 *
 * @author simon lin
 * @date 2025-09-06
 */
@Service
public class ApprovalWorkflowServiceImpl implements IApprovalWorkflowService {
    @Autowired
    private ApprovalWorkflowDefinitionMapper approvalWorkflowDefinitionMapper;

    /**
     * 查询审批流程定义
     *
     * @param id 审批流程定义主键
     * @return 审批流程定义
     */
    @Override
    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionById(Long id) {
        return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionById(id);
    }

    /**
     * 根据流程代码查询审批流程定义
     *
     * @param workflowCode 流程代码
     * @return 审批流程定义
     */
    @Override
    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionByCode(String workflowCode) {
        return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionByCode(workflowCode);
    }

    /**
     * 根据流程类型查询审批流程定义列表
     *
     * @param workflowType 流程类型
     * @return 审批流程定义列表
     */
    @Override
    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionByType(String workflowType) {
        return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionByType(workflowType);
    }

    /**
     * 查询审批流程定义列表
     *
     * @param approvalWorkflowDefinition 审批流程定义
     * @return 审批流程定义
     */
    @Override
    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionList(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
        return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionList(approvalWorkflowDefinition);
    }

    /**
     * 新增审批流程定义
     *
     * @param approvalWorkflowDefinition 审批流程定义
     * @return 结果
     */
    @Override
    public int insertApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
        return approvalWorkflowDefinitionMapper.insertApprovalWorkflowDefinition(approvalWorkflowDefinition);
    }

    /**
     * 修改审批流程定义
     *
     * @param approvalWorkflowDefinition 审批流程定义
     * @return 结果
     */
    @Override
    public int updateApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
        return approvalWorkflowDefinitionMapper.updateApprovalWorkflowDefinition(approvalWorkflowDefinition);
    }

    /**
     * 批量删除审批流程定义
     *
     * @param ids 需要删除的审批流程定义主键
     * @return 结果
     */
    @Override
    public int deleteApprovalWorkflowDefinitionByIds(Long[] ids) {
        return approvalWorkflowDefinitionMapper.deleteApprovalWorkflowDefinitionByIds(ids);
    }

    /**
     * 删除审批流程定义信息
     *
     * @param id 审批流程定义主键
     * @return 结果
     */
    @Override
    public int deleteApprovalWorkflowDefinitionById(Long id) {
        return approvalWorkflowDefinitionMapper.deleteApprovalWorkflowDefinitionById(id);
    }
}