Fixiaobai
2023-10-08 0bc9c6f3152c35f0e1236238f7310a12032395a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.yuanchu.tms.mybatis_config;
 
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
/**
 * 批量添加
 */
@Component
public class MySqlInjector extends DefaultSqlInjector {
 
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        //增加自定义方法,字段注解上不等于FieldFill.DEFAULT的字段才会插入
        methodList.add(new InsertBatchSomeColumn(t->!t.isLogicDelete()));
        return methodList;
    }
}