Эх сурвалжийг харах

后管-清表-关联元素表
1、关联时先判断是否相同
2、如果清表tab_id为空,给tab_id赋值

LHB 6 өдөр өмнө
parent
commit
de1ee0e229

+ 10 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java

@@ -790,7 +790,16 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                 if (obj != 1) {
                     throw new ServiceException(StringUtil.format("未获取到 {} 对应实体表信息,关联失败", wbsTree.getNodeName()));
                 }
-
+                //查询清表细信息
+                ExcelTab excelTab = excelTabMapper.selectById(formElementDTO.getExcelTabId());
+                if(StringUtils.isNotEmpty(excelTab.getTabId()) && !excelTab.getTabId().equals(wbsTree.getInitTableId().toString())){
+                    throw new ServiceException(StringUtil.format("当前清表与元素表不一致,无法关联"));
+                }
+                //如果没有 就设置清表的tab_id为选择元素表的tab_id
+                if(StringUtils.isEmpty(excelTab.getTabId())){
+                    excelTab.setTabId(wbsTree.getInitTableId().toString());
+                    excelTabMapper.updateById(excelTab);
+                }
                 //获取当前元素表与清表关系信息
                 List<WbsTabRelationExcelTab> list = baseMapper.selectWbsTabRelationExcelTab(String.valueOf(formElementDTO.getId()), String.valueOf(formElementDTO.getExcelTabId()));
                 if (list.size() <= 0) {