package cn.newfeifan.mall.module.trade.service.jpushmessagelog;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.newfeifan.mall.module.trade.controller.admin.jpushmessagelog.vo.*;
import cn.newfeifan.mall.module.trade.dal.dataobject.jpushmessagelog.JPushMessageLogDO;
import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;

import cn.newfeifan.mall.module.trade.dal.mysql.jpushmessagelog.JPushMessageLogMapper;

/**
 * 极光推送记录 Service 实现类
 *
 * @author 非繁人
 */
@Service
@Validated
public class JPushMessageLogServiceImpl implements JPushMessageLogService {

    @Resource
    private JPushMessageLogMapper jPushMessageLogMapper;

    @Override
    public Long createJPushMessageLog(JPushMessageLogSaveReqVO createReqVO) {
        // 插入
        JPushMessageLogDO jPushMessageLog = BeanUtils.toBean(createReqVO, JPushMessageLogDO.class);
        jPushMessageLogMapper.insert(jPushMessageLog);
        // 返回
        return jPushMessageLog.getId();
    }

    @Override
    public JPushMessageLogDO getJPushMessageLog(Long id) {
        return jPushMessageLogMapper.selectById(id);
    }

    @Override
    public PageResult<JPushMessageLogDO> getJPushMessageLogPage(JPushMessageLogPageReqVO pageReqVO) {
        return jPushMessageLogMapper.selectPage(pageReqVO);
    }

}