package com.hw.mes.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseAttachInfoMapper;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.service.IMesBaseAttachInfoService;

/**
 * 附件信息Service业务层处理
 * 
 * @author Yinq
 * @date 2024-01-26
 */
@Service
public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService 
{
    @Autowired
    private MesBaseAttachInfoMapper mesBaseAttachInfoMapper;

    /**
     * 查询附件信息
     * 
     * @param attachId 附件信息主键
     * @return 附件信息
     */
    @Override
    public MesBaseAttachInfo selectMesBaseAttachInfoByAttachId(Long attachId)
    {
        return mesBaseAttachInfoMapper.selectMesBaseAttachInfoByAttachId(attachId);
    }

    /**
     * 查询附件信息列表
     * 
     * @param mesBaseAttachInfo 附件信息
     * @return 附件信息
     */
    @Override
    public List<MesBaseAttachInfo> selectMesBaseAttachInfoList(MesBaseAttachInfo mesBaseAttachInfo)
    {
        return mesBaseAttachInfoMapper.selectMesBaseAttachInfoList(mesBaseAttachInfo);
    }

    /**
     * 查询附件信息列表
     *
     * @param attachIds 附件信息
     * @return 附件信息
     */
    @Override
    public List<MesBaseAttachInfo> selectMesBaseAttachInfoByAttachIds(Long[] attachIds)
    {
        return mesBaseAttachInfoMapper.selectMesBaseAttachInfoByAttachIds(attachIds);
    }

    /**
     * 新增附件信息
     * 
     * @param mesBaseAttachInfo 附件信息
     * @return 结果
     */
    @Override
    public int insertMesBaseAttachInfo(MesBaseAttachInfo mesBaseAttachInfo)
    {
        mesBaseAttachInfo.setCreateBy(SecurityUtils.getUsername());
        mesBaseAttachInfo.setCreateTime(DateUtils.getNowDate());
        mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo);
        return mesBaseAttachInfo.getAttachId().intValue();
    }

    /**
     * 修改附件信息
     * 
     * @param mesBaseAttachInfo 附件信息
     * @return 结果
     */
    @Override
    public int updateMesBaseAttachInfo(MesBaseAttachInfo mesBaseAttachInfo)
    {
        mesBaseAttachInfo.setUpdateTime(DateUtils.getNowDate());
        mesBaseAttachInfo.setUpdateBy(SecurityUtils.getUsername());
        return mesBaseAttachInfoMapper.updateMesBaseAttachInfo(mesBaseAttachInfo);
    }

    /**
     * 批量删除附件信息
     * 
     * @param attachIds 需要删除的附件信息主键
     * @return 结果
     */
    @Override
    public int deleteMesBaseAttachInfoByAttachIds(Long[] attachIds)
    {
        return mesBaseAttachInfoMapper.deleteMesBaseAttachInfoByAttachIds(attachIds);
    }

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