package com.qmth.teachcloud.common.base;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.qmth.teachcloud.common.base.method.InsertBatch;
import com.qmth.teachcloud.common.base.method.InsertOrUpdateBath;
import com.qmth.teachcloud.common.base.method.UpdateBatch;

import java.util.List;

/**
 * @Description: 自定义批量sql插入、更新
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/5/11
 */
public class CustomizedSqlInjector extends DefaultSqlInjector {

    /**
     * 如果只需增加方法，保留mybatis plus自带方法，
     * 可以先获取super.getMethodList()，再添加add
     */
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass);
        methodList.add(new InsertBatch());
        methodList.add(new UpdateBatch());
        methodList.add(new InsertOrUpdateBath());
        return methodList;
    }
}
