package com.trs.ggzyexchange.service.impl;

import com.trs.ggzyexchange.entity.ScheduledTash;
import com.trs.ggzyexchange.mapper.ScheduledTashMapper;
import com.trs.ggzyexchange.service.ScheduledTashService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.log4j.Log4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author trs
 * @since 2023-10-20
 */
@Service
public class ScheduledTashServiceImpl extends ServiceImpl<ScheduledTashMapper, ScheduledTash> implements ScheduledTashService {


    @Autowired
    private ScheduledTashMapper scheduledTashMapper;

    @Override
    public void saveOrUpdateById(ScheduledTash scheduledTashTash) {
        System.out.println("=======================");
        System.out.println(scheduledTashTash);
        String id = scheduledTashTash.getId();
        ScheduledTash scheduledTash = scheduledTashMapper.seById(id);
        if(!ObjectUtils.isEmpty(scheduledTash)){
            scheduledTashMapper.upById(scheduledTash.getId(),scheduledTash.getTableNameValue(),scheduledTash.getTime());
        }
        scheduledTashMapper.inById(scheduledTash.getId(),scheduledTash.getTableNameValue(),scheduledTash.getTime());

    }
}
