|
|
|
@ -457,8 +457,22 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
public void deleteTree(Long id) {
|
|
|
|
|
//明细表删除字段信息、删除表结构
|
|
|
|
|
ExtendGroupPO extendGroupPO = getExtendGroupMapper().getGroupById(id);
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendGroupMapper.class).delete(id);
|
|
|
|
|
List<ExtendInfoPO> extendInfoList = getExtendInfoMapper().listFields(extendGroupPO.getExtendType().toString(), extendGroupPO.getId().toString(), ExtendGroupBO.getTableNameByGroupPO(extendGroupPO), "", "");
|
|
|
|
|
String msg = "";
|
|
|
|
|
for (ExtendInfoPO extendInfoPO : extendInfoList) {
|
|
|
|
|
// 判断字段是否使用
|
|
|
|
|
boolean isUsed = ExtendInfoBO.fieldIsUsed(extendInfoPO.getTableName(), extendInfoPO.getFieldName());
|
|
|
|
|
if (isUsed) {
|
|
|
|
|
msg = extendInfoPO.getFieldNameDesc() + "字段已被使用,不可删除";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (extendInfoPO.getIsSystemDefault() == 0) {
|
|
|
|
|
msg = extendInfoPO.getFieldNameDesc() + "字段为系统必须字段,不可删除";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isBlank(msg, msg);
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendGroupMapper.class).delete(id);
|
|
|
|
|
List<Long> ids = extendInfoList.stream().map(ExtendInfoPO::getId).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
|
|
// 删除数据
|
|
|
|
|