package com.testor.module.hazard.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.module.hazard.model.domain.THazardWorkPlanCheck;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.tongtech.tfw.backend.common.models.supers.SuperDao;
import com.tongtech.tfw.workflow.apis.task.model.dto.TodoTask;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 危险作业计划监督检查Mapper接口
 *
 * @author testor-framework
 * @date 2025-04-16 10:09:22
 */
public interface THazardWorkPlanCheckDao extends SuperDao<THazardWorkPlanCheck> {

    /**
     * 查询危险作业计划监督检查列表
     *
     * @param tHazardWorkPlanCheckParam 危险作业计划监督检查主键
     * @return 危险作业计划监督检查
     */
    Page<THazardWorkPlanCheck> selectTHazardWorkPlanCheckList(IPage page, @Param("param") THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);

    /**
     * App查询危险作业计划监督检查列表
     *
     * @param tHazardWorkPlanCheckParam 危险作业计划监督检查主键
     * @return 危险作业计划监督检查
     */
    Page<THazardWorkPlanCheck> selectAppTHazardWorkPlanCheckList(IPage page, @Param("param") THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);

    /**
     * 查询危险作业计划监督检查详情
     * @param id
     * @return
     */
    THazardWorkPlanCheck detail(String id);

    /**
     * 查询危险计划下的监督检查数量
     * @param planId
     * @return
     */
    @Select("select count(1) from t_hazard_work_plan_check\n" +
            "where plan_id = #{planId} and status ='0'")
    Integer countByPlanId(String planId);
}
