package com.hw.dms.mapper;

import java.util.List;
import com.hw.dms.domain.DmsBillsFaultInstance;
import org.apache.ibatis.annotations.Param;

/**
 * 检修工单Mapper接口
 *
 * @author Open Platform
 * @date 2024-01-23
 */
public interface DmsBillsFaultInstanceMapper
{
    /**
     * 查询检修工单
     *
     * @param repairInstanceId 检修工单主键
     * @return 检修工单
     */
    public DmsBillsFaultInstance selectDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId);

    /**
     * 查询检修工单列表
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 检修工单集合
     */
    public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceList(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 新增检修工单
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 结果
     */
    public int insertDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 修改检修工单
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 结果
     */
    public int updateDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 删除检修工单
     *
     * @param repairInstanceId 检修工单主键
     * @return 结果
     */
    public int deleteDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId);

    /**
     * 批量删除检修工单
     *
     * @param repairInstanceIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteDmsBillsFaultInstanceByRepairInstanceIds(Long[] repairInstanceIds);

    public Long selectProcessActivityId(Long wfProcessId);


    /**
     * 查询检修工单列表
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 检修工单集合
     */
    public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceJoinList(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 查询检修工单,Join device,Join 第一步骤dms_fault_instance_activiy
     *
     * @param repairInstanceId 检修工单主键
     * @return 检修工单
     */
    public DmsBillsFaultInstance selectFaultInstanceJoinFirstAndDeviceById(Long repairInstanceId);

    /**
     * 查询检修工单,Join device,Join 所有步骤的dms_fault_instance_activiy
     *
     * @param repairInstanceId 检修工单主键
     * @return 检修工单
     */
    public DmsBillsFaultInstance selectFaultInstanceJoinActivityByRepairInstanceId(Long repairInstanceId);


    public Long selectCountByRepairInstanceIdAndDeviceCode(@Param("repairInstanceId") Long repairInstanceId,
                                                           @Param("deviceCode") String deviceCode);


    /**
     * 查询检修工单,Join 第一步骤dms_fault_instance_activiy
     *
     * @param repairInstanceId 检修工单主键
     * @return 检修工单
     */
    public DmsBillsFaultInstance selectFaultInstanceJoinFirstById(Long repairInstanceId);
}


