@ -53,6 +53,7 @@ import apelet.common.orm.impl.*;
@@ -53,6 +53,7 @@ import apelet.common.orm.impl.*;
import apelet.common.redis.util.CommonRedisUtil ;
import apelet.common.sequence.wrapper.IdGeneratorWrapper ;
import cn.hutool.core.collection.CollUtil ;
import cn.hutool.core.collection.CollectionUtil ;
import cn.hutool.core.io.FileUtil ;
import cn.hutool.core.lang.Assert ;
import cn.hutool.core.map.MapUtil ;
@ -1085,6 +1086,15 @@ public class OnlineOperationServiceImpl implements OnlineOperationService {
@@ -1085,6 +1086,15 @@ public class OnlineOperationServiceImpl implements OnlineOperationService {
}
OnlineTable onlineTable = onlineTableService . getOnlineTableFromCache ( onlineForm . getMasterTableId ( ) ) ;
OnlFormHead onlFormHead = onlFormHeadService . getHeadTableNameCache ( onlineTable . getTableName ( ) ) ;
if ( BooleanUtil . isTrue ( onlinePluginExecuteDto . getIsSelectAll ( ) ) ) {
List < String > allBillIds = this . queryAllBillIds ( onlineTable , onlinePluginExecuteDto . getQueryParams ( ) ) ;
if ( CollUtil . isEmpty ( allBillIds ) ) {
OperationResult empty = new OperationResult ( ) ;
empty . setMessage ( "没有符合条件的数据!" ) ;
return empty ;
}
onlinePluginExecuteDto . setBillId ( CollUtil . join ( allBillIds , "," ) ) ;
}
// executePlugin 是所有按钮的统一入口,附件的写入/清理必须按插件类型分别设闸,
// 否则「审核」这类只提交部分字段的按钮会把附件全量覆盖掉,「删除」则不会清理附件。
boolean saveOperation = this . containsPlugin ( sortDtoList , SaveOperationServicePlugIn . class ) ;
@ -1122,6 +1132,36 @@ public class OnlineOperationServiceImpl implements OnlineOperationService {
@@ -1122,6 +1132,36 @@ public class OnlineOperationServiceImpl implements OnlineOperationService {
}
/ * *
* 按列表筛选条件查询主表全部主键 , 用于 "选择全部按钮" 。
* queryParams 为 { 列名 : 值 } 的等值条件 ; 为空表示无筛选 ( 即整表 ) 。
* /
private List < String > queryAllBillIds ( OnlineTable masterTable , Map < String , Object > queryParams ) {
List < String > billIds = new ArrayList < > ( ) ;
Filter filter = new Filter ( ) ;
if ( MapUtil . isNotEmpty ( queryParams ) ) {
queryParams . forEach ( ( column , value ) - > {
if ( value = = null | | "" . equals ( value ) ) {
return ; // 空条件不过滤,与列表查询语义保持一致
}
filter . add ( new FilterItem ( column , FilterItem . equals , value ) ) ;
} ) ;
}
Selector selector = new Selector ( ) ;
selector . getList ( ) . add ( new SelectorItem ( "id" ) ) ;
ObjectCollection collection = ormGenDataSourceUtil . query ( masterTable . getTableName ( ) , filter , selector ) ;
if ( collection = = null | | collection . isEmpty ( ) ) {
return new ArrayList < > ( ) ;
}
for ( int i = 0 ; i < collection . size ( ) ; i + + ) {
Object id = collection . getObject ( i ) . get ( "id" ) ;
if ( id ! = null ) {
billIds . add ( id . toString ( ) ) ;
}
}
return billIds ;
}
/ * *
* 判断当前按钮绑定的插件中是否包含指定插件 。
* < p > 按钮与插件的绑定是 widgetJson 中 pluginList [ ] . class 的全限定类名 ( 见 QuickFormWidgetUtil # setSaveButtonEnabled ) ,
* 用类名判断比用中文 buttonName 可靠 。 < / p >