package com.orangesale.cn.service;

import com.orangesale.cn.entity.OrangeMessage;
import com.orangesale.cn.mapper.MessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author zhijun
 * @Date 2019/12/13
 */
@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper;

    /**
     * 推送消息
     *
     * @param message
     * @return
     */
    public Integer insertMessage(OrangeMessage message) {
        return messageMapper.insertMessage(message);
    }

    /**
     * 消费消息
     *
     * @return
     */
    public OrangeMessage consumeMessage() {
        return messageMapper.getMessage();
    }

    /**
     * 消息设置为已读
     *
     * @return
     */
    public Integer updateMessage() {
        return messageMapper.updateMessage();
    }
}
