package cn.pluss.platform.sys.impl;

import cn.pluss.platform.entity.QueueData;
import cn.pluss.platform.mapper.QueueDataMapper;
import cn.pluss.platform.sys.QueueDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Djh
 * @since 2022-04-20
 */
@Service
public class QueueDataServiceImpl extends ServiceImpl<QueueDataMapper, QueueData> implements QueueDataService {

    /**
     * 无事务执行
     * @param id
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public Integer newQueueData(String id) {
        QueueData entity = new QueueData();
        entity.setId(id);

        int count;
        try {
            count = baseMapper.insert(entity);
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }

        return count;
    }
}
