package com.meas.system.service.impl;

import com.meas.common.utils.DateUtils;
import com.meas.system.domain.MeasEngineModel;
import com.meas.system.mapper.MeasEngineModelMapper;
import com.meas.system.service.IMeasEngineModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 发动机型号Service业务层处理
 *
 * @author km
 * @date 2024-06-13
 */
@Service
public class MeasEngineModelServiceImpl implements IMeasEngineModelService {
    @Autowired
    private MeasEngineModelMapper measEngineModelMapper;

    /**
     * 查询发动机型号
     *
     * @param id 发动机型号主键
     * @return 发动机型号
     */
    @Override
    public MeasEngineModel selectMeasEngineModelById(Long id) {
        return measEngineModelMapper.selectMeasEngineModelById(id);
    }

    /**
     * 查询发动机型号列表
     *
     * @param measEngineModel 发动机型号
     * @return 发动机型号
     */
    @Override
    public List<MeasEngineModel> selectMeasEngineModelList(MeasEngineModel measEngineModel) {
        return measEngineModelMapper.selectMeasEngineModelList(measEngineModel);
    }

    /**
     * 新增发动机型号
     *
     * @param measEngineModel 发动机型号
     * @return 结果
     */
    @Override
    public int insertMeasEngineModel(MeasEngineModel measEngineModel) {
        measEngineModel.setCreateTime(DateUtils.getNowDate());
        return measEngineModelMapper.insertMeasEngineModel(measEngineModel);
    }

    /**
     * 修改发动机型号
     *
     * @param measEngineModel 发动机型号
     * @return 结果
     */
    @Override
    public int updateMeasEngineModel(MeasEngineModel measEngineModel) {
        measEngineModel.setUpdateTime(DateUtils.getNowDate());
        return measEngineModelMapper.updateMeasEngineModel(measEngineModel);
    }

    /**
     * 批量删除发动机型号
     *
     * @param ids 需要删除的发动机型号主键
     * @return 结果
     */
    @Override
    public int deleteMeasEngineModelByIds(Long[] ids) {
        return measEngineModelMapper.deleteMeasEngineModelByIds(ids);
    }

    /**
     * 删除发动机型号信息
     *
     * @param id 发动机型号主键
     * @return 结果
     */
    @Override
    public int deleteMeasEngineModelById(Long id) {
        return measEngineModelMapper.deleteMeasEngineModelById(id);
    }

    @Override
    public List<Map> getOption() {
        return measEngineModelMapper.getOption();
    }
}
