package com.aucma.dms.mapper;

import com.aucma.dms.domain.DmsBillsInspectInstance;
import com.aucma.dms.domain.DmsRecordInspect;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 巡检工单Mapper接口
 *
 * @author Open Platform
 * @date 2024-01-23
 */
public interface DmsBillsInspectInstanceMapper
{
    /**
     * 查询巡检工单
     *
     * @param inspectInstanceId 巡检工单主键
     * @return 巡检工单
     */
    public DmsBillsInspectInstance selectDmsBillsInspectInstanceByInspectInstanceId(@Param("inspectInstanceId") Long inspectInstanceId);
    public List<DmsBillsInspectInstance> selectPoint();
    public List<DmsBillsInspectInstance> selectInspection();
    /**
     * 查询巡检工单列表
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 巡检工单集合
     */
    public List<DmsBillsInspectInstance> selectDmsBillsInspectInstanceList(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 新增巡检工单
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 结果
     */
    public int insertDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 修改巡检工单
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 结果
     */
    public int updateDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 删除巡检工单
     *
     * @param inspectInstanceId 巡检工单主键
     * @return 结果
     */
    public int deleteDmsBillsInspectInstanceByInspectInstanceId(@Param("inspectInstanceId") Long inspectInstanceId);

    /**
     * 批量删除巡检工单
     *
     * @param inspectInstanceIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteDmsBillsInspectInstanceByInspectInstanceIds(@Param("inspectInstanceIds") Long[] inspectInstanceIds);

    int insertDmsBillsInspectInstancePDA(DmsBillsInspectInstance dmsBillsInspectInstance);


    /**
     * 查询最新一条巡检工单列表
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 巡检工单
     */
    public DmsBillsInspectInstance selectNewestDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);


    DmsRecordInspect selectRecord(@Param("instanceDetailId") Long instanceDetailId);

    int insertRecord(DmsRecordInspect dmsRecordInspect);

    List<DmsRecordInspect> selectRecordByInstainceId(@Param("inspectInstanceId") Long inspectInstanceId);

    int selectUnCompletedInstance(@Param("inspectInstanceId") Long inspectInstanceId);

    int selectAllInstance(@Param("inspectInstanceId")Long inspectInstanceId);

    /**
     * 检查指定计划今天是否已生成工单
     * @param planInspectId 计划ID
     * @return 工单数量
     */
    int countByPlanIdAndToday(@Param("planInspectId") Long planInspectId);

    /**
     * 获取数据库当前时间（SYSDATE）
     */
    Date selectDbNow();
}
