|
@@ -33,12 +33,17 @@ public class TableListPlugin extends TableManagerListPlugin {
|
|
|
if ("nckd_remark".equals(itemKey)) {
|
|
|
BillList billList = (BillList)this.getControl("billlistap");
|
|
|
ListSelectedRowCollection list = billList.getSelectedRows();
|
|
|
+ // 统计成功和失败的次数
|
|
|
+ int successCount = 0;
|
|
|
+ int failureCount = 0;
|
|
|
+
|
|
|
for (ListSelectedRow detail : list) {
|
|
|
Object pk = detail.getPrimaryKeyValue();
|
|
|
String pkStr = String.valueOf(pk);
|
|
|
String[] info = pkStr.split("@@");
|
|
|
if (info.length < 2) {
|
|
|
- throw new KDException("err data");
|
|
|
+ failureCount++; // 如果数据不正确,增加失败计数
|
|
|
+ continue; // 跳过此条记录,继续处理下一条
|
|
|
}
|
|
|
|
|
|
//获取数据字典明细
|
|
@@ -65,12 +70,23 @@ public class TableListPlugin extends TableManagerListPlugin {
|
|
|
// 获取SQL字符串
|
|
|
String sqlContent = sql.toString();
|
|
|
|
|
|
- //执行
|
|
|
- DBRoute route = DBRoute.of(dbroute);
|
|
|
- DB.execute(route, sqlContent);
|
|
|
+ try {
|
|
|
+ //执行
|
|
|
+ DBRoute route = DBRoute.of(dbroute);
|
|
|
+ DB.execute(route, sqlContent);
|
|
|
+ successCount++; // 增加成功计数
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 处理执行过程中可能出现的异常
|
|
|
+ e.printStackTrace(); // 可以替换为日志记录
|
|
|
+ failureCount++; // 增加失败计数
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ failureCount++; // 增加失败计数
|
|
|
}
|
|
|
}
|
|
|
+ // 显示最终的成功和失败消息
|
|
|
+ String message = String.format("执行完成:成功 %d 条,失败 %d 条", successCount, failureCount);
|
|
|
+ this.getView().showMessage(message);
|
|
|
}
|
|
|
- this.getView().showMessage("执行成功");
|
|
|
}
|
|
|
}
|