update 调整 core mp 包结构

This commit is contained in:
疯狂的狮子li 2021-06-18 15:25:37 +08:00
parent e87f2dda85
commit 281b6b6d2b
3 changed files with 26 additions and 5 deletions

View File

@ -1,4 +1,4 @@
package com.ruoyi.common.core.mybatisplus; package com.ruoyi.common.core.mybatisplus.cache;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;

View File

@ -1,6 +1,9 @@
package com.ruoyi.common.core.page; package com.ruoyi.common.core.mybatisplus.core;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
/** /**
* 自定义 Mapper 接口, 实现 自定义扩展 * 自定义 Mapper 接口, 实现 自定义扩展
@ -9,4 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2021-05-13 * @since 2021-05-13
*/ */
public interface BaseMapperPlus<T> extends BaseMapper<T> { public interface BaseMapperPlus<T> extends BaseMapper<T> {
int insertAll(@Param("list") Collection<T> batchList);
} }

View File

@ -1,9 +1,10 @@
package com.ruoyi.common.core.page; package com.ruoyi.common.core.mybatisplus.core;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.PagePlus;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
@ -182,7 +183,6 @@ public interface IServicePlus<T> extends IService<T> {
* *
* @param page 翻页对象 * @param page 翻页对象
* @param queryWrapper 实体对象封装操作类 * @param queryWrapper 实体对象封装操作类
* @param kClass vo类型
*/ */
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper, Class<K> kClass) { default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper, Class<K> kClass) {
PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper); PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper);
@ -210,7 +210,6 @@ public interface IServicePlus<T> extends IService<T> {
* 无条件翻页查询 * 无条件翻页查询
* *
* @param page 翻页对象 * @param page 翻页对象
* @param kClass vo类型
*/ */
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Class<K> kClass) { default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Class<K> kClass) {
return pageVo(page, Wrappers.emptyWrapper(), kClass); return pageVo(page, Wrappers.emptyWrapper(), kClass);
@ -226,5 +225,21 @@ public interface IServicePlus<T> extends IService<T> {
return pageVo(page, Wrappers.emptyWrapper(), convertor); return pageVo(page, Wrappers.emptyWrapper(), convertor);
} }
@Override
default boolean saveBatch(Collection<T> entityList) {
return saveBatch(entityList, DEFAULT_BATCH_SIZE);
}
@Override
default boolean saveOrUpdateBatch(Collection<T> entityList) {
return saveOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE);
}
@Override
default boolean updateBatchById(Collection<T> entityList) {
return updateBatchById(entityList, DEFAULT_BATCH_SIZE);
}
boolean saveAll(Collection<T> entityList);
} }