package com.zd.laboratory.service.impl;

import com.zd.common.core.utils.DateUtils;
import com.zd.laboratory.domain.LabRiskPlanSensorRelation;
import com.zd.laboratory.mapper.LabRiskPlanSensorRelationMapper;
import com.zd.laboratory.service.ILabRiskPlanSensorRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 风险管理和传感器关联Service业务层处理
 *
 * @author zd
 * @date 2021-09-03
 */
@Service
public class LabRiskPlanSensorRelationServiceImpl implements ILabRiskPlanSensorRelationService {
    @Autowired
    private LabRiskPlanSensorRelationMapper labRiskPlanSensorRelationMapper;

    /**
     * 查询风险管理和传感器关联
     *
     * @param id 风险管理和传感器关联主键
     * @return 风险管理和传感器关联
     */
    @Override
    public LabRiskPlanSensorRelation selectLabRiskPlanSensorRelationById(Long id) {
        return labRiskPlanSensorRelationMapper.selectLabRiskPlanSensorRelationById(id);
    }

    /**
     * 查询风险管理和传感器关联列表
     *
     * @param labRiskPlanSensorRelation 风险管理和传感器关联
     * @return 风险管理和传感器关联
     */
    @Override
    public List<LabRiskPlanSensorRelation> selectLabRiskPlanSensorRelationList(LabRiskPlanSensorRelation labRiskPlanSensorRelation) {
        return labRiskPlanSensorRelationMapper.selectLabRiskPlanSensorRelationList(labRiskPlanSensorRelation);
    }

    /**
     * 新增风险管理和传感器关联
     *
     * @param labRiskPlanSensorRelation 风险管理和传感器关联
     * @return 结果
     */
    @Override
    public int insertLabRiskPlanSensorRelation(LabRiskPlanSensorRelation labRiskPlanSensorRelation) {
        labRiskPlanSensorRelation.setCreateTime(DateUtils.getNowDate());
        return labRiskPlanSensorRelationMapper.insertLabRiskPlanSensorRelation(labRiskPlanSensorRelation);
    }

    /**
     * 修改风险管理和传感器关联
     *
     * @param labRiskPlanSensorRelation 风险管理和传感器关联
     * @return 结果
     */
    @Override
    public int updateLabRiskPlanSensorRelation(LabRiskPlanSensorRelation labRiskPlanSensorRelation) {
        return labRiskPlanSensorRelationMapper.updateLabRiskPlanSensorRelation(labRiskPlanSensorRelation);
    }

    /**
     * 批量删除风险管理和传感器关联
     *
     * @param ids 需要删除的风险管理和传感器关联主键
     * @return 结果
     */
    @Override
    public int deleteLabRiskPlanSensorRelationByIds(Long[] ids) {
        return labRiskPlanSensorRelationMapper.deleteLabRiskPlanSensorRelationByIds(ids);
    }

    /**
     * 删除风险管理和传感器关联信息
     *
     * @param id 风险管理和传感器关联主键
     * @return 结果
     */
    @Override
    public int deleteLabRiskPlanSensorRelationById(Long id) {
        return labRiskPlanSensorRelationMapper.deleteLabRiskPlanSensorRelationById(id);
    }
}
