package com.xinelu.manage.service.shortmessagesendrecord.impl;

import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
import com.xinelu.manage.service.shortmessagesendrecord.IShortMessageSendRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 短信发送结果记录Service业务层处理
 *
 * @author xinelu
 * @date 2024-07-30
 */
@Service
public class ShortMessageSendRecordServiceImpl implements IShortMessageSendRecordService {
    @Resource
    private ShortMessageSendRecordMapper shortMessageSendRecordMapper;

    /**
     * 查询短信发送结果记录
     *
     * @param id 短信发送结果记录主键
     * @return 短信发送结果记录
     */
    @Override
    public ShortMessageSendRecord selectShortMessageSendRecordById(Long id) {
        return shortMessageSendRecordMapper.selectShortMessageSendRecordById(id);
    }

    /**
     * 查询短信发送结果记录列表
     *
     * @param shortMessageSendRecord 短信发送结果记录
     * @return 短信发送结果记录
     */
    @Override
    public List<ShortMessageSendRecord> selectShortMessageSendRecordList(ShortMessageSendRecord shortMessageSendRecord) {
        return shortMessageSendRecordMapper.selectShortMessageSendRecordList(shortMessageSendRecord);
    }

    /**
     * 新增短信发送结果记录
     *
     * @param shortMessageSendRecord 短信发送结果记录
     * @return 结果
     */
    @Override
    public int insertShortMessageSendRecord(ShortMessageSendRecord shortMessageSendRecord) {
        shortMessageSendRecord.setCreateTime(LocalDateTime.now());
        return shortMessageSendRecordMapper.insertShortMessageSendRecord(shortMessageSendRecord);
    }

    /**
     * 修改短信发送结果记录
     *
     * @param shortMessageSendRecord 短信发送结果记录
     * @return 结果
     */
    @Override
    public int updateShortMessageSendRecord(ShortMessageSendRecord shortMessageSendRecord) {
        shortMessageSendRecord.setUpdateTime(LocalDateTime.now());
        return shortMessageSendRecordMapper.updateShortMessageSendRecord(shortMessageSendRecord);
    }

    /**
     * 批量删除短信发送结果记录
     *
     * @param ids 需要删除的短信发送结果记录主键
     * @return 结果
     */
    @Override
    public int deleteShortMessageSendRecordByIds(Long[] ids) {
        return shortMessageSendRecordMapper.deleteShortMessageSendRecordByIds(ids);
    }

    /**
     * 删除短信发送结果记录信息
     *
     * @param id 短信发送结果记录主键
     * @return 结果
     */
    @Override
    public int deleteShortMessageSendRecordById(Long id) {
        return shortMessageSendRecordMapper.deleteShortMessageSendRecordById(id);
    }
}
