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

import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
import com.xinelu.manage.service.officialaccounttemplateevent.IOfficialAccountTemplateEventService;
import org.springframework.stereotype.Service;

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

/**
 * 微信公众号模板信息事件推送Service业务层处理
 *
 * @author xinelu
 * @date 2024-03-25
 */
@Service
public class OfficialAccountTemplateEventServiceImpl implements IOfficialAccountTemplateEventService {
    @Resource
    private OfficialAccountTemplateEventMapper officialAccountTemplateEventMapper;

    /**
     * 查询微信公众号模板信息事件推送
     *
     * @param id 微信公众号模板信息事件推送主键
     * @return 微信公众号模板信息事件推送
     */
    @Override
    public OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id) {
        return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventById(id);
    }

    /**
     * 查询微信公众号模板信息事件推送列表
     *
     * @param officialAccountTemplateEvent 微信公众号模板信息事件推送
     * @return 微信公众号模板信息事件推送
     */
    @Override
    public List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
        return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventList(officialAccountTemplateEvent);
    }

    /**
     * 新增微信公众号模板信息事件推送
     *
     * @param officialAccountTemplateEvent 微信公众号模板信息事件推送
     * @return 结果
     */
    @Override
    public int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
        officialAccountTemplateEvent.setCreateTime(LocalDateTime.now());
        return officialAccountTemplateEventMapper.insertOfficialAccountTemplateEvent(officialAccountTemplateEvent);
    }

    /**
     * 修改微信公众号模板信息事件推送
     *
     * @param officialAccountTemplateEvent 微信公众号模板信息事件推送
     * @return 结果
     */
    @Override
    public int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
        officialAccountTemplateEvent.setUpdateTime(LocalDateTime.now());
        return officialAccountTemplateEventMapper.updateOfficialAccountTemplateEvent(officialAccountTemplateEvent);
    }

    /**
     * 批量删除微信公众号模板信息事件推送
     *
     * @param ids 需要删除的微信公众号模板信息事件推送主键
     * @return 结果
     */
    @Override
    public int deleteOfficialAccountTemplateEventByIds(Long[] ids) {
        return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventByIds(ids);
    }

    /**
     * 删除微信公众号模板信息事件推送信息
     *
     * @param id 微信公众号模板信息事件推送主键
     * @return 结果
     */
    @Override
    public int deleteOfficialAccountTemplateEventById(Long id) {
        return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventById(id);
    }
}
