package com.zd.laboratory.mapper;

import java.util.List;

import com.zd.laboratory.domain.LabHazardSubjectRelation;
import com.zd.laboratory.domain.dto.LabHazardDTO;
import com.zd.system.api.domain.CommonCount;
import org.apache.ibatis.annotations.Param;

/**
 * 危险源和实验室关联Mapper接口
 *
 * @author zd
 * @date 2021-09-01
 */
public interface LabHazardSubjectRelationMapper {
    /**
     * 查询危险源和实验室关联
     *
     * @param id 危险源和实验室关联主键
     * @return 危险源和实验室关联
     */
    public LabHazardSubjectRelation selectLabHazardSubjectRelationById(Long id);

    /**
     * 查询危险源和实验室关联列表
     *
     * @param labHazardSubjectRelation 危险源和实验室关联
     * @return 危险源和实验室关联集合
     */
    public List<LabHazardSubjectRelation> selectLabHazardSubjectRelationList(LabHazardSubjectRelation labHazardSubjectRelation);


    /**
     * 查询实验室危险品数量
     * @param ids
     * @return
     */
    public List<CommonCount> queryCountBySubIds(Long... ids);
    /**
     * 新增危险源和实验室关联
     *
     * @param labHazardSubjectRelation 危险源和实验室关联
     * @return 结果
     */
    public int insertLabHazardSubjectRelation(LabHazardSubjectRelation labHazardSubjectRelation);

    /**
     * 修改危险源和实验室关联
     *
     * @param labHazardSubjectRelation 危险源和实验室关联
     * @return 结果
     */
    public int updateLabHazardSubjectRelation(LabHazardSubjectRelation labHazardSubjectRelation);

    /**
     * 删除危险源和实验室关联
     *
     * @param id 危险源和实验室关联主键
     * @return 结果
     */
    public int deleteLabHazardSubjectRelationById(Long id);

    /**
     * 批量删除危险源和实验室关联
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteLabHazardSubjectRelationByIds(Long[] ids);

    /**
     * 批量删除危险源和实验室关联-指定实验室
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSubLabHazardSubjectRelationByIds(@Param("ids") Long[] ids, @Param("subId") Long subId);

    /**
     * @param labHazard
     * @return
     */
    List<LabHazardSubjectRelation> queryLabByHazardId(LabHazardDTO labHazard);

    int insertOrUpdateBatch(@Param("entities") List<LabHazardSubjectRelation> entities);

    List<LabHazardSubjectRelation> queryBySubjectId(Long subjectId);

    String queryChNameByHazardId(String hazardId);

    int deleteBySubId(Long subId);
}
