package cn.superdesk.uniorder.dubbo.provider.kafka;

import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import cn.superdesk.uniorder.dao.entity.kafka.KafkaConsumerRecord;
import cn.superdesk.uniorder.dto.dubbo.kafka.KafkaConsumerRecordParams;
import cn.superdesk.uniorder.dubbo.facade.kafka.DubboKafkaConsumerRecordService;
import cn.superdesk.uniorder.service.kafka.KafkaConsumerRecordService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 5/13/20 8:51 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 5/13/20 8:51 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboKafkaConsumerRecordServiceImpl implements DubboKafkaConsumerRecordService {

	@Autowired
	private KafkaConsumerRecordService kafkaConsumerRecordService;

	@Override
	public void addObj(KafkaConsumerRecordParams params) {

		KafkaConsumerRecord kafkaConsumerRecord = AnBeanUtils.copy(params, KafkaConsumerRecord.class);

		kafkaConsumerRecordService.insertSelective(kafkaConsumerRecord);

	}

	@Override
	public void updateObj(KafkaConsumerRecordParams params) {

		KafkaConsumerRecord kafkaConsumerRecord = AnBeanUtils.copy(params, KafkaConsumerRecord.class);

		kafkaConsumerRecordService.updateByPrimaryKeySelective(kafkaConsumerRecord);
	}
}
