Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2017-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alilitech.integration.jpa.parameter;
import com.alilitech.integration.jpa.EntityMetaDataRegistry;
import com.alilitech.integration.jpa.meta.EntityMetaData;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.executor.keygen.SelectKeyGenerator;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlCommandType;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.RowBounds;
import java.sql.Statement;
import java.util.Collection;
import java.util.List;
/**
*
* @author Zhou Xiaoxiang
* @since 1.0
*/
public class TriggerValue4SelectKeyGenerator extends SelectKeyGenerator {
private boolean executeBefore;
private MappedStatement keyStatement;
private ParameterAssistant parameterAssistant = new ParameterAssistant();
public TriggerValue4SelectKeyGenerator(MappedStatement keyStatement, boolean executeBefore) {
super(keyStatement, executeBefore);
this.keyStatement = keyStatement;
this.executeBefore = executeBefore;
}
@Override
public void processBefore(Executor executor, MappedStatement mappedStatement, Statement stmt, Object parameterObject) {
if (!(mappedStatement.getSqlCommandType() == SqlCommandType.INSERT || mappedStatement.getSqlCommandType() == SqlCommandType.UPDATE)) {
return;
}
Collection