✨ Introducing new features. #1628 PigxBaseMapper 优化MyBatisPlus 的批量插入和支持数据权限
This commit is contained in:
1 parent
cf0db9c132
commit
2eeb49f08b
41 files changed
+117
-103
No files matched your search
+2
@@ -2,6 +2,7 @@ package com.pig4cloud.pigx.common.data.datascope;
|
||||
|
||||
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;
|
||||
|
||||
@@ -19,6 +20,7 @@ public class DataScopeSqlInjector extends DefaultSqlInjector {
|
||||
methodList.add(new SelectListByScope());
|
||||
methodList.add(new SelectPageByScope());
|
||||
methodList.add(new SelectCountByScope());
|
||||
methodList.add(new InsertBatchSomeColumn());
|
||||
return methodList;
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -9,12 +9,12 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 若使用数据权限 Mapper继承此类
|
||||
* 扩展通用 Mapper,支持数据权限 和批量插入
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2020-06-17
|
||||
*/
|
||||
public interface DataScopeMapper<T> extends BaseMapper<T> {
|
||||
public interface PigxBaseMapper<T> extends BaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 根据 entity 条件,查询全部记录
|
||||
@@ -42,4 +42,11 @@ public interface DataScopeMapper<T> extends BaseMapper<T> {
|
||||
*/
|
||||
Integer selectCountByScope(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper, DataScope scope);
|
||||
|
||||
/**
|
||||
* 批量插入 仅适用于 mysql
|
||||
* @param entityList 实体列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
Integer insertBatchSomeColumn(List<T> entityList);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user