package com.sundot.airport.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sundot.airport.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sundot.airport.system.mapper.BaseAttachmentMapper;
import com.sundot.airport.common.domain.BaseAttachment;
import com.sundot.airport.common.service.IBaseAttachmentService;

/**
 * 附件Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-14
 */
@Service
public class BaseAttachmentServiceImpl extends ServiceImpl<BaseAttachmentMapper, BaseAttachment> implements IBaseAttachmentService {
    @Autowired
    private BaseAttachmentMapper baseAttachmentMapper;

    /**
     * 查询附件
     *
     * @param id 附件主键
     * @return 附件
     */
    @Override
    public BaseAttachment selectBaseAttachmentById(Long id) {
        return baseAttachmentMapper.selectBaseAttachmentById(id);
    }

    /**
     * 查询附件列表
     *
     * @param baseAttachment 附件
     * @return 附件
     */
    @Override
    public List<BaseAttachment> selectBaseAttachmentList(BaseAttachment baseAttachment) {
        return baseAttachmentMapper.selectBaseAttachmentList(baseAttachment);
    }

    /**
     * 新增附件
     *
     * @param baseAttachment 附件
     * @return 结果
     */
    @Override
    public int insertBaseAttachment(BaseAttachment baseAttachment) {
        baseAttachment.setCreateTime(DateUtils.getNowDate());
        return baseAttachmentMapper.insertBaseAttachment(baseAttachment);
    }

    /**
     * 修改附件
     *
     * @param baseAttachment 附件
     * @return 结果
     */
    @Override
    public int updateBaseAttachment(BaseAttachment baseAttachment) {
        baseAttachment.setUpdateTime(DateUtils.getNowDate());
        return baseAttachmentMapper.updateBaseAttachment(baseAttachment);
    }

    /**
     * 批量删除附件
     *
     * @param ids 需要删除的附件主键
     * @return 结果
     */
    @Override
    public int deleteBaseAttachmentByIds(Long[] ids) {
        return baseAttachmentMapper.deleteBaseAttachmentByIds(ids);
    }

    /**
     * 删除附件信息
     *
     * @param id 附件主键
     * @return 结果
     */
    @Override
    public int deleteBaseAttachmentById(Long id) {
        return baseAttachmentMapper.deleteBaseAttachmentById(id);
    }
}
