package com.ruoyi.manage.service.impl;

import java.util.List;


import com.ruoyi.manage.mapper.RecordInspectionInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.RecordInspectionMapper;
import com.ruoyi.manage.domain.RecordInspection;
import com.ruoyi.manage.service.IRecordInspectionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 巡检记录Service业务层处理
 *
 * @author wangh
 * @date 2024-02-18
 */
@Service
public class RecordInspectionServiceImpl implements IRecordInspectionService {
    @Autowired
    private RecordInspectionMapper recordInspectionMapper;

    /**
     * 查询巡检记录
     *
     * @param inspectionId 巡检记录主键
     * @return 巡检记录
     */
    @Override
    public RecordInspection selectRecordInspectionByInspectionId(Long inspectionId) {
        return recordInspectionMapper.selectRecordInspectionByInspectionId(inspectionId);
    }

    /**
     * 查询巡检记录列表
     *
     * @param recordInspection 巡检记录
     * @return 巡检记录
     */
    @Override
    public List<RecordInspection> selectRecordInspectionList(RecordInspection recordInspection) {
        return recordInspectionMapper.selectRecordInspectionList(recordInspection);
    }

    /**
     * 新增巡检记录
     *
     * @param recordInspection 巡检记录
     * @return 结果
     */
    @Override
    public int insertRecordInspection(RecordInspection recordInspection) {
            return recordInspectionMapper.insertRecordInspection(recordInspection);
    }

    /**
     * 修改巡检记录
     *
     * @param recordInspection 巡检记录
     * @return 结果
     */
    @Override
    public int updateRecordInspection(RecordInspection recordInspection) {
        return recordInspectionMapper.updateRecordInspection(recordInspection);
    }

    /**
     * 批量删除巡检记录
     *
     * @param inspectionIds 需要删除的巡检记录主键
     * @return 结果
     */
    @Autowired
    private RecordInspectionInfoMapper infoMapper;
    @Override
    public int deleteRecordInspectionByInspectionIds(String inspectionIds) {
        String[] inspectionIds1 = Convert.toStrArray(inspectionIds);
        infoMapper.deleteRecordInspectionInfoByInspectionIds(inspectionIds1);
        return recordInspectionMapper.deleteRecordInspectionByInspectionIds(inspectionIds1);
    }

    /**
     * 删除巡检记录信息
     *
     * @param inspectionId 巡检记录主键
     * @return 结果
     */
    @Override
    public int deleteRecordInspectionByInspectionId(Long inspectionId) {
        infoMapper.deleteRecordInspectionInfoByInspectionId(inspectionId);
        return recordInspectionMapper.deleteRecordInspectionByInspectionId(inspectionId);
    }
}
