package com.meas.system.service.impl;

import com.meas.common.utils.DateUtils;
import com.meas.system.domain.MeasBatch;
import com.meas.system.mapper.MeasBatchMapper;
import com.meas.system.service.IMeasBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 测量批次Service业务层处理
 *
 * @author wgk
 * @date 2024-06-13
 */
@Service
public class MeasBatchServiceImpl implements IMeasBatchService {
    @Autowired
    private MeasBatchMapper measBatchMapper;

    /**
     * 查询测量批次
     *
     * @param id 测量批次主键
     * @return 测量批次
     */
    @Override
    public MeasBatch selectMeasBatchById(Long id) {
        return measBatchMapper.selectMeasBatchById(id);
    }

    /**
     * 查询测量批次列表
     *
     * @param measBatch 测量批次
     * @return 测量批次
     */
    @Override
    public List<MeasBatch> selectMeasBatchList(MeasBatch measBatch) {
        return measBatchMapper.selectMeasBatchList(measBatch);
    }

    /**
     * 新增测量批次
     *
     * @param measBatch 测量批次
     * @return 结果
     */
    @Override
    public int insertMeasBatch(MeasBatch measBatch) {
        measBatch.setCreateTime(DateUtils.getNowDate());
        return measBatchMapper.insertMeasBatch(measBatch);
    }

    /**
     * 修改测量批次
     *
     * @param measBatch 测量批次
     * @return 结果
     */
    @Override
    public int updateMeasBatch(MeasBatch measBatch) {
        measBatch.setUpdateTime(DateUtils.getNowDate());
        return measBatchMapper.updateMeasBatch(measBatch);
    }

    /**
     * 批量删除测量批次
     *
     * @param ids 需要删除的测量批次主键
     * @return 结果
     */
    @Override
    public int deleteMeasBatchByIds(Long[] ids) {
        return measBatchMapper.deleteMeasBatchByIds(ids);
    }

    /**
     * 删除测量批次信息
     *
     * @param id 测量批次主键
     * @return 结果
     */
    @Override
    public int deleteMeasBatchById(Long id) {
        return measBatchMapper.deleteMeasBatchById(id);
    }

    @Override
    public List<Map> getOption(Long engineId) {
        return measBatchMapper.getOption(engineId);
    }
}
