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

import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
import com.xinelu.manage.service.subscribemessagerecord.ISubscribeMessageRecordService;
import org.springframework.stereotype.Service;

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

/**
 * 微信小程序订阅消息记录Service业务层处理
 *
 * @author xinelu
 * @date 2024-03-19
 */
@Service
public class SubscribeMessageRecordServiceImpl implements ISubscribeMessageRecordService {
    @Resource
    private SubscribeMessageRecordMapper subscribeMessageRecordMapper;

    /**
     * 查询微信小程序订阅消息记录
     *
     * @param id 微信小程序订阅消息记录主键
     * @return 微信小程序订阅消息记录
     */
    @Override
    public SubscribeMessageRecord selectSubscribeMessageRecordById(Long id) {
        return subscribeMessageRecordMapper.selectSubscribeMessageRecordById(id);
    }

    /**
     * 查询微信小程序订阅消息记录列表
     *
     * @param subscribeMessageRecord 微信小程序订阅消息记录
     * @return 微信小程序订阅消息记录
     */
    @Override
    public List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord) {
        return subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
    }

    /**
     * 新增微信小程序订阅消息记录
     *
     * @param subscribeMessageRecord 微信小程序订阅消息记录
     * @return 结果
     */
    @Override
    public int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
        subscribeMessageRecord.setCreateTime(LocalDateTime.now());
        return subscribeMessageRecordMapper.insertSubscribeMessageRecord(subscribeMessageRecord);
    }

    /**
     * 修改微信小程序订阅消息记录
     *
     * @param subscribeMessageRecord 微信小程序订阅消息记录
     * @return 结果
     */
    @Override
    public int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
        subscribeMessageRecord.setUpdateTime(LocalDateTime.now());
        return subscribeMessageRecordMapper.updateSubscribeMessageRecord(subscribeMessageRecord);
    }

    /**
     * 批量删除微信小程序订阅消息记录
     *
     * @param ids 需要删除的微信小程序订阅消息记录主键
     * @return 结果
     */
    @Override
    public int deleteSubscribeMessageRecordByIds(Long[] ids) {
        return subscribeMessageRecordMapper.deleteSubscribeMessageRecordByIds(ids);
    }

    /**
     * 删除微信小程序订阅消息记录信息
     *
     * @param id 微信小程序订阅消息记录主键
     * @return 结果
     */
    @Override
    public int deleteSubscribeMessageRecordById(Long id) {
        return subscribeMessageRecordMapper.deleteSubscribeMessageRecordById(id);
    }
}
