package com.bonus.material.push.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.push.mapper.PushDataReceiveInfoMapper;
import com.bonus.material.push.domain.PushDataReceiveInfo;
import com.bonus.material.push.service.IPushDataReceiveInfoService;

/**
 * 推送接收Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class PushDataReceiveInfoServiceImpl implements IPushDataReceiveInfoService {
    @Autowired
    private PushDataReceiveInfoMapper pushDataReceiveInfoMapper;

    /**
     * 查询推送接收
     * 
     * @param id 推送接收主键
     * @return 推送接收
     */
    @Override
    public PushDataReceiveInfo selectPushDataReceiveInfoById(Long id) {
        return pushDataReceiveInfoMapper.selectPushDataReceiveInfoById(id);
    }

    /**
     * 查询推送接收列表
     * 
     * @param pushDataReceiveInfo 推送接收
     * @return 推送接收
     */
    @Override
    public List<PushDataReceiveInfo> selectPushDataReceiveInfoList(PushDataReceiveInfo pushDataReceiveInfo) {
        return pushDataReceiveInfoMapper.selectPushDataReceiveInfoList(pushDataReceiveInfo);
    }

    /**
     * 新增推送接收
     * 
     * @param pushDataReceiveInfo 推送接收
     * @return 结果
     */
    @Override
    public int insertPushDataReceiveInfo(PushDataReceiveInfo pushDataReceiveInfo) {
        pushDataReceiveInfo.setCreateTime(DateUtils.getNowDate());
        try {
            return pushDataReceiveInfoMapper.insertPushDataReceiveInfo(pushDataReceiveInfo);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改推送接收
     * 
     * @param pushDataReceiveInfo 推送接收
     * @return 结果
     */
    @Override
    public int updatePushDataReceiveInfo(PushDataReceiveInfo pushDataReceiveInfo) {
        pushDataReceiveInfo.setUpdateTime(DateUtils.getNowDate());
        try {
            return pushDataReceiveInfoMapper.updatePushDataReceiveInfo(pushDataReceiveInfo);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除推送接收
     * 
     * @param ids 需要删除的推送接收主键
     * @return 结果
     */
    @Override
    public int deletePushDataReceiveInfoByIds(Long[] ids) {
        return pushDataReceiveInfoMapper.deletePushDataReceiveInfoByIds(ids);
    }

    /**
     * 删除推送接收信息
     * 
     * @param id 推送接收主键
     * @return 结果
     */
    @Override
    public int deletePushDataReceiveInfoById(Long id) {
        return pushDataReceiveInfoMapper.deletePushDataReceiveInfoById(id);
    }
}
