| | |
| | | */ |
| | | @Override |
| | | public R<List<ModifyAttributeInfo>> submit(BtmAndLinkTypeDdlDTO ddlDTO) { |
| | | //try { |
| | | try { |
| | | List<ModifyAttributeInfo> changedList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(ddlDTO.getBtmTypeList())) { |
| | | List<BtmTypeVO> btmTypeList = ddlDTO.getBtmTypeList(); |
| | | //putBtm(btmTypeList.toArray(new BtmTypeVO[0])); |
| | | putBtm(btmTypeList.toArray(new BtmTypeVO[0])); |
| | | changedList.addAll(checkDifferent(btmTypeList, null)); |
| | | //removeBtm(btmTypeList.toArray(new BtmTypeVO[0])); |
| | | removeBtm(btmTypeList.toArray(new BtmTypeVO[0])); |
| | | } |
| | | if (!CollectionUtils.isEmpty(ddlDTO.getLinkTypeList())) { |
| | | List<LinkTypeVO> linkTypeList = ddlDTO.getLinkTypeList(); |
| | | //putLink(linkTypeList.toArray(new LinkTypeVO[0])); |
| | | putLink(linkTypeList.toArray(new LinkTypeVO[0])); |
| | | changedList.addAll(checkDifferent(null,linkTypeList)); |
| | | //removeLink(linkTypeList.toArray(new LinkTypeVO[0])); |
| | | removeLink(linkTypeList.toArray(new LinkTypeVO[0])); |
| | | } |
| | | R<List<ModifyAttributeInfo>> result = R.success("数据库操作成功"); |
| | | result.setData(changedList); |
| | | return result; |
| | | //} catch (ServiceException e) { |
| | | //throw new RuntimeException(e.getMessage()); |
| | | // } |
| | | } catch (VciBaseException e) { |
| | | try { |
| | | // 建表失败有异常,捕获后返回,并释放线程中的内容 |
| | | if (!CollectionUtils.isEmpty(ddlDTO.getBtmTypeList())) { |
| | | removeBtm(ddlDTO.getBtmTypeList().toArray(new BtmTypeVO[0])); |
| | | } |
| | | if (!CollectionUtils.isEmpty(ddlDTO.getLinkTypeList())) { |
| | | removeLink(ddlDTO.getLinkTypeList().toArray(new LinkTypeVO[0])); |
| | | } |
| | | return R.fail(e.getMessage()); |
| | | }catch (ServiceException e2){ |
| | | throw new RuntimeException(e2.getMessage()); |
| | | } |
| | | } catch (ServiceException e) { |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO(); |
| | | attributeVO.setId(col.getId().toLowerCase()); |
| | | attributeVO.setName(col.getName()); |
| | | attributeVO.setNullableFlag(col.getNullableFlag()); |
| | | attributeVO.setNullableFlag(StringUtils.equals(col.getNullableFlag(), BooleanEnum.TRUE.getValue())); |
| | | attributeVO.setAttributeLength(col.getAttributeLength()); |
| | | attributeVO.setPrecisionLength(col.getPrecisionLength()); |
| | | attributeVO.setScaleLength(col.getScaleLength()); |