From 26b60a2682d45a2d506559d7e44c0da230f60884 Mon Sep 17 00:00:00 2001
From: zhc077 <565291854>
Date: Mon, 10 Jul 2023 17:33:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=AE=A1=E7=90=86-=E5=A4=8D?=
=?UTF-8?q?=E5=88=B6=E8=A7=84=E5=88=99=207.10?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/modulex/ModulexList.vue | 6 +++
.../src/views/modulex/modules/ModulexForm.vue | 2 +
.../src/views/rulex/modules/RulexForm.vue | 2 +-
.../service/impl/ModulexServiceImpl.java | 38 +++++++++++++++++--
4 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
index 3d8142d..6578421 100644
--- a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
+++ b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
@@ -71,6 +71,12 @@
新增
返回
+
导入模块
+
导入功能
+
导入规则
+
导入实体
+
导入字段
+
diff --git a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm.vue b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm.vue
index d941dc5..82e2401 100644
--- a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm.vue
+++ b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm.vue
@@ -397,6 +397,8 @@ export default {
this.model.moduleEnName = this.model.moduleEnName + '+1'
this.model.moduleCode = this.model.moduleCode + '+1'
this.model.createTime = null
+ //复制源对象id
+ this.model.copyId = record.id;
}
this.visible = true
},
diff --git a/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue
index 1ec86c9..c1fcfb2 100644
--- a/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue
+++ b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue
@@ -197,7 +197,7 @@ export default {
methods: {
sort() {
getAction(this.url.sort, { id: this.model.functionId }).then((res) => {
- console.log(res)
+ console.log("the res:",JSON.stringify(res));
this.model.ruleNo = res.result.substring(0, 3);
this.model.ruleCode = res.result.substring(3) + this.model.ruleNo;
console.log(this.model.ruleNo)
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
index 3ba1d7d..cfd8dba 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
@@ -22,9 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
/**
* @Description: 模块管理
@@ -186,6 +186,7 @@ public class ModulexServiceImpl extends ServiceImpl impl
@Transactional(readOnly = false, rollbackFor = Exception.class)
@Override
public void copy(Modulex modulex) {
+ final String copyId = modulex.getCopyId();
Integer newVersion = this.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1);
modulex.setRelatedBean(null);
@@ -195,6 +196,7 @@ public class ModulexServiceImpl extends ServiceImpl impl
String id = modulex.getId();
//复制实体&字段
Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper().eq(Tablex::getModuleId, modulex.getCopyId()));
+ String tableId = null;
if (!ObjectUtils.isEmpty(tablex)) {
Tablex tablex1 = new Tablex();
BeanUtils.copyProperties(tablex, tablex1);
@@ -204,6 +206,7 @@ public class ModulexServiceImpl extends ServiceImpl impl
tablex1.setTableEnName(modulex.getModuleEnName());
tablex1.setCreateTime(new Date());
iTablexService.save(tablex1);
+ tableId = tablex1.getId();
List fieldxList = iFieldxService.list(new LambdaQueryWrapper().eq(Fieldx::getTableId, tablex.getId()));
if (!ObjectUtils.isEmpty(fieldxList)) {
List addList = new LinkedList<>();
@@ -234,8 +237,35 @@ public class ModulexServiceImpl extends ServiceImpl impl
addList.add(functionx);
});
iFunctionxService.saveBatch(addList);
- }
+ //复制每个功能的规则
+ List rulexList = iRulexService.list(new LambdaQueryWrapper().eq(Rulex::getModuleId, copyId));
+ List ruleAddList = new LinkedList<>();
+
+ if (!ObjectUtils.isEmpty(rulexList)) {
+ String finalTableId1 = tableId;
+ rulexList.stream().forEach(e -> {
+ //根据原已有规则funtion_id,查找该规则所属功能
+ Functionx functionx = iFunctionxService.getById(e.getFunctionId());
+ //根据原功能名称查询,已复制对象的功能
+ Functionx functionx1 = iFunctionxService.getOne(new LambdaQueryWrapper().eq(Functionx::getModuleId, id).eq(Functionx::getFunctionName, functionx.getFunctionName()));
+ Rulex rulex = new Rulex();
+ BeanUtils.copyProperties(e, rulex);
+ rulex.setId(null);
+ rulex.setModuleId(id);
+ rulex.setTableId(finalTableId1);
+ rulex.setFunctionId(functionx1.getId());
+ //根据原已有规则的field_id,查找该规则字段
+ Fieldx fieldx = iFieldxService.getById(e.getFieldId());
+ //根据源字段名称,查询对应字段id
+ Fieldx fieldx1 = iFieldxService.getOne(new LambdaQueryWrapper().eq(Fieldx::getTableId, finalTableId1).eq(Fieldx::getFieldEnName, fieldx.getFieldEnName()));
+ rulex.setFieldId(fieldx1.getId());
+ rulex.setCreateTime(new Date());
+ ruleAddList.add(rulex);
+ });
+ iRulexService.saveBatch(ruleAddList);
+ }
+ }
}