mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
发布 v2.5.2
This commit is contained in:
@ -13,6 +13,10 @@ import java.util.Collection;
|
||||
*/
|
||||
public interface BaseMapperPlus<T> extends BaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 单sql批量插入( 全量填充 无视数据库默认值 )
|
||||
* 适用于无脑插入
|
||||
*/
|
||||
int insertAll(@Param("list") Collection<T> batchList);
|
||||
|
||||
}
|
||||
|
@ -51,11 +51,8 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条执行性能差
|
||||
*
|
||||
* {@link #saveAll(Collection)}
|
||||
* 单条执行性能差 适用于列表对象内容不确定
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean saveBatch(Collection<T> entityList, int batchSize) {
|
||||
return super.saveBatch(entityList, batchSize);
|
||||
@ -67,11 +64,8 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条执行性能差
|
||||
*
|
||||
* {@link #saveAll(Collection)}
|
||||
* 单条执行性能差 适用于列表对象内容不确定
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) {
|
||||
return super.saveOrUpdateBatch(entityList, batchSize);
|
||||
@ -82,6 +76,10 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
||||
return super.updateBatchById(entityList, batchSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单sql批量插入( 全量填充 无视数据库默认值 )
|
||||
* 适用于无脑插入
|
||||
*/
|
||||
@Override
|
||||
public boolean saveAll(Collection<T> entityList) {
|
||||
return baseMapper.insertAll(entityList) == entityList.size();
|
||||
|
@ -13,7 +13,7 @@ import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
/**
|
||||
* 单sql批量插入
|
||||
* 单sql批量插入( 全量填充 无视数据库默认值 )
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ public class TestBatchController extends BaseController {
|
||||
private final ITestDemoService iTestDemoService;
|
||||
|
||||
/**
|
||||
* 新增批量方法
|
||||
* 新增批量方法 ( 全量覆盖填充 )
|
||||
*/
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add() {
|
||||
|
@ -26,7 +26,7 @@ public class ThreadPoolConfig {
|
||||
private ThreadPoolProperties threadPoolProperties;
|
||||
|
||||
@Bean(name = "threadPoolTaskExecutor")
|
||||
@ConditionalOnProperty(prefix = "threadPoolTaskExecutor", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = "thread-pool", name = "enabled", havingValue = "true")
|
||||
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setMaxPoolSize(threadPoolProperties.getMaxPoolSize());
|
||||
|
@ -142,8 +142,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getQueryType()), GenTableColumn::getQueryType, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, "")
|
||||
.eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId()));
|
||||
}
|
||||
}
|
||||
@ -180,14 +179,10 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
if (row > 0) {
|
||||
// 保存列信息
|
||||
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
||||
List<GenTableColumn> saveColumns = new ArrayList<>();
|
||||
for (GenTableColumn column : genTableColumns) {
|
||||
GenUtils.initColumnField(column, table);
|
||||
saveColumns.add(column);
|
||||
genTableColumnMapper.insert(column);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(saveColumns)) {
|
||||
genTableColumnMapper.insertAll(saveColumns);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -291,16 +286,12 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
}
|
||||
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||
|
||||
List<GenTableColumn> saveColumns = new ArrayList<>();
|
||||
dbTableColumns.forEach(column -> {
|
||||
if (!tableColumnNames.contains(column.getColumnName())) {
|
||||
GenUtils.initColumnField(column, table);
|
||||
saveColumns.add(column);
|
||||
genTableColumnMapper.insert(column);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(saveColumns)) {
|
||||
genTableColumnMapper.insertAll(saveColumns);
|
||||
}
|
||||
|
||||
List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(delColumns)) {
|
||||
|
@ -33,6 +33,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@Validated
|
||||
@Api(value = "${functionName}控制器", tags = {"${functionName}管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
|
@ -24,7 +24,9 @@ public class ${ClassName} implements Serializable {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
|
||||
/** $column.columnComment */
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
#if($column.javaField=="createBy"||$column.javaField=="createTime")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
#end
|
||||
|
@ -23,7 +23,9 @@ public class ${ClassName}EditBo {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isEdit || $column.isPk==1)
|
||||
|
||||
/** $column.columnComment */
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
#if($column.isRequired==1)
|
||||
#if($column.javaType == 'String')
|
||||
|
@ -33,23 +33,33 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
||||
@ApiModel("${functionName}分页查询对象")
|
||||
public class ${ClassName}QueryBo extends ${Entity} {
|
||||
|
||||
/** 分页大小 */
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/** 当前页数 */
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/** 排序列 */
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/** 排序的方向desc或者asc */
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField) && $column.query)
|
||||
/** $column.columnComment */
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private $column.javaType $column.javaField;
|
||||
#end
|
||||
|
@ -23,13 +23,17 @@ public class ${ClassName}Vo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $pkColumn.columnComment */
|
||||
/**
|
||||
* $pkColumn.columnComment
|
||||
*/
|
||||
@ApiModelProperty("$pkColumn.columnComment")
|
||||
private ${pkColumn.javaType} ${pkColumn.javaField};
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isList && $column.isPk!=1)
|
||||
/** $column.columnComment */
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||
#if($parentheseIndex != -1)
|
||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||
|
@ -105,7 +105,7 @@
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $column.dictType)
|
||||
#elseif($column.list && $column.dictType && "" != $column.dictType)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
|
||||
#elseif($column.list && "" != $javaField)
|
||||
#if(${foreach.index} == 1)
|
||||
|
@ -134,7 +134,7 @@
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $column.dictType)
|
||||
#elseif($column.list && $column.dictType && "" != $column.dictType)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
|
||||
#elseif($column.list && "" != $javaField)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||
|
Reference in New Issue
Block a user