【bug修复】 附表解绑后,主表没有更新

This commit is contained in:
1027158641@qq.com
2025-12-24 10:29:42 +08:00
parent 218583ac08
commit 4115a93953
2 changed files with 47 additions and 5 deletions

View File

@@ -27,13 +27,24 @@
<br><br>
<img src="https://img.shields.io/badge/注意:-JeeLowCode 可以用于个人或公司的项目,不允许任何形式的二次开源并且禁止售卖源代码-red.svg" alt="Downloads">
| 分支 | 简介 |
|--------------|----------------------------|
| master | 使用jdk8 + SpringBoot2.7.18 |
| master_jdk17 | 使用jdk17 + SpringBoot3.3.1 |
## 🎥 视频教程
点击查看视频
<table>
<tr>
<td ><a href="https://www.bilibili.com/video/BV1CgmtBKExE" target="_blank"><img src="https://oss.mj.ink/chatgpt/jeelowcode/gitee/startup_bdkf.png"/></a></td>
<td ><a href="https://www.bilibili.com/video/BV1F8msBdEo7" target="_blank"><img src="https://oss.mj.ink/chatgpt/jeelowcode/gitee/startup_java.png"/></a></td>
<td ><a href="https://www.bilibili.com/video/BV1zYmsB9EW7" target="_blank"><img src="https://oss.mj.ink/chatgpt/jeelowcode/gitee/start_vue.png"/></a></td>
</tr>
</table>
## 💻 代码架构
| 分支 | 简介 | | 分支 | 简介 |
|--------------|----------------------------|-|--------------|----------------------------|
| master | 使用jdk8 + SpringBoot2.7.18 | | master_jdk17 | 使用jdk17 + SpringBoot3.3.1 |
```
com.jeelowcode
├── jeelowcode-admin // 启动模块
@@ -63,6 +74,8 @@ com.jeelowcode
<img src="https://oss.mj.ink/chatgpt/jeelowcode/gitee/jsjg2.png"/>
## 🐛 Hello World入门
只需要**4步** 带你了解低代码JeeLowCode
<table>
@@ -111,7 +124,12 @@ com.jeelowcode
</tr>
</table>
### 3. 动态效果图:
<table>
<tr>
<td ><img src="https://oss.mj.ink/chatgpt/jeelowcode/gitee/gif5.gif?v=20251209"/></td>
</tr>
</table>
## 🌟 框架核心亮点

View File

@@ -1474,12 +1474,15 @@ public class FormServiceImpl extends ServiceImpl<FormMapper, FormEntity> impleme
}
String tableName = dbFormVo.getTableName();
List<String> mainTableNameList=new ArrayList<>();//我的主表列表
//绑定到附表
foreignkeyList.stream().forEach(vo -> {
String mainTable = vo.getMainTable();//主表
if (FuncBase.isEmpty(mainTable)) {
return;
}
mainTableNameList.add(mainTable);//添加主表
//绑定到主表
LambdaQueryWrapper<FormEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FormEntity::getTableName, mainTable);
@@ -1502,6 +1505,27 @@ public class FormServiceImpl extends ServiceImpl<FormMapper, FormEntity> impleme
baseMapper.updateById(updatMainEntity);
});
//获取我的所有主表
LambdaQueryWrapper<FormEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.like(FormEntity::getSubTableListStr, tableName);
List<FormEntity> mainFormEntityList = baseMapper.selectList(wrapper);//主表
for(FormEntity mainFormEntity:mainFormEntityList){
String mainTableName = mainFormEntity.getTableName();
String subTableListStr = mainFormEntity.getSubTableListStr();
if(Func.isEmpty(subTableListStr)){
continue;
}
List<String> subTableList = FuncBase.toStrList(subTableListStr);
if(!subTableList.contains(tableName)){//主表的附表列表中没有的话,则不处理
continue;
}
//判断当前主表是否是我的主表
if(mainTableNameList.contains(mainTableName)){
continue;
}
//进行解绑
unBindMainTable(mainFormEntity,tableName);
}
}