package com.iformall.service.impl;

import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxFlowRecord;
import com.iformall.mapper.WxFlowRecordMapper;
import com.iformall.service.WxFlowRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author luozukai
 * @date 2019/1/8 19:09
 */
@Service
public class WxFlowRecordServiceImpl implements WxFlowRecordService {
    @Autowired
    private WxFlowRecordMapper wxFlowRecordMapper;

    @Override
    public List<WxFlowRecord> findList(WxFlowRecord flowRecord) {
        return wxFlowRecordMapper.findList(flowRecord);
    }

    @Override
    public void saveOrUpdate(WxFlowRecord record) {
        if (record.getId() == null) {
            final IdWorker idWorker = IdWorker.get();
            record.setId(idWorker.nextId());
            wxFlowRecordMapper.insert(record);
        } else {
            wxFlowRecordMapper.updateById(record);
        }
    }
}
