|
@@ -1,5 +1,7 @@
|
|
|
package kd.bos.newdevportal.table;
|
|
|
|
|
|
+import cfca.org.slf4j.Logger;
|
|
|
+import cfca.org.slf4j.LoggerFactory;
|
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
|
import kd.bos.db.DB;
|
|
|
import kd.bos.db.DBRoute;
|
|
@@ -22,6 +24,7 @@ import java.util.stream.Collectors;
|
|
|
* @version 1.0
|
|
|
*/
|
|
|
public class TableListPlugin extends TableManagerListPlugin {
|
|
|
+ public static final Logger log = LoggerFactory.getLogger(TableListPlugin.class);
|
|
|
public void registerListener(EventObject e) {
|
|
|
super.registerListener(e);
|
|
|
this.addItemClickListeners(new String[]{"toolbarap"});
|
|
@@ -36,21 +39,26 @@ public class TableListPlugin extends TableManagerListPlugin {
|
|
|
|
|
|
int successCount = 0;
|
|
|
int failureCount = 0;
|
|
|
- for (ListSelectedRow detail : list) {
|
|
|
- Object pk = detail.getPrimaryKeyValue();
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Object pk = list.get(i).getPrimaryKeyValue();
|
|
|
String pkStr = String.valueOf(pk);
|
|
|
String[] info = pkStr.split("@@");
|
|
|
if (info.length < 2) {
|
|
|
failureCount++;
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- String tablename = info[0];
|
|
|
- String entityId = info[1];
|
|
|
- String dbroute = EntityMetadataCache.getDataEntityType(MetadataDao.getEntityNumberById(info[1])).getDBRouteKey();
|
|
|
-
|
|
|
- entityIdGroups.computeIfAbsent(dbroute, k -> new ArrayList<>()).add(pkStr);
|
|
|
+ try {
|
|
|
+
|
|
|
+ String tablename = info[0];
|
|
|
+ String entityId = info[1];
|
|
|
+ String dbroute = EntityMetadataCache.getDataEntityType(MetadataDao.getEntityNumberById(info[1])).getDBRouteKey();
|
|
|
+
|
|
|
+ entityIdGroups.computeIfAbsent(dbroute, k -> new ArrayList<>()).add(pkStr);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info(info[0] + "添加注释失败,错误原因:"+e.toString());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
for (Map.Entry<String, List<String >> entry : entityIdGroups.entrySet()) {
|
|
|
String dbroute = entry.getKey();
|
|
@@ -100,8 +108,7 @@ public class TableListPlugin extends TableManagerListPlugin {
|
|
|
DB.execute(route, sqlContent);
|
|
|
successCount++;
|
|
|
} catch (Exception e) {
|
|
|
-
|
|
|
- e.printStackTrace();
|
|
|
+ log.info(tablename + "执行sql失败,错误原因:"+e.toString());
|
|
|
failureCount++;
|
|
|
}
|
|
|
}else {
|