use of com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn in project lamp-util by zuihou.
the class LampSqlInjector method getMethodList.
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
// 增加自定义方法
methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
methodList.add(new UpdateAllById(field -> !ArrayUtil.containsAny(new String[] { SuperEntity.CREATE_TIME_COLUMN, SuperEntity.CREATED_BY_COLUMN }, field.getColumn())));
return methodList;
}
use of com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn in project albedo by somowhere.
the class LampSqlInjector method getMethodList.
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
// 增加自定义方法
methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
methodList.add(new UpdateAllById(field -> !ArrayUtil.containsAny(new String[] { BaseDo.F_SQL_CREATED_DATE, BaseDo.F_SQL_CREATED_BY }, field.getColumn())));
return methodList;
}
use of com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn in project mybatis-plus-samples by baomidou.
the class MybatisPlusConfig method globalConfig.
@Bean
public GlobalConfig globalConfig() {
GlobalConfig conf = new GlobalConfig();
conf.setDbConfig(new GlobalConfig.DbConfig().setColumnFormat("`%s`"));
DefaultSqlInjector logicSqlInjector = new DefaultSqlInjector() {
/**
* 注入自定义全局方法
*/
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
// 不要逻辑删除字段, 不要乐观锁字段, 不要填充策略是 UPDATE 的字段
methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete() && !t.isVersion() && t.getFieldFill() != FieldFill.UPDATE));
// 不要填充策略是 INSERT 的字段, 不要字段名是 column4 的字段
methodList.add(new AlwaysUpdateSomeColumnById(t -> t.getFieldFill() != FieldFill.INSERT && !t.getProperty().equals("column4")));
return methodList;
}
};
conf.setSqlInjector(logicSqlInjector);
return conf;
}
use of com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn in project mybatis-plus-samples by baomidou.
the class MySqlInjector method getMethodList.
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
// 增加自定义方法
methodList.add(new DeleteAll());
methodList.add(new FindOne());
/**
* 以下 3 个为内置选装件
* 头 2 个支持字段筛选函数
*/
// 例: 不要指定了 update 填充的字段
methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
methodList.add(new AlwaysUpdateSomeColumnById());
methodList.add(new LogicDeleteByIdWithFill());
return methodList;
}
use of com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn in project smart-cloud by smart-cloud.
the class SmartSqlInjector method getMethodList.
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
// 添加in-line式批量插入
methodList.add(new InsertBatchSomeColumn());
methodList.add(new Truncate(TRUNCATE_METHOD_NAME));
return methodList;
}
Aggregations