package com.ruoyi.bst.softwareVersion.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.softwareVersion.mapper.SoftwareVersionMapper;
import com.ruoyi.bst.softwareVersion.domain.SoftwareVersion;
import com.ruoyi.bst.softwareVersion.domain.SoftwareVersionVO;
import com.ruoyi.bst.softwareVersion.domain.SoftwareVersionQuery;
import com.ruoyi.bst.softwareVersion.service.SoftwareVersionService;

/**
 * 软件版本Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-07
 */
@Service
public class SoftwareVersionServiceImpl implements SoftwareVersionService
{
    @Autowired
    private SoftwareVersionMapper softwareVersionMapper;

    /**
     * 查询软件版本
     *
     * @param id 软件版本主键
     * @return 软件版本
     */
    @Override
    public SoftwareVersionVO selectSoftwareVersionById(Long id)
    {
        return softwareVersionMapper.selectSoftwareVersionById(id);
    }

    /**
     * 查询软件版本列表
     *
     * @param softwareVersion 软件版本
     * @return 软件版本
     */
    @Override
    public List<SoftwareVersionVO> selectSoftwareVersionList(SoftwareVersionQuery softwareVersion)
    {
        return softwareVersionMapper.selectSoftwareVersionList(softwareVersion);
    }

    /**
     * 新增软件版本
     *
     * @param softwareVersion 软件版本
     * @return 结果
     */
    @Override
    public int insertSoftwareVersion(SoftwareVersion softwareVersion)
    {
        softwareVersion.setCreateTime(DateUtils.getNowDate());
        return softwareVersionMapper.insertSoftwareVersion(softwareVersion);
    }

    /**
     * 修改软件版本
     *
     * @param softwareVersion 软件版本
     * @return 结果
     */
    @Override
    public int updateSoftwareVersion(SoftwareVersion softwareVersion)
    {
        softwareVersion.setUpdateTime(DateUtils.getNowDate());
        return softwareVersionMapper.updateSoftwareVersion(softwareVersion);
    }

    /**
     * 批量删除软件版本
     *
     * @param ids 需要删除的软件版本主键
     * @return 结果
     */
    @Override
    public int deleteSoftwareVersionByIds(Long[] ids)
    {
        return softwareVersionMapper.deleteSoftwareVersionByIds(ids);
    }

    /**
     * 删除软件版本信息
     *
     * @param id 软件版本主键
     * @return 结果
     */
    @Override
    public int deleteSoftwareVersionById(Long id)
    {
        return softwareVersionMapper.deleteSoftwareVersionById(id);
    }
}
