package com.ms.biz.service.impl;

import com.ms.biz.service.DsMessageConsumerBufferService;
import com.ms.dal.entity.DsMessageConsumerBuffer;
import com.ms.dal.mapper.DsMessageConsumerBufferMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;


/**
 *
 */
@Service
public class DsMessageConsumerBufferServiceImpl implements DsMessageConsumerBufferService {

    @Autowired
    private DsMessageConsumerBufferMapper dsMessageConsumerBufferMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return dsMessageConsumerBufferMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(DsMessageConsumerBuffer record) {
        return dsMessageConsumerBufferMapper.insert(record);
    }

    @Override
    public int insertSelective(DsMessageConsumerBuffer record) {
        return dsMessageConsumerBufferMapper.insertSelective(record);
    }

    @Override
    public DsMessageConsumerBuffer selectByPrimaryKey(Long id) {
        return dsMessageConsumerBufferMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(DsMessageConsumerBuffer record) {
        return dsMessageConsumerBufferMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(DsMessageConsumerBuffer record) {
        return dsMessageConsumerBufferMapper.updateByPrimaryKey(record);
    }

    @Override
    public DsMessageConsumerBuffer addBuffer(Long shopId, Long dsMessageId, Date gmtExec) {
        DsMessageConsumerBuffer buffer = new DsMessageConsumerBuffer();
        buffer.setDsMessageId(dsMessageId);
        buffer.setShopId(shopId);
        buffer.setGmtExec(gmtExec);
        buffer.setGmtCreate(new Date());
        buffer.setGmtModified(new Date());
        insertSelective(buffer);
        return buffer;
    }
}




