|
|
@@ -1009,10 +1009,15 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
if (childTableConfig.isPresent()) {
|
|
|
//删除子表单数据
|
|
|
- Entity childDeleteWhere = Entity.create(tableMap.getKey()).set(childTableConfig.get().getRelationField(), keyValue2);
|
|
|
- result = SqlRunnerAdapter.db().dynamicDelete(tableMap.getKey(), childDeleteWhere);
|
|
|
- if (!result) {
|
|
|
- throw new MyException("删除数据失败");
|
|
|
+ // 查询是否有子表数据,如果有就删除,没有返回
|
|
|
+ long count = SqlRunnerAdapter.db().selectCount("select * from " + tableMap.getKey() + " where " + childTableConfig.get().getRelationField() + " = " + keyValue2);
|
|
|
+
|
|
|
+ if (count > 0) {
|
|
|
+ Entity childDeleteWhere = Entity.create(tableMap.getKey()).set(childTableConfig.get().getRelationField(), keyValue2);
|
|
|
+ result = SqlRunnerAdapter.db().dynamicDelete(tableMap.getKey(), childDeleteWhere);
|
|
|
+ if (!result) {
|
|
|
+ throw new MyException("删除数据失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//再重新新增
|