package com.srs.routine.service.impl;

import java.util.List;

import com.srs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.routine.mapper.SrsAttachResourceMapper;
import com.srs.routine.domain.SrsAttachResource;
import com.srs.routine.service.ISrsAttachResourceService;

/**
 * 附件资源Service业务层处理
 *
 * @author srs
 * @date 2024-05-18
 */
@Service
public class SrsAttachResourceServiceImpl extends ServiceImpl<SrsAttachResourceMapper, SrsAttachResource> implements ISrsAttachResourceService {
    @Autowired
    private SrsAttachResourceMapper srsAttachResourceMapper;

    /**
     * 查询附件资源
     *
     * @param resId 附件资源主键
     * @return 附件资源
     */
    @Override
    public SrsAttachResource selectSrsAttachResourceByResId(Long resId) {
        return srsAttachResourceMapper.selectSrsAttachResourceByResId(resId);
    }

    /**
     * 查询附件资源列表
     *
     * @param srsAttachResource 附件资源
     * @return 附件资源
     */
    @Override
    public List<SrsAttachResource> selectSrsAttachResourceList(SrsAttachResource srsAttachResource) {
        return srsAttachResourceMapper.selectSrsAttachResourceList(srsAttachResource);
    }

    /**
     * 新增附件资源
     *
     * @param srsAttachResource 附件资源
     * @return 结果
     */
    @Override
    public int insertSrsAttachResource(SrsAttachResource srsAttachResource) {
        srsAttachResource.setCreateTime(DateUtils.getNowDate());
        return srsAttachResourceMapper.insertSrsAttachResource(srsAttachResource);
    }

    /**
     * 修改附件资源
     *
     * @param srsAttachResource 附件资源
     * @return 结果
     */
    @Override
    public int updateSrsAttachResource(SrsAttachResource srsAttachResource) {
        srsAttachResource.setUpdateTime(DateUtils.getNowDate());
        return srsAttachResourceMapper.updateSrsAttachResource(srsAttachResource);
    }

    /**
     * 批量删除附件资源
     *
     * @param resIds 需要删除的附件资源主键
     * @return 结果
     */
    @Override
    public int deleteSrsAttachResourceByResIds(Long[] resIds) {
        return srsAttachResourceMapper.deleteSrsAttachResourceByResIds(resIds);
    }

    /**
     * 删除附件资源信息
     *
     * @param resId 附件资源主键
     * @return 结果
     */
    @Override
    public int deleteSrsAttachResourceByResId(Long resId) {
        return srsAttachResourceMapper.deleteSrsAttachResourceByResId(resId);
    }
}
