package com.kuankuan.lottery.infrastructure.config;
import com.kuankuan.lottery.infrastructure.injector.EasySqlInjector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author 宽宽
* @Description: 增加 plus 配置插件
* @Date: 2022/1/16 13:54
* @Version: 1.0
*/
@Configuration
public class MybatisPlusConfig {
@Bean
public EasySqlInjector easySqlInjector() {
return new EasySqlInjector();
}
}
package com.kuankuan.lottery.infrastructure.injector;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
import java.util.List;
/**
* @author 宽宽
* @Description: MybatisPlus 扩展
* @Date: 2022/1/16 13:57
* @Version: 1.0
*/
public class EasySqlInjector extends DefaultSqlInjector {
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
// 仅支持mysql
List<AbstractMethod> methodList = super.getMethodList(mapperClass);
// 添加InsertBatchSomeColumn方法
methodList.add(new InsertBatchSomeColumn());
return methodList;
}
}
package com.kuankuan.lottery.infrastructure.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kuankuan.lottery.infrastructure.po.AwardEntity;
import java.util.Collection;
/**
* 奖品配置(Award)表数据库访问层
*
* @author makejava
* @since 2022-01-07 11:48:10
*/
public interface IAwardDao extends BaseMapper<AwardEntity> {
/**
* 批量插入(mysql)
*
* @param entityList 奖品配置集合
* @return 成功条数
*/
int insertBatchSomeColumn(Collection<AwardEntity> entityList);
}