package com.zd.laboratory.service.impl;

import java.util.List;
import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.security.utils.SaveUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.laboratory.mapper.LabQpSubjectRelationMapper;
import com.zd.laboratory.domain.LabQpSubjectRelation;
import com.zd.laboratory.service.ILabQpSubjectRelationService;

/**
 * 气瓶和实验室关联Service业务层处理
 * 
 * @author zd
 * @date 2022-05-17
 */
@Service
public class LabQpSubjectRelationServiceImpl implements ILabQpSubjectRelationService 
{
    @Autowired
    private LabQpSubjectRelationMapper labQpSubjectRelationMapper;

    /**
     * 查询气瓶和实验室关联
     * 
     * @param id 气瓶和实验室关联主键
     * @return 气瓶和实验室关联
     */
    @Override
    public LabQpSubjectRelation selectLabQpSubjectRelationById(Long id)
    {
        return labQpSubjectRelationMapper.selectLabQpSubjectRelationById(id);
    }

    /**
     * 查询气瓶和实验室关联列表
     * 
     * @param labQpSubjectRelation 气瓶和实验室关联
     * @return 气瓶和实验室关联
     */
    @Override
    public List<LabQpSubjectRelation> selectLabQpSubjectRelationList(LabQpSubjectRelation labQpSubjectRelation)
    {
        return labQpSubjectRelationMapper.selectLabQpSubjectRelationList(labQpSubjectRelation);
    }

    /**
     * 新增气瓶和实验室关联
     * 
     * @param labQpSubjectRelation 气瓶和实验室关联
     * @return 结果
     */
    @Override
    public int insertLabQpSubjectRelation(LabQpSubjectRelation labQpSubjectRelation)
    {
        //设置其他公共字段
        SaveUtil.setCommonAttr(labQpSubjectRelation);
        return labQpSubjectRelationMapper.insertLabQpSubjectRelation(labQpSubjectRelation);
    }

    /**
     * 修改气瓶和实验室关联
     * 
     * @param labQpSubjectRelation 气瓶和实验室关联
     * @return 结果
     */
    @Override
    public int updateLabQpSubjectRelation(LabQpSubjectRelation labQpSubjectRelation)
    {
        labQpSubjectRelation.setUpdateTime(DateUtils.getNowDate());
        labQpSubjectRelation.setUpdateBy(SecurityUtils.getUsername());
        return labQpSubjectRelationMapper.updateLabQpSubjectRelation(labQpSubjectRelation);
    }

    /**
     * 批量删除气瓶和实验室关联
     * 
     * @param ids 需要删除的气瓶和实验室关联主键
     * @return 结果
     */
    @Override
    public int deleteLabQpSubjectRelationByIds(Long[] ids)
    {
        return labQpSubjectRelationMapper.deleteLabQpSubjectRelationByIds(ids);
    }

    /**
     * 删除气瓶和实验室关联信息
     * 
     * @param id 气瓶和实验室关联主键
     * @return 结果
     */
    @Override
    public int deleteLabQpSubjectRelationById(Long id)
    {
        return labQpSubjectRelationMapper.deleteLabQpSubjectRelationById(id);
    }
}
