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

yui.comn.mybatisx.extension.injector.SoftSqlInjector Maven / Gradle / Ivy

package yui.comn.mybatisx.extension.injector;

import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.stream.Stream;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.AbstractSqlInjector;
import com.baomidou.mybatisplus.core.injector.methods.Delete;
import com.baomidou.mybatisplus.core.injector.methods.DeleteBatchByIds;
import com.baomidou.mybatisplus.core.injector.methods.DeleteById;
import com.baomidou.mybatisplus.core.injector.methods.DeleteByMap;
import com.baomidou.mybatisplus.core.injector.methods.Insert;
import com.baomidou.mybatisplus.core.injector.methods.Update;
import com.baomidou.mybatisplus.core.injector.methods.UpdateById;
import com.baomidou.mybatisplus.core.metadata.TableInfo;

import yui.comn.mybatisx.extension.methods.*;


/**
 * 

* SQL 逻辑删除注入器 *

* * @author yuyi ([email protected]) */ public class SoftSqlInjector extends AbstractSqlInjector { @Override public List getMethodList(Class mapperClass, TableInfo tableInfo) { Stream.Builder builder = Stream.builder() .add(new Insert()) .add(new SoftInsertBatch()) .add(new SoftDefunct()) .add(new Delete()) .add(new DeleteByMap()) .add(new DeleteById()) .add(new DeleteBatchByIds()) .add(new Update()) .add(new UpdateById()) .add(new SoftUpdateAllById()) .add(new SoftUpdateBatchById()) .add(new SoftUpdateBatch()) .add(new SoftUpdateAllBatchById()) .add(new SoftCount()) .add(new SoftGet()) .add(new SoftGetById()) .add(new SoftGetByMap()) .add(new SoftList()) .add(new SoftListByMap()) .add(new SoftListBatchIds()) .add(new SoftListObjs()) .add(new SoftListMaps()) .add(new SoftListMapsByMap()) .add(new SoftPage()) .add(new SoftPageMaps()); return builder.build().collect(toList()); } // @Override // public void inspectInject(MapperBuilderAssistant builderAssistant, Class mapperClass) { // Class modelClass = ReflectionKit.getSuperClassGenericType(mapperClass, BaseDao.class, 0); // if (modelClass != null) { // String className = mapperClass.toString(); // Set mapperRegistryCache = GlobalConfigUtils.getMapperRegistryCache(builderAssistant.getConfiguration()); // if (!mapperRegistryCache.contains(className)) { // TableInfo tableInfo = TableInfoHelper.initTableInfo(builderAssistant, modelClass); // List methodList = this.getMethodList(mapperClass, tableInfo); // if (CollectionUtils.isNotEmpty(methodList)) { // // 循环注入自定义方法 // methodList.forEach(m -> m.inject(builderAssistant, mapperClass, modelClass, tableInfo)); // } else { // logger.debug(mapperClass.toString() + ", No effective injection method was found."); // } // mapperRegistryCache.add(className); // } // } // } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy