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


import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
import com.xinelu.manage.service.officialaccountsubscribeevent.IOfficialAccountSubscribeEventService;
import org.springframework.stereotype.Service;

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

/**
 * 微信公众号关注和取消事件信息Service业务层处理
 *
 * @author xinelu
 * @date 2024-03-26
 */
@Service
public class OfficialAccountSubscribeEventServiceImpl implements IOfficialAccountSubscribeEventService {
    @Resource
    private OfficialAccountSubscribeEventMapper officialAccountSubscribeEventMapper;

    /**
     * 查询微信公众号关注和取消事件信息
     *
     * @param id 微信公众号关注和取消事件信息主键
     * @return 微信公众号关注和取消事件信息
     */
    @Override
    public OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id) {
        return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventById(id);
    }

    /**
     * 查询微信公众号关注和取消事件信息列表
     *
     * @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
     * @return 微信公众号关注和取消事件信息
     */
    @Override
    public List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
        return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventList(officialAccountSubscribeEvent);
    }

    /**
     * 新增微信公众号关注和取消事件信息
     *
     * @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
     * @return 结果
     */
    @Override
    public int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
        officialAccountSubscribeEvent.setCreateTime(LocalDateTime.now());
        return officialAccountSubscribeEventMapper.insertOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
    }

    /**
     * 修改微信公众号关注和取消事件信息
     *
     * @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
     * @return 结果
     */
    @Override
    public int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
        officialAccountSubscribeEvent.setUpdateTime(LocalDateTime.now());
        return officialAccountSubscribeEventMapper.updateOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
    }

    /**
     * 批量删除微信公众号关注和取消事件信息
     *
     * @param ids 需要删除的微信公众号关注和取消事件信息主键
     * @return 结果
     */
    @Override
    public int deleteOfficialAccountSubscribeEventByIds(Long[] ids) {
        return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventByIds(ids);
    }

    /**
     * 删除微信公众号关注和取消事件信息信息
     *
     * @param id 微信公众号关注和取消事件信息主键
     * @return 结果
     */
    @Override
    public int deleteOfficialAccountSubscribeEventById(Long id) {
        return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventById(id);
    }
}
