package com.ktg.iscs.service.impl;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ktg.common.core.text.Convert;
import com.ktg.common.utils.DateUtils;
import com.ktg.iscs.domain.IsSopPoints;
import com.ktg.iscs.mapper.IsSopPointsMapper;
import com.ktg.iscs.service.IIsSopPointsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * SOP隔离点Service业务层处理
 *
 * @author cgj
 * @date 2024-10-18
 */
@Service
public class IsSopPointsServiceImpl extends ServiceImpl<IsSopPointsMapper, IsSopPoints> implements IIsSopPointsService
{
    @Autowired
    private IsSopPointsMapper isSopPointsMapper;

    /**
     * 查询SOP隔离点
     *
     * @param recordId SOP隔离点主键
     * @return SOP隔离点
     */
    @Override
    public IsSopPoints selectIsSopPointsByRecordId(Long recordId)
    {
        return isSopPointsMapper.selectIsSopPointsByRecordId(recordId);
    }

    /**
     * 查询SOP隔离点列表
     *
     * @param isSopPoints SOP隔离点
     * @return SOP隔离点
     */
    @Override
    public List<IsSopPoints> selectIsSopPointsList(IsSopPoints isSopPoints)
    {
        return isSopPointsMapper.selectIsSopPointsList(isSopPoints);
    }

    /**
     * 新增SOP隔离点
     *
     * @param isSopPoints SOP隔离点
     * @return 结果
     */
    @Override
    public int insertIsSopPoints(IsSopPoints isSopPoints)
    {
        isSopPoints.setCreateTime(DateUtils.getNowDate());
        return isSopPointsMapper.insertIsSopPoints(isSopPoints);
    }

    /**
     * 修改SOP隔离点
     *
     * @param isSopPoints SOP隔离点
     * @return 结果
     */
    @Override
    public int updateIsSopPoints(IsSopPoints isSopPoints)
    {
        isSopPoints.setUpdateTime(DateUtils.getNowDate());
        return isSopPointsMapper.updateIsSopPoints(isSopPoints);
    }

    /**
     * 批量删除SOP隔离点
     *
     * @param recordIds 需要删除的SOP隔离点主键
     * @return 结果
     */
    @Override
    public int deleteIsSopPointsByRecordIds(String recordIds)
    {
        Assert.notBlank(recordIds, "请选择需要删除的数据!");
        Long[] longIds = Convert.toLongArray(recordIds);
        return isSopPointsMapper.deleteIsSopPointsByRecordIds(longIds);
    }

    /**
     * 删除SOP隔离点信息
     *
     * @param recordId SOP隔离点主键
     * @return 结果
     */
    @Override
    public int deleteIsSopPointsByRecordId(Long recordId)
    {
        return isSopPointsMapper.deleteIsSopPointsByRecordId(recordId);
    }
}
