package com.meas.system.service.impl;

import com.meas.common.utils.DateUtils;
import com.meas.system.domain.MeasThermalImagerTestData;
import com.meas.system.mapper.MeasThermalImagerTestDataMapper;
import com.meas.system.service.IMeasThermalImagerTestDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 热像仪测试数据Service业务层处理
 *
 * @author wgk
 * @date 2024-06-13
 */
@Service
public class MeasThermalImagerTestDataServiceImpl implements IMeasThermalImagerTestDataService {
    @Autowired
    private MeasThermalImagerTestDataMapper measThermalImagerTestDataMapper;

    /**
     * 查询热像仪测试数据
     *
     * @param id 热像仪测试数据主键
     * @return 热像仪测试数据
     */
    @Override
    public MeasThermalImagerTestData selectMeasThermalImagerTestDataById(Long id) {
        return measThermalImagerTestDataMapper.selectMeasThermalImagerTestDataById(id);
    }

    /**
     * 查询热像仪测试数据列表
     *
     * @param measThermalImagerTestData 热像仪测试数据
     * @return 热像仪测试数据
     */
    @Override
    public List<MeasThermalImagerTestData> selectMeasThermalImagerTestDataList(MeasThermalImagerTestData measThermalImagerTestData) {
        return measThermalImagerTestDataMapper.selectMeasThermalImagerTestDataList(measThermalImagerTestData);
    }

    /**
     * 新增热像仪测试数据
     *
     * @param measThermalImagerTestData 热像仪测试数据
     * @return 结果
     */
    @Override
    public MeasThermalImagerTestData insertMeasThermalImagerTestData(MeasThermalImagerTestData measThermalImagerTestData) {
        measThermalImagerTestData.setCreateTime(DateUtils.getNowDate());
        int i = measThermalImagerTestDataMapper.insertMeasThermalImagerTestData(measThermalImagerTestData);
        if (i > 0) {
            return measThermalImagerTestData;
        } else {
            return null;
        }
    }

    /**
     * 修改热像仪测试数据
     *
     * @param measThermalImagerTestData 热像仪测试数据
     * @return 结果
     */
    @Override
    public int updateMeasThermalImagerTestData(MeasThermalImagerTestData measThermalImagerTestData) {
        measThermalImagerTestData.setUpdateTime(DateUtils.getNowDate());
        return measThermalImagerTestDataMapper.updateMeasThermalImagerTestData(measThermalImagerTestData);
    }

    /**
     * 批量删除热像仪测试数据
     *
     * @param ids 需要删除的热像仪测试数据主键
     * @return 结果
     */
    @Override
    public int deleteMeasThermalImagerTestDataByIds(Long[] ids) {
        return measThermalImagerTestDataMapper.deleteMeasThermalImagerTestDataByIds(ids);
    }

    /**
     * 删除热像仪测试数据信息
     *
     * @param id 热像仪测试数据主键
     * @return 结果
     */
    @Override
    public int deleteMeasThermalImagerTestDataById(Long id) {
        return measThermalImagerTestDataMapper.deleteMeasThermalImagerTestDataById(id);
    }

    @Override
    public MeasThermalImagerTestData selectResultsByEnvDataId(Long envDataId) {
        return measThermalImagerTestDataMapper.selectResultsByEnvDataId(envDataId);
    }
}
