package com.hfkj.service.rebate.impl;

import com.hfkj.dao.BsRebateTransferCycleMapper;
import com.hfkj.entity.BsRebateTransferCycle;
import com.hfkj.service.rebate.BsRebateTransferCycleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @className: BsRebateTransferCycleServiceImpl
 * @author: HuRui
 * @date: 2023/10/26
 **/
@Service("rebateTransferCycleService")
public class BsRebateTransferCycleServiceImpl implements BsRebateTransferCycleService {
    @Resource
    private BsRebateTransferCycleMapper rebateTransferCycleMapper;

    @Override
    public void editData(BsRebateTransferCycle transferCycle) {
        if (transferCycle.getId() == null) {
            transferCycle.setStatus(1);
            transferCycle.setCreateTime(new Date());
            transferCycle.setUpdateTime(new Date());
            rebateTransferCycleMapper.insert(transferCycle);
        } else {
            transferCycle.setUpdateTime(new Date());
            rebateTransferCycleMapper.updateByPrimaryKey(transferCycle);
        }
    }
}
