All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dream.template.sequence.BatchSequence Maven / Gradle / Ivy

package com.dream.template.sequence;

import com.dream.system.config.BatchMappedStatement;
import com.dream.system.config.MappedStatement;
import com.dream.system.table.TableInfo;

import java.util.List;

public class BatchSequence implements SequenceWrapper {
    public Sequence sequence;

    public BatchSequence(Sequence sequence) {
        this.sequence = sequence;
    }

    @Override
    public boolean isAutoIncrement(TableInfo tableInfo) {
        return sequence.isAutoIncrement(tableInfo);
    }

    @Override
    public void sequence(TableInfo tableInfo, MappedStatement mappedStatement, Object result) {
        if (!isAutoIncrement(tableInfo)) {
            BatchMappedStatement batchMappedStatement = (BatchMappedStatement) mappedStatement;
            List mappedStatementList = batchMappedStatement.getAllMappedStatementList();
            for (MappedStatement ms : mappedStatementList) {
                sequence.sequence(tableInfo, ms, result);
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy