package com.ruoyi.frequency.userappmessage.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.frequency.userappmessage.entity.UserAppMessage;
import com.ruoyi.frequency.userappmessage.mapper.UserAppMessageMapper;
import com.ruoyi.frequency.userappmessage.service.UserAppMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户已读消息Service业务层处理
 *
 * @author liwenlong
 * @date 2023-07-20
 */
@Service
public class UserAppMessageServiceImpl extends ServiceImpl<UserAppMessageMapper, UserAppMessage>  implements UserAppMessageService
{
    @Autowired
    private UserAppMessageMapper userAppMessageMapper;

    /**
     * 查询用户已读消息
     *
     * @param id 用户已读消息主键
     * @return 用户已读消息
     */
    @Override
    public UserAppMessage selectUserAppMessageById(Long id)
    {
        return userAppMessageMapper.selectUserAppMessageById(id);
    }

    /**
     * 查询用户已读消息列表
     *
     * @param userAppMessage 用户已读消息
     * @return 用户已读消息
     */
    @Override
    public List<UserAppMessage> selectUserAppMessageList(UserAppMessage userAppMessage)
    {
        return userAppMessageMapper.selectUserAppMessageList(userAppMessage);
    }

    /**
     * 新增用户已读消息
     *
     * @param userAppMessage 用户已读消息
     * @return 结果
     */
    @Override
    public int insertUserAppMessage(UserAppMessage userAppMessage)
    {
        userAppMessage.setCreateTime(DateUtils.getNowDate());
        return userAppMessageMapper.insertUserAppMessage(userAppMessage);
    }

    /**
     * 修改用户已读消息
     *
     * @param userAppMessage 用户已读消息
     * @return 结果
     */
    @Override
    public int updateUserAppMessage(UserAppMessage userAppMessage)
    {
        userAppMessage.setUpdateTime(DateUtils.getNowDate());
        return userAppMessageMapper.updateUserAppMessage(userAppMessage);
    }

    /**
     * 批量删除用户已读消息
     *
     * @param ids 需要删除的用户已读消息主键
     * @return 结果
     */
    @Override
    public int deleteUserAppMessageByIds(Long[] ids)
    {
        return userAppMessageMapper.deleteUserAppMessageByIds(ids);
    }

    /**
     * 删除用户已读消息信息
     *
     * @param id 用户已读消息主键
     * @return 结果
     */
    @Override
    public int deleteUserAppMessageById(Long id)
    {
        return userAppMessageMapper.deleteUserAppMessageById(id);
    }

}
