|
|
|
@ -59,7 +59,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
@Override
|
|
|
|
|
public List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum) {
|
|
|
|
|
Integer extendType = moduleTypeEnum.getValue();
|
|
|
|
|
List<ExtendGroupPO> extendGroupPOS = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(extendType,null);
|
|
|
|
|
List<ExtendGroupPO> extendGroupPOS = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(extendType, null);
|
|
|
|
|
return ExtendGroupBO.buildTypeTree(extendGroupPOS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -69,7 +69,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
Long groupId = Long.parseLong(groupType);
|
|
|
|
|
String tableName = ExtendGroupBO.getTableNameByGroupPO(getExtendGroupMapper().getGroupById(groupId));
|
|
|
|
|
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupId,null);
|
|
|
|
|
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupId, null);
|
|
|
|
|
List<Map<String, Object>> tabs = new ArrayList<>();
|
|
|
|
|
int idx = 1;
|
|
|
|
|
for (ExtendTitlePO extendTitle : extendTitleList) {
|
|
|
|
@ -135,7 +135,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
Long groupType = param.getGroupType();
|
|
|
|
|
Set<Long> lsDelGroupId = new HashSet<>();
|
|
|
|
|
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupType,null);
|
|
|
|
|
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupType, null);
|
|
|
|
|
extendTitleList.forEach(item -> lsDelGroupId.add(item.getId()));
|
|
|
|
|
String data = param.getData();
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(data);
|
|
|
|
@ -178,7 +178,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
public Map<String, Object> saveTitle(ExtendTitleSaveParam param) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
List<ExtendTitlePO> titlesByGroupID = getExtendTitleMapper().getTitlesByGroupID(param.getGroupType(),null);
|
|
|
|
|
List<ExtendTitlePO> titlesByGroupID = getExtendTitleMapper().getTitlesByGroupID(param.getGroupType(), null);
|
|
|
|
|
ExtendTitlePO extendTitlePO = titlesByGroupID.stream().max(Comparator.comparing(ExtendTitlePO::getShowOrder)).orElse(ExtendTitlePO.builder().showOrder(1).build());
|
|
|
|
|
Set<Long> ids = titlesByGroupID.stream().map(ExtendTitlePO::getId).collect(Collectors.toSet());
|
|
|
|
|
ExtendTitlePO extendTitle = new ExtendTitlePO();
|
|
|
|
@ -201,7 +201,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
@Override
|
|
|
|
|
public void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
if (fieldTypeTreeParam.getId() == null) {
|
|
|
|
|
List<ExtendGroupPO> extendGroupPOList = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(moduleTypeEnum.getValue(),null);
|
|
|
|
|
List<ExtendGroupPO> extendGroupPOList = MapperProxyFactory.getProxy(ExtendGroupMapper.class).listByType(moduleTypeEnum.getValue(), null);
|
|
|
|
|
ExtendGroupPO extendGroup = extendGroupPOList.stream().max(Comparator.comparing(ExtendGroupPO::getShowOrder)).get();
|
|
|
|
|
ExtendGroupPO extendGroupPO = buildExtendGroupType(moduleTypeEnum, fieldTypeTreeParam, extendGroup.getShowOrder());
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendGroupMapper.class).insertIgnoreNull(extendGroupPO);
|
|
|
|
@ -217,7 +217,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteTitle(ExtendTitleSaveParam param) {
|
|
|
|
|
getExtendTitleMapper().deleteExtendTitleByIds(DeleteParam.builder().ids(param.getId().toString()).build().getIds());
|
|
|
|
|
List<ExtendTitlePO> titlesByGroupID = getExtendTitleMapper().getTitlesByGroupID(param.getGroupType(),null);
|
|
|
|
|
List<ExtendTitlePO> titlesByGroupID = getExtendTitleMapper().getTitlesByGroupID(param.getGroupType(), null);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(titlesByGroupID)) {
|
|
|
|
|
// 删除整个分组
|
|
|
|
@ -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)) {
|
|
|
|
|
// 删除数据
|
|
|
|
@ -469,7 +483,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
@Override
|
|
|
|
|
public void saveTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
Set<Long> collect = MapperProxyFactory.getProxy(ExtendGroupMapper.class)
|
|
|
|
|
.listGroupByPid(fieldTypeTreeParam.getParentId(),null).stream().map(ExtendGroupPO::getId).collect(Collectors.toSet());
|
|
|
|
|
.listGroupByPid(fieldTypeTreeParam.getParentId(), null).stream().map(ExtendGroupPO::getId).collect(Collectors.toSet());
|
|
|
|
|
Integer extendType = moduleTypeEnum.getValue();
|
|
|
|
|
List<ExtendGroupPO> extendGroupPOS = JSONArray.parseArray(fieldTypeTreeParam.getData(), ExtendGroupPO.class);
|
|
|
|
|
|
|
|
|
|