From a40a7aa9e6e9b3704e3f4a4f095465855de98228 Mon Sep 17 00:00:00 2001 From: admin <1628672303@qq.com> Date: Mon, 17 Apr 2023 15:28:08 +0800 Subject: [PATCH] 4-17 --- .../jeecg/modules/fieldx/controller/FieldxController.java | 6 ++++++ .../java/org/jeecg/modules/tablex/mapper/TablexMapper.java | 3 +++ .../org/jeecg/modules/tablex/service/ITablexService.java | 2 ++ .../modules/tablex/service/impl/TablexServiceImpl.java | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java index cad68a7..48a068c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java @@ -152,6 +152,9 @@ public class FieldxController extends JeecgController { } } fieldxService.save(fieldx); +// 更新table版本 + Tablex tablex = tablexService.getById(fieldx.getTableId()); + tablexService.updateVersion(fieldx.getTableId(),tablex.getVerison()+1); tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId())); return Result.OK("添加成功!"); } @@ -205,6 +208,9 @@ public class FieldxController extends JeecgController { } } fieldxService.updateById(fieldx); +// 更新table版本 + Tablex tablex = tablexService.getById(fieldx.getTableId()); + tablexService.updateVersion(fieldx.getTableId(),tablex.getVerison()+1); tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId())); return Result.OK("编辑成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/mapper/TablexMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/mapper/TablexMapper.java index 23a2e58..8911f7b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/mapper/TablexMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/mapper/TablexMapper.java @@ -18,4 +18,7 @@ public interface TablexMapper extends BaseMapper { @Update("update tablex set table_structure = #{sql} where id = #{tableId}") void updateSql(String tableId, String sql); + + @Update("update tablex set verison = #{i} where id = #{tableId}") + void updateVersion(String tableId, int i); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/ITablexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/ITablexService.java index fba23b7..6ebabc4 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/ITablexService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/ITablexService.java @@ -13,4 +13,6 @@ public interface ITablexService extends IService { void updateSql(String tableId, String sql); + void updateVersion(String tableId, int i); + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java index 62fc0fe..4fabd87 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java @@ -24,4 +24,9 @@ public class TablexServiceImpl extends ServiceImpl impleme public void updateSql(String tableId, String sql) { tablexMapper.updateSql(tableId,sql); } + + @Override + public void updateVersion(String tableId, int i) { + tablexMapper.updateVersion(tableId,i); + } }