From 8ea4c69b64b5088d7821f7bc3dd8f724b78b314d Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期二, 06 六月 2023 16:46:08 +0800
Subject: [PATCH] 链接类型联调接口。DDL服务修正。业务类型新增接口修正。
---
Source/UBCS/ubcs-service-api/ubcs-ddl-api/src/main/java/com/vci/ubcs/ddl/bo/DdlFieldMappingAttrBO.java | 5
Source/UBCS-WEB/src/views/modeling/LinkType.vue | 160 +++++----
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java | 2
Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/IDdlService.java | 9
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeServiceImpl.java | 102 +++---
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILinkTypeAttributeService.java | 31 +
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeAttributeWrapper.java | 4
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeAttributeWrapper.java | 2
Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/LinkTypeAttributeMapper.xml | 2
Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java | 64 +++-
Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeVO.java | 5
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeAttributeServiceImpl.java | 87 +++++
Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue | 35 +
Source/UBCS-WEB/src/api/omd/linkType.js | 4
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeWrapper.java | 76 ++++
Source/UBCS-WEB/src/views/modeling/Business.vue | 46 +-
Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTreeVO.java | 4
Source/UBCS-WEB/src/main.js | 2
Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeAttributeVO.java | 256 ---------------
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LinkTypeController.java | 8
Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/LinkTypeAttribute.java | 2
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java | 16
22 files changed, 484 insertions(+), 438 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/omd/linkType.js b/Source/UBCS-WEB/src/api/omd/linkType.js
index e69fc12..4212b92 100644
--- a/Source/UBCS-WEB/src/api/omd/linkType.js
+++ b/Source/UBCS-WEB/src/api/omd/linkType.js
@@ -11,7 +11,7 @@
return request({
url: '/api/ubcs-omd/link-type/get-from-table',
method: 'get',
- params: {
+ params: {
domain: domain
}
})
@@ -58,7 +58,7 @@
})
}
-export const btmPage = (current,size,params) => {
+export const linkPage = (current,size,params) => {
return request ({
url: '/api/ubcs-omd/link-type/page',
method: 'get',
diff --git a/Source/UBCS-WEB/src/main.js b/Source/UBCS-WEB/src/main.js
index 5ceed92..082a2cd 100644
--- a/Source/UBCS-WEB/src/main.js
+++ b/Source/UBCS-WEB/src/main.js
@@ -46,6 +46,7 @@
import TableCrud from "@/components/Crud/Crud"
import originalAdd from "@/views/modeling/originalAdd"
import FormTemplateDialog from "@/components/FormTemplate/index"
+import linkTypeAdd from "@/views/modeling/LinkTypeAdd"
// 灏嗗伐鍏峰嚱鏁版坊鍔犲埌鍏ㄥ眬
import utilFunc from './util/func'
@@ -93,6 +94,7 @@
Vue.component('referBtmTypeCrudDialog',referBtmTypeCrudDialog)
Vue.component('referSelectBtmAttrDialog',referSelectBtmAttrDialog)
Vue.component('FormTemplateDialog',FormTemplateDialog)
+Vue.component('LinkTypeAdd',linkTypeAdd)
// 鍔犺浇鐩稿叧url鍦板潃
Object.keys(urls).forEach(key => {
diff --git a/Source/UBCS-WEB/src/views/modeling/Business.vue b/Source/UBCS-WEB/src/views/modeling/Business.vue
index 476fe62..7b12feb 100644
--- a/Source/UBCS-WEB/src/views/modeling/Business.vue
+++ b/Source/UBCS-WEB/src/views/modeling/Business.vue
@@ -27,30 +27,30 @@
<basic-container>
<p style="margin-top: 10px;font-weight: 570;font-size: 19px">鍩烘湰淇℃伅</p>
<el-descriptions class="margin-top" :column="3" :size="size" border>
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-finished"></i>
+ <i :class="icons.key"></i>
鑻辨枃鍚嶇О
</template>
{{ obj.id }}
</el-descriptions-item>
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-info"></i>
+ <i :class="icons.name"></i>
涓枃鍚嶇О
</template>
{{ obj.name }}
</el-descriptions-item>
<el-descriptions-item>
- <template slot="label">
- <i class="el-icon-date"></i>
+ <template slot="label" :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
+ <i :class="icons.tableName"></i>
鏁版嵁搴撹〃鍚�
</template>
{{ obj.tableName }}
</el-descriptions-item>
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-folder-opened"></i>
+ <i :class="icons.domain"></i>
鎵�灞為鍩�
</template>
<el-tag size="small">
@@ -71,23 +71,23 @@
</template>
{{ obj.sss }}
</el-descriptions-item> -->
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-s-check"></i>
+ <i :class="icons.revisionRule"></i>
鐗堟湰瑙勫垯
</template>
{{ obj.versionRule }}
</el-descriptions-item>
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-refresh-right"></i>
+ <i :class="icons.lifeCycle"></i>
鐢熷懡鍛ㄦ湡
</template>
{{ obj.lifeCycleId }}
</el-descriptions-item>
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-view"></i>
+ <i :class="icons.view"></i>
瑙嗗浘
</template>
<el-tag size="small">
@@ -101,9 +101,9 @@
</template>
{{ obj.implClass }}
</el-descriptions-item> -->
- <el-descriptions-item>
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle" :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-chat-line-square"></i>
+ <i :class="icons.desc"></i>
鎻忚堪
</template>
{{ obj.description }}
@@ -114,8 +114,8 @@
<basic-container>
<p style="margin-top: 10px;font-weight: 570;font-size: 19px">灞炴�у垪琛�</p>
<avue-crud class="attributeCrud" v-model="obj" :data="obj.attributes" :option="loadOption">
- <template slot="attrDataType" slot-scope="{row}" >
- <el-tag>{{row.attrDataType}}</el-tag>
+ <template slot="attrDataTypeText" slot-scope="{row}" >
+ <el-tag>{{row.attrDataTypeText}}</el-tag>
</template>
</avue-crud>
</basic-container>
@@ -167,7 +167,7 @@
addBtn: false,
props: {
labelText: '',
- label: 'name',
+ label: 'label',
value: 'oid',
children: 'childList',
}
@@ -196,7 +196,7 @@
},
{
label: "绫诲瀷",
- prop: "attrDataType",
+ prop: "attrDataTypeText",
align: 'center',
slot: true
},
@@ -212,11 +212,15 @@
}
]
},
+ descriptionOption: {
+ labelStyle:'text-align:center;width:120px',
+ contentStyle: 'width:240px;text-align:center;word-break;break-all;'
+ },
domain: null,
domainOptions: [],
icons:{
key: 'el-icon-finished',
- name: 'el-icon-info',
+ name: 'el-icon-tickets',
tableName: 'el-icon-date',
domain: 'el-icon-folder-opened',
revisionRule: 'el-icon-s-check',
diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
index bb1501a..d61723b 100644
--- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -7,9 +7,8 @@
width="70%"
style="height: 115vh;"
>
- <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm">
-
- <el-form-item label="鑻辨枃鍚嶇О" label-width="100px" required="true">
+ <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm" :rules="rules" @resetFields="resetForm" status-icon="true">
+ <el-form-item label="鑻辨枃鍚嶇О" label-width="100px" required="true" prop="id">
<el-input v-model="btmType.id" :prefix-icon="icons.key"></el-input>
</el-form-item>
<el-form-item label="涓枃鍚嶇О" label-width="100px">
@@ -18,7 +17,7 @@
<el-form-item label="鏁版嵁搴撹〃鍚�" label-width="100px">
<el-input v-model="btmType.tableName" :prefix-icon="icons.tableName"></el-input>
</el-form-item>
- <el-form-item label="鎵�灞為鍩�" label-width="100px">
+ <el-form-item label="鎵�灞為鍩�" label-width="100px" prop="domain">
<el-select v-model="btmType.domain" :prefix-icon="icons.domain">
<el-option v-for="item in domainOption"
:label="item.label" :value="item.value" :key="item.value"></el-option>
@@ -85,8 +84,8 @@
@on-load="attrRefOnLoad"
@search-change="attrRefSearch"
@selection-change="selectionChange">
- <template slot="name" slot-scope="scope" >
- <el-tag>{{scope}}</el-tag>
+ <template slot="typeValue" slot-scope="scope" >
+ <el-tag>{{scope.row.typeValue}}</el-tag>
</template>
</avue-crud>
<div slot="footer" class="dialog-footer">
@@ -207,19 +206,20 @@
column: [
{
label: '鑻辨枃鍚嶇О',
- prop: 'key',
+ prop: 'id',
align: 'left',
search: true,
width: 230
}, {
label: '涓枃鍚嶇О',
- prop: 'label',
+ prop: 'name',
align: 'center',
},
{
label: "绫诲瀷",
prop: "typeValue",
- align: 'center'
+ align: 'center',
+ slot: true,
},
{
label: "榛樿鍊�",
@@ -315,6 +315,16 @@
]
},
},
+ rules: {
+ id: [
+ { required: true, message: '璇疯緭鍏ヤ笟鍔$被鍨嬬紪鍙�', trigger: 'blur' },
+ { pattern: /^[A-Za-z]+$/, message: '涓氬姟绫诲瀷缂栧彿鍙兘涓鸿嫳鏂�', trigger: 'blur' },
+ { min: 2, max: 15, message: '闀垮害鍦�2鍒�15涓瓧绗�', trigger: 'blur' }
+ ],
+ domain: [
+ { required: true, message: '璇烽�夋嫨鎵�灞為鍩�', trigger: 'blur' }
+ ]
+ },
}
},
created() {
@@ -328,6 +338,7 @@
this.btmType = {};
this.attrRef.selectData = [];
this.attrRef.queryNotIn = null;
+ this.resetForm();
},
// 鍏抽棴灞炴�ф睜鏌ヨ寮圭獥
closeAttrDialog(){
@@ -370,7 +381,7 @@
name: item.name,
typeValue: item.typeValue,
typeKey: item.typeValue,
- attrDataType : item.typeValue,
+ attrDataType : item.typeKey,
defaultValue: item.defaultValue,
description: item.description,
attributeLength: item.maxLength
@@ -465,6 +476,10 @@
this.$delete(this.btmType,'revisionRuleId');
this.$delete(this.btmType,'revisionRuleName');
this.$delete(this.btmType,'inputRevisionFlag');
+ },
+ resetForm(){
+ this.btmType = {};
+ this.$refs.form.resetFields();
}
}
}
diff --git a/Source/UBCS-WEB/src/views/modeling/LinkType.vue b/Source/UBCS-WEB/src/views/modeling/LinkType.vue
index 18e6791..eec03bf 100644
--- a/Source/UBCS-WEB/src/views/modeling/LinkType.vue
+++ b/Source/UBCS-WEB/src/views/modeling/LinkType.vue
@@ -2,21 +2,17 @@
<el-container>
<!-- 椤剁鎸夐挳 -->
<el-header class="businessHeader" style="height: 40px;">
- <el-button-group>
- <el-button type="primary" @click="linkTypeAdd" size="small">
- <i class="el-icon-plus"></i>
- 鏂板
- </el-button>
- <el-button type="primary" @click="linkTypeEdit" size="small">
- <i class="el-icon-edit"></i>
- 淇敼
- </el-button>
- <el-button type="primary" @click="selectFromTable" size="small">
- <i class="el-icon-thumb"></i>
- 浠庡凡鏈変腑鑾峰彇
- </el-button>
- </el-button-group>
- </el-header>
+ <el-button-group>
+ <el-button type="primary" @click="linkTypeAdd" size="small">
+ <i class="el-icon-plus"></i>
+ 鏂板
+ </el-button>
+ <el-button type="primary" @click="linkTypeEdit" size="small">
+ <i class="el-icon-edit"></i>
+ 淇敼
+ </el-button>
+ </el-button-group>
+ </el-header>
<!-- 渚ц竟鏍忔爲 -->
<el-container>
<el-aside width="240px">
@@ -38,34 +34,34 @@
<basic-container>
<p style="margin-top: 10px;font-weight: 570;font-size: 19px">鍩烘湰淇℃伅</p>
<el-descriptions class="margin-top" :column="2" size="medium" border>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-finished"></i>
+ <i :class="icons.id"></i>
鑻辨枃鍚嶇О
</template>
{{ obj.id }}
</el-descriptions-item>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-info"></i>
+ <i :class="icons.name"></i>
涓枃鍚嶇О
</template>
{{ obj.name }}
</el-descriptions-item>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-date"></i>
+ <i :class="icons.tableName"></i>
鏁版嵁搴撹〃鍚�
</template>
{{ obj.tableName }}
</el-descriptions-item>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-folder-opened"></i>
+ <i :class="icons.domain"></i>
鎵�灞為鍩�
</template>
<el-tag size="small">
@@ -74,71 +70,75 @@
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" direction="vertical" :column="2" border>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-sort-down"></i>
+ <i :class="icons.from"></i>
From绔被鍨�
</template>
<span v-for="item in obj.fromBtmTypes" style="margin-left:2px;">
- <el-tag size="small" effect="plain" style="width:130px;margin-top: 2px;">
+ <el-tag size="small" effect="plain" style="margin-top: 2px;">
{{ item.id + '锛�' + item.name + '锛�' }}
</el-tag>
</span>
</el-descriptions-item>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-sort-up"></i>
+ <i :class="icons.to"></i>
To娈电被鍨�
</template>
- <span v-for="item in obj.toBtmTypes" style="height:26px;width:140px;margin-left:2px">
- <el-tag size="small" effect="plain" style="width:130px;margin-top: 2px;">
+ <span v-for="item in obj.toBtmTypes" style="margin-left:2px">
+ <el-tag size="small" effect="plain" style="margin-top: 2px;">
{{ item.id + '锛�' + item.name + '锛�' }}
</el-tag>
</span>
</el-descriptions-item>
</el-descriptions>
- <el-descriptions class="margin-top" :column="2" size="medium" border>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions class="margin-top" :column="2" size="medium" border>
+ <!--
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-info"></i>
+ <i :class="icons.main"></i>
涓荤被鍨�
</template>
{{ obj.fromBtmTypeName }}
</el-descriptions-item>
- <el-descriptions-item labelStyle="text-align:center;width:120px"
- contentStyle="width:240px;text-align:center;word-break;break-all;">
+ <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
+ :contentStyle="descriptionOption.contentStyle">
<template slot="label">
- <i class="el-icon-info"></i>
+ <i :class="icons.main"></i>
涓荤被鍨�
</template>
{{ obj.toBtmTypeName }}
</el-descriptions-item>
+ -->
<el-descriptions-item span='2' labelStyle="text-align:center;width:120px">
<template slot="label">
- <i class="el-icon-chat-line-square"></i>
+ <i :class="icons.desc"></i>
鎻忚堪
</template>
{{ obj.description }}
</el-descriptions-item>
- </el-descriptions>
+ </el-descriptions>
</basic-container>
<!-- 灞炴�у垪琛�-->
<basic-container>
<p style="margin-top: 10px;font-weight: 570;font-size: 19px">灞炴�у垪琛�</p>
<avue-crud class="attributeCrud" v-model="obj" :data="obj.attributes" :option="loadOption">
- <template slot="attrDataType" slot-scope="{row}">
- <el-tag>{{ row.attrDataType }}</el-tag>
+ <template slot="attrDataTypeText" slot-scope="{row}">
+ <el-tag>{{ row.attrDataTypeText }}</el-tag>
</template>
</avue-crud>
</basic-container>
</el-main>
</el-container>
</el-container>
-
+ <link-type-add ref="linkAdd" :linkType="addOption.linkType" :domainOption="domainOptions" :icons="icons"
+ @refreshTable="initTreeOnLoad">
+ </link-type-add>
</el-container>
</template>
@@ -155,10 +155,26 @@
name: "LinkType",
data() {
return {
- treeData: [
- { id: "1", name: "2", label: "label" },
- { id: "a", name: "b", label: "c" }
- ],
+ addOption: {
+ linkType: {},
+ },
+ domain: null,
+ domainOptions: [],
+ icons: {
+ id: 'el-icon-finished',
+ name: 'el-icon-tickets',
+ tableName: 'el-icon-date',
+ domain: 'el-icon-folder-opened',
+ from: 'el-icon-sort-down',
+ to: 'el-icon-sort-up',
+ main: 'el-icon-warning-outline',
+ desc: 'el-icon-chat-line-square'
+ },
+ treeData: [],
+ descriptionOption: {
+ labelStyle: 'text-align:center;width:120px',
+ contentStyle: 'width:240px;text-align:center;word-break;break-all;'
+ },
loadOption: {
border: true,
height: 360,
@@ -180,7 +196,7 @@
},
{
label: '绫诲瀷',
- prop: 'attrDataType',
+ prop: 'attrDataTypeText',
align: 'center',
slot: true
},
@@ -196,27 +212,14 @@
}
]
},
- obj: {
- id: 'linkType',
- name: '閾炬帴绫诲瀷',
- tableName: 'PLLT_OMD_LINKTYPE',
- domain: 'ubcs-omd',
- domainText: '瀵硅薄寤烘ā',
- fromBtmTypes: [
- { id: 'btm', name: '涓氬姟绫诲瀷' },
- { id: 'btm2', name: '涓氬姟绫诲瀷2' }
- ],
- toBtmTypes: [{ id: 'btm', name: '涓氬姟绫诲瀷' }, { id: 'btm2', name: '涓氬姟绫诲瀷2' }],
- fromBtmTypeName: '',
- toBtmTypeName: '',
- },
+ obj: {},
treeOption: {
defaultExpandAll: true,
title: '閾炬帴绫诲瀷鏍�',
addBtn: false,
props: {
labelText: '',
- label: 'name',
+ label: 'label',
value: 'oid',
children: 'childList',
}
@@ -225,31 +228,42 @@
},
created() {
this.initTreeOnLoad();
- // this.initDomainOption();
+ this.initDomainOption();
},
methods: {
// 鏍戠偣鍑�
nodeClick(data) {
- console.log(data);
+ getDetail(data.oid).then(res => {
+ this.obj = res.data.data;
+ })
},
// 娣诲姞鎸夐挳鐐瑰嚮浜嬩欢
linkTypeAdd() {
-
+ this.$refs.linkAdd.showSubmitDialog = true;
},
// 缂栬緫鎸夐挳鐐瑰嚮浜嬩欢
linkTypeEdit() {
-
+ this.addOption.linkType = this.obj;
+ this.$refs.linkAdd.linkType = this.addOption.linkType;
+ this.$refs.linkAdd.showSubmitDialog = true;
},
// 浠庡凡鏈変腑鑾峰彇鎸夐挳鐐瑰嚮浜嬩欢
selectFromTable() {
},
+ // 鍔犺浇鏈嶅姟鏍�
initTreeOnLoad() {
initTree().then(res => {
this.treeData = res.data.data;
});
- }
+ },
+ // 鍔犺浇鏈嶅姟涓嬫媺妗�
+ initDomainOption() {
+ getDomain().then(res => {
+ this.domainOptions = res.data.data;
+ })
+ },
}
}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-ddl-api/src/main/java/com/vci/ubcs/ddl/bo/DdlFieldMappingAttrBO.java b/Source/UBCS/ubcs-service-api/ubcs-ddl-api/src/main/java/com/vci/ubcs/ddl/bo/DdlFieldMappingAttrBO.java
index 101f07f..3de4dc4 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-ddl-api/src/main/java/com/vci/ubcs/ddl/bo/DdlFieldMappingAttrBO.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-ddl-api/src/main/java/com/vci/ubcs/ddl/bo/DdlFieldMappingAttrBO.java
@@ -18,7 +18,8 @@
/**
* 绫诲瀷
*/
- private final String dataType;
+ @Setter
+ private String dataType;
/**
* 闀垮害
@@ -44,6 +45,8 @@
@Setter
private String defaultValue;
+ public DdlFieldMappingAttrBO() {
+ }
public DdlFieldMappingAttrBO(String dataType, Integer dataLength, Integer dataPrecision, Boolean nullable, String defaultValue) {
this.dataType = dataType;
diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/LinkTypeAttribute.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/LinkTypeAttribute.java
index 785b2f9..339579a 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/LinkTypeAttribute.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/LinkTypeAttribute.java
@@ -15,7 +15,7 @@
* @date 2023/5/24
*/
@Data
-@TableName("pl_omd_link_type_attr")
+@TableName("pl_omd_link_type_attribute")
@ApiModel(value = "閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬�", description = "閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬�")
public class LinkTypeAttribute implements java.io.Serializable{
diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTreeVO.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTreeVO.java
index 7e45251..ec137bf 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTreeVO.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTreeVO.java
@@ -19,9 +19,11 @@
*/
private static final long serialVersionUID = -1243940048761060562L;
+ private String id;
+
private String name;
- private String id;
+ private String label;
private String oid;
diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeAttributeVO.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeAttributeVO.java
index f922f9c..0918d7e 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeAttributeVO.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeAttributeVO.java
@@ -1,5 +1,7 @@
package com.vci.ubcs.omd.vo;
+import lombok.Data;
+
import java.util.Date;
import java.util.Map;
@@ -8,6 +10,7 @@
* @author LiHang
* @date 2023/4/3
*/
+@Data
public class LinkTypeAttributeVO implements java.io.Serializable{
/**
@@ -24,6 +27,11 @@
* 鎵�灞炰笟鍔$被鍨�
*/
private String pkLinkType;
+
+ /**
+ * 閾炬帴绫诲瀷鐨勭紪鍙�
+ */
+ private String linkTypeId;
/**
* 灞炴�х殑瀛楁鍚嶇О
@@ -49,6 +57,11 @@
* 鏁版嵁绫诲瀷
*/
private String attrDataType;
+
+ /**
+ * 鏁版嵁绫诲瀷鏄剧ず瀵硅薄
+ */
+ private String attrDataTypeText;
/**
* 鏄惁鍙互涓虹┖
@@ -144,247 +157,4 @@
* 鏃堕棿鎴筹紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss.SSS
*/
private Date ts;
-
- public String getBtmName() {
- return btmName;
- }
-
- public void setBtmName(String btmName) {
- this.btmName = btmName;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public void setOid(String oid) {
- this.oid = oid;
- }
-
- public void setPkLinkType(String pkLinkType) {
- this.pkLinkType = pkLinkType;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setAttrDataType(String attrDataType) {
- this.attrDataType = attrDataType;
- }
-
- public void setReferBtmTypeId(String referBtmTypeId) {
- this.referBtmTypeId = referBtmTypeId;
- }
-
- public void setReferBtmTypeName(String referBtmTypeName) {
- this.referBtmTypeName = referBtmTypeName;
- }
-
- public void setReferFlag(boolean referFlag) {
- this.referFlag = referFlag;
- }
-
- public void setEnumId(String enumId) {
- this.enumId = enumId;
- }
-
- public void setEnumName(String enumName) {
- this.enumName = enumName;
- }
-
- public void setEnumFlag(boolean enumFlag) {
- this.enumFlag = enumFlag;
- }
-
- public void setEnumItemMap(Map<String, String> enumItemMap) {
- this.enumItemMap = enumItemMap;
- }
-
- public void setCreator(String creator) {
- this.creator = creator;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public void setLastModifier(String lastModifier) {
- this.lastModifier = lastModifier;
- }
-
- public void setLastModifyTime(Date lastModifyTime) {
- this.lastModifyTime = lastModifyTime;
- }
-
- public void setTs(Date ts) {
- this.ts = ts;
- }
-
- public void setNullableFlag(boolean nullableFlag) {
- this.nullableFlag = nullableFlag;
- }
-
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public void setPrecisionLength(Integer precisionLength) {
- this.precisionLength = precisionLength;
- }
-
-
- public String getOid() {
- return oid;
- }
-
- public String getPkLinkType() {
- return pkLinkType;
- }
-
-
- public String getDescription() {
- return description;
- }
-
- public String getAttrDataType() {
- return attrDataType;
- }
-
- public String getReferBtmTypeId() {
- return referBtmTypeId;
- }
-
- public String getReferBtmTypeName() {
- return referBtmTypeName;
- }
-
- public boolean isReferFlag() {
- return referFlag;
- }
-
- public String getEnumId() {
- return enumId;
- }
-
- public String getEnumName() {
- return enumName;
- }
-
- public boolean isEnumFlag() {
- return enumFlag;
- }
-
- public Map<String, String> getEnumItemMap() {
- return enumItemMap;
- }
-
- public String getCreator() {
- return creator;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getLastModifier() {
- return lastModifier;
- }
-
- public Date getLastModifyTime() {
- return lastModifyTime;
- }
-
- public Date getTs() {
- return ts;
- }
-
- public boolean isNullableFlag() {
- return nullableFlag;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public Integer getPrecisionLength() {
- return precisionLength;
- }
-
- public String getRange() {
- return range;
- }
-
- public void setRange(String range) {
- this.range = range;
- }
-
- public Integer getAttributeLength() {
- return attributeLength;
- }
-
- public void setAttributeLength(Integer attributeLength) {
- this.attributeLength = attributeLength;
- }
-
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getScaleLength() {
- return scaleLength;
- }
-
- public void setScaleLength(Integer scaleLength) {
- this.scaleLength = scaleLength;
- }
-
- @Override
- public String toString() {
- return "OsLinkTypeAttributeVO{" +
- "oid='" + oid + '\'' +
- ", pkLinkType='" + pkLinkType + '\'' +
- ", id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", description='" + description + '\'' +
- ", attributeLength=" + attributeLength +
- ", attrDataType='" + attrDataType + '\'' +
- ", nullableFlag=" + nullableFlag +
- ", defaultValue='" + defaultValue + '\'' +
- ", precisionLength=" + precisionLength +
- ", scaleLength=" + scaleLength +
- ", range='" + range + '\'' +
- ", referBtmTypeId='" + referBtmTypeId + '\'' +
- ", referBtmTypeName='" + referBtmTypeName + '\'' +
- ", referFlag=" + referFlag +
- ", enumId='" + enumId + '\'' +
- ", enumName='" + enumName + '\'' +
- ", enumFlag=" + enumFlag +
- ", enumItemMap=" + enumItemMap +
- ", btmname='" + btmName + '\'' +
- ", owner='" + owner + '\'' +
- ", creator='" + creator + '\'' +
- ", createTime=" + createTime +
- ", lastModifier='" + lastModifier + '\'' +
- ", lastModifyTime=" + lastModifyTime +
- ", ts=" + ts +
- '}';
- }
}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeVO.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeVO.java
index 423bac7..a47e1e1 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeVO.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/LinkTypeVO.java
@@ -124,6 +124,11 @@
*/
private String domain;
+ /**
+ * 棰嗗煙鏄剧ず鍊�
+ */
+ private String domainText;
+
/**
* 鍖呭惈灞炴��
*/
diff --git a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/IDdlService.java b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/IDdlService.java
index b8b06b3..2b2d1ea 100644
--- a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/IDdlService.java
+++ b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/IDdlService.java
@@ -36,13 +36,20 @@
void createDbTablesByOidCollection(Collection<String> oidCollection) throws VciBaseException;
/**
- * 鑾峰彇鍒涘缓鐨剆ql璇彞涓睘鎬ч儴鍒�
+ * 鑾峰彇鍒涘缓鐨剆ql璇彞涓睘鎬ч儴鍒� -- 涓氬姟绫诲瀷
* @param attributeVOList 灞炴�х殑绔嬬
* @return sql璇彞
*/
String getCreateSqlByAttributeForBtm(List<BtmTypeAttributeVO> attributeVOList);
/**
+ * 鑾峰彇鍒涘缓鐨剆ql璇彞涓睘鎬ч儴鍒� -- 閾炬帴绫诲瀷
+ * @param attributeVOList 灞炴�х殑绔嬬
+ * @return sql璇彞
+ */
+ String getCreateSqlByAttributeForLink(List<LinkTypeAttributeVO> attributeVOList);
+
+ /**
* 鎵归噺灏嗕笟鍔$被鍨嬪垱寤烘暟鎹簱琛�
* @param ids 涓氬姟绫诲瀷鐨勮嫳鏂囧悕绉�
* @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呭垱寤鸿〃鍑虹幇浜嗛敊璇殑鏃跺�欎細鎶涘嚭寮傚父
diff --git a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
index 3a8e185..cc39322 100644
--- a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
@@ -185,6 +185,26 @@
}
/**
+ * 鍒涘缓閾炬帴绫诲瀷鐨勮〃鏍�
+ *
+ * @param linkTypeVO 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+ * @throws VciBaseException 鎵ц鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ private void createDbTableForLink(LinkTypeVO linkTypeVO) throws VciBaseException {
+ VciBaseUtil.alertNotNull(linkTypeVO, "瑕佸垱寤鸿〃鏍兼墍灞炵殑涓氬姟绫诲瀷", linkTypeVO.getTableName(), "涓氬姟绫诲瀷鐨勮〃鏍煎悕绉�");
+ String tableName = linkTypeVO.getTableName();
+ if (!checkTableExistByTableName(tableName)) {
+ String attributeSql = getCreateSqlByAttributeForLink(linkTypeVO.getAttributes());
+ dllMapper.createTableBySql(tableName, attributeSql);
+ if (StringUtils.isNotBlank(linkTypeVO.getName())) {
+ dllMapper.commentTable(tableName, linkTypeVO.getName());
+ }
+ linkTypeVO.getAttributes().forEach(s -> {
+ dllMapper.commentColumnTable(tableName, s.getId(), s.getName());
+ });
+ }
+ }
+ /**
* 鑾峰彇鍒涘缓鐨剆ql璇彞涓睘鎬ч儴鍒�
*
* @param attributeVOList 灞炴�х殑绔嬬
@@ -196,7 +216,26 @@
attributeVOList.forEach(a -> {
sb.append(a.getId()).append(StringPool.SPACE);
VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.forValue(a.getAttrDataType());
- sb.append(dllMapper.getColumnTypeSql(fieldTypeEnum, a));
+ sb.append(dllMapper.getColumnTypeSql(fieldTypeEnum, a)).append(",");
+ });
+ return sb.substring(0, sb.lastIndexOf(","));
+ }
+
+ /**
+ * 鑾峰彇鍒涘缓鐨剆ql璇彞涓睘鎬ч儴鍒�
+ *
+ * @param attributeVOList 灞炴�х殑绔嬬
+ * @return sql璇彞
+ */
+ @Override
+ public String getCreateSqlByAttributeForLink(List<LinkTypeAttributeVO> attributeVOList) {
+ StringBuilder sb = new StringBuilder();
+ attributeVOList.forEach(a -> {
+ BtmTypeAttributeVO attributeVO = Optional.ofNullable(BeanUtil.copy(a, BtmTypeAttributeVO.class)).orElseGet(BtmTypeAttributeVO::new);
+ attributeVO.setPkBtmType(a.getPkLinkType());
+ sb.append(a.getId()).append(StringPool.SPACE);
+ VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.forValue(a.getAttrDataType());
+ sb.append(dllMapper.getColumnTypeSql(fieldTypeEnum, attributeVO)).append(",");
});
return sb.substring(0, sb.lastIndexOf(","));
}
@@ -210,19 +249,10 @@
@Override
public void createDbTablesById(String ids) throws VciBaseException {
VciBaseUtil.alertNotNull(ids, "涓氬姟绫诲瀷/閾炬帴绫诲瀷鐨勮嫳鏂囬泦鍚�");
- List<BtmTypeVO> btmTypeVOList = BtmTypeCache.selectByIdCollection(VciBaseUtil.str2List(ids));
-// List<OsLinkTypeVO> linkTypeVOList = linkTypeService.listLinkTypeByIdCollection(VciBaseUtil.str2List(ids));
- if (!CollectionUtils.isEmpty(btmTypeVOList)) {
- //璇存槑鏄笟鍔$被鍨�
- btmTypeVOList.forEach(this::createDbTableForBtm);
- }
- /*//璇曡瘯閾炬帴绫诲瀷
- if(!CollectionUtils.isEmpty(linkTypeVOList)){
- //鐨勭‘鏄摼鎺ョ被鍨�
- linkTypeVOList.stream().forEach( s -> {
- createDbTableForLink(s);
- });
- }*/
+ // 涓氬姟绫诲瀷
+ Func.toStrList(",",ids).stream().filter(idBtmMap::containsKey).map(idBtmMap::get).forEach(this::createDbTableForBtm);
+ // 閾炬帴绫诲瀷
+ Func.toStrList(",",ids).stream().filter(idLinkMap::containsKey).map(idLinkMap::get).forEach(this::createDbTableForLink);
}
/**
@@ -540,6 +570,7 @@
modifyAttributeInfo.setBeforeModifyAttributes(String.join(",", beforeList));
}
}
+ modifyAttributeInfoDOList.add(modifyAttributeInfo);
});
return modifyAttributeInfoDOList;
}
@@ -641,6 +672,7 @@
}
}
+ modifyAttributeInfoDOList.add(modifyAttributeInfo);
});
return modifyAttributeInfoDOList;
}
@@ -719,8 +751,8 @@
@Override
public void reflexDifferent(List<ModifyAttributeInfo> differentAttributeList, List<BtmTypeVO> btmTypeVOList, List<LinkTypeVO> linkTypeVOList) throws VciBaseException {
VciBaseUtil.alertNotNull(differentAttributeList, "瑕佹竻鐞嗙殑鏁版嵁搴撶殑淇℃伅涓虹┖");
- Map<String, BtmTypeVO> idBtmTypeMap = btmTypeVOList.stream().collect(Collectors.toMap(BtmTypeVO::getId, t -> t, (o1, o2) -> o1));
- Map<String, LinkTypeVO> idLinkTypeMap = linkTypeVOList.stream().collect(Collectors.toMap(LinkTypeVO::getId, t -> t, (o1, o2) -> o1));
+ Map<String, BtmTypeVO> idBtmTypeMap = Optional.ofNullable(btmTypeVOList).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(BtmTypeVO::getId, t -> t, (o1, o2) -> o1));
+ Map<String, LinkTypeVO> idLinkTypeMap = Optional.ofNullable(linkTypeVOList).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(LinkTypeVO::getId, t -> t, (o1, o2) -> o1));
differentAttributeList.forEach(s -> {
// BtmTypeVO btmType = idBtmTypeMap.get(id);
if (ModifyTableTaskEnum.CREATE.getValue().equalsIgnoreCase(s.getTaskName())) {
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LinkTypeController.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LinkTypeController.java
index 6d8170b..14c81d6 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LinkTypeController.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LinkTypeController.java
@@ -3,11 +3,9 @@
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.nacos.api.exception.NacosException;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.vci.ubcs.omd.constant.OmdCacheConstant;
-import com.vci.ubcs.omd.dto.LinkTypeDTO;
import com.vci.ubcs.omd.entity.LinkType;
import com.vci.ubcs.omd.repeater.DomainRepeater;
import com.vci.ubcs.omd.service.ILinkTypeService;
@@ -25,13 +23,11 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.*;
-import java.util.stream.Collectors;
/**
* Description:閾炬帴绫诲瀷鎺у埗鍣�
@@ -79,7 +75,7 @@
@ApiOperationSupport(order = 2)
@ApiOperation(value = "鏌ヨ鍒楄〃", notes = "浼犲叆鏌ヨ")
public R<List<LinkTypeVO>> list(@ApiIgnore @RequestParam Map<String, Object> condition) {
- return R.data(LinkTypeWrapper.build().listEntityVO(linkTypeService.list(Condition.getQueryWrapper(condition, LinkType.class).lambda().orderByAsc(LinkType::getId))));
+ return R.data(LinkTypeWrapper.build().listEntityVO(linkTypeService.list(Condition.getQueryWrapper(condition, LinkType.class).lambda().orderByAsc(LinkType::getId)), null));
}
/**
@@ -100,7 +96,7 @@
IPage<LinkTypeVO> pageVO = new Page<>();
IPage<LinkType> page = linkTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition, LinkType.class).lambda().orderByAsc(LinkType::getId));
BeanUtil.copy(page, pageVO);
- pageVO.setRecords(LinkTypeWrapper.build().listEntityVO(page.getRecords()));
+ pageVO.setRecords(LinkTypeWrapper.build().listEntityVO(page.getRecords(), null));
return R.data(pageVO);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILinkTypeAttributeService.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILinkTypeAttributeService.java
index fb44a66..5929edb 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILinkTypeAttributeService.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILinkTypeAttributeService.java
@@ -1,10 +1,13 @@
package com.vci.ubcs.omd.service;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.omd.entity.LinkType;
import com.vci.ubcs.omd.entity.LinkTypeAttribute;
import com.vci.ubcs.omd.vo.LinkTypeAttributeVO;
+import com.vci.ubcs.omd.vo.LinkTypeVO;
import java.util.List;
+import java.util.Map;
/**
* Description: 閾炬帴绫诲瀷鍖呭惈灞炴�х殑鏈嶅姟鎺ュ彛
@@ -32,4 +35,32 @@
* @return 鏌ヨ缁撴灉
*/
LinkTypeAttribute selectByPrimaryKey(String oid);
+
+ /**
+ * 鏍规嵁閾炬帴绫诲瀷鑾峰彇榛樿瀛楁
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ List<LinkTypeAttributeVO> getDefaultAttributes(LinkTypeVO linkTypeVO);
+
+ /**
+ * 鏍规嵁閾炬帴绫诲瀷鑾峰彇鎵�鏈夌殑瀛楁
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ List<LinkTypeAttributeVO> getAllAttributes(LinkTypeVO linkTypeVO);
+
+ /**
+ * 鑾峰彇闈為粯璁ゅ瓧娈电殑閾炬帴绫诲瀷灞炴��
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return
+ */
+ List<LinkTypeAttributeVO> getAttributesNoDefault(LinkTypeVO linkTypeVO);
+
+ /**
+ * 鎵归噺鑾峰彇闈為粯璁ゅ瓧娈电殑閾炬帴绫诲瀷灞炴��
+ * @param linkTypeDOList 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ Map<String, List<LinkTypeAttributeVO>> batchGetAttributesNoDefault(List<LinkType> linkTypeDOList);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java
index 6742b49..af80c13 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java
@@ -212,6 +212,8 @@
vo.setId(id);
vo.setName(name);
vo.setPkBtmType(btmType.getOid());
+ vo.setAttrDataType(VciFieldTypeEnum.VTString.name());
+ vo.setAttributeLength(150);
if (Arrays.asList("lastr","firstr","lastv","firstv","revisionseq","versionseq","revisionvalue","versionvalue").contains(id)){
vo.setAttributeLength(5);
vo.setAttrDataType(VciFieldTypeEnum.VTInteger.name());
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
index 2e7f48f..3444498 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
@@ -360,6 +360,7 @@
if (!existFieldMap.containsKey(k)){
BtmTypeLinkAttributesDTO attr = new BtmTypeLinkAttributesDTO();
attr.setId(k);
+ attr.setName(v);
attr.setAttrDataType(VciFieldTypeEnum.VTString.name());
attr.setAttributeLength(50);
attr.setNullableFlag(false);
@@ -507,10 +508,13 @@
afterAttributes = updateAttributeForBtm(btmTypeByOid.getOid(),beforeAttributes, attributes);
}
BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(btmTypeDO);
+ //鍦ㄥ垱寤鸿〃鐨勬椂鍊欒繕闇�瑕佹妸榛樿鐨勫瓧娈靛甫涓娿��
+ List<BtmTypeAttributeVO> defaultAttribute = btmTypeAttributeService.getDefaultAttribute(btmTypeVO);
+ afterAttributes.addAll(defaultAttribute);
btmTypeVO.setAttributes(afterAttributes);
try {
if (autoCreateTable) {
- checkTableSame(btmTypeVO);
+// checkTableSame(btmTypeVO);
R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), btmTypeVO);
if (result.isSuccess()){
List<ModifyAttributeInfo> infoList = new ArrayList<>();
@@ -598,7 +602,7 @@
new Object[]{btmTypeDTO.getRevisionRuleId(), btmTypeDTO.getRevisionRuleName()});
}
}
- btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP));
+// btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP));
}
if (btmTypeDTO.isLifeCycleFlag()){
// 闇�瑕佹帶鍒剁敓鍛藉懆鏈�
@@ -616,11 +620,11 @@
// new Object[]{btmTypeDTO.getSubLifeCycleId(), btmTypeDTO.getSubLifeCycleName()});
// }
// }
- btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP));
+// btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP));
}
if (btmTypeDTO.isSecretFlag()){
// 闇�瑕佹帶鍒跺瘑绾�
- btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP));
+// btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP));
}
}
@Override
@@ -650,12 +654,14 @@
String label = domain.get(k);
BtmTreeVO parent = new BtmTreeVO();
parent.setName(label);
+ parent.setLabel(label);
parent.setId(k);
parent.setChildList(v.stream().map(s -> {
BtmTreeVO child = new BtmTreeVO();
child.setOid(s.getOid());
- child.setName(s.getId() + " " + (s.getName() == null ? "" : s.getName()));
+ child.setName(s.getName());
child.setId(s.getId());
+ child.setLabel(s.getId() + (s.getName() == null ? "" : "(" + s.getName() + ")"));
return child;
}).collect(Collectors.toList()));
treeList.add(parent);
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeAttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeAttributeServiceImpl.java
index f71b4d3..0908a51 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeAttributeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeAttributeServiceImpl.java
@@ -1,18 +1,27 @@
package com.vci.ubcs.omd.service.impl;
+import com.alibaba.cloud.commons.lang.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vci.ubcs.omd.constant.BtmTypeFieldConstant;
+import com.vci.ubcs.omd.entity.LinkType;
import com.vci.ubcs.omd.entity.LinkTypeAttribute;
import com.vci.ubcs.omd.mapper.LinkTypeAttributeMapper;
import com.vci.ubcs.omd.service.IAttributeService;
import com.vci.ubcs.omd.service.ILinkTypeAttributeService;
+import com.vci.ubcs.omd.vo.BtmTypeAttributeVO;
import com.vci.ubcs.omd.vo.LinkTypeAttributeVO;
+import com.vci.ubcs.omd.vo.LinkTypeVO;
+import com.vci.ubcs.omd.wrapper.LinkTypeAttributeWrapper;
+import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* Description: 閾炬帴绫诲瀷鍖呭惈灞炴�х殑鏈嶅姟
@@ -56,4 +65,80 @@
VciBaseUtil.alertNotNull(oid);
return baseMapper.selectOne(Wrappers.<LinkTypeAttribute>query().lambda().eq(LinkTypeAttribute::getOid,oid));
}
+
+ /**
+ * 鏍规嵁閾炬帴绫诲瀷鑾峰彇榛樿瀛楁
+ *
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public List<LinkTypeAttributeVO> getDefaultAttributes(LinkTypeVO linkTypeVO) {
+ Objects.requireNonNull(linkTypeVO,"閾炬帴绫诲瀷涓嶈兘涓虹┖");
+ List<LinkTypeAttributeVO> list = new ArrayList<>();
+ // 涓氬姟绫诲瀷鐨勫熀鏈瓧娈�
+ BtmTypeFieldConstant.LINK_TYPE_FIELD_MAP.forEach((id, name) -> {
+ LinkTypeAttributeVO vo = new LinkTypeAttributeVO();
+ vo.setId(id);
+ vo.setName(name);
+ vo.setPkLinkType(linkTypeVO.getOid());
+ if (StringUtils.equals(id,"oid")){
+ vo.setNullableFlag(false);
+ }else {
+ vo.setNullableFlag(true);
+ }
+ if (Arrays.asList("createtime","lastmodifytime","owner").contains(id)){
+ vo.setAttrDataType(VciFieldTypeEnum.VTDateTime.name());
+ vo.setAttributeLength(6);
+ }else {
+ vo.setAttrDataType(VciFieldTypeEnum.VTString.name());
+ vo.setAttributeLength(150);
+ }
+ list.add(vo);
+ });
+ return list;
+ }
+
+ /**
+ * 鏍规嵁閾炬帴绫诲瀷鑾峰彇鎵�鏈夌殑瀛楁
+ *
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public List<LinkTypeAttributeVO> getAllAttributes(LinkTypeVO linkTypeVO) {
+ Objects.requireNonNull(linkTypeVO,"閾炬帴绫诲瀷涓嶈兘涓虹┖");
+ List<LinkTypeAttributeVO> attributes = getAttributesNoDefault(linkTypeVO);
+ attributes.addAll(getDefaultAttributes(linkTypeVO));
+ return attributes;
+ }
+
+ /**
+ * 鑾峰彇闈為粯璁ゅ瓧娈电殑閾炬帴绫诲瀷灞炴��
+ *
+ * @param linkTypeVO 閾炬帴绫诲瀷
+ * @return
+ */
+ @Override
+ public List<LinkTypeAttributeVO> getAttributesNoDefault(LinkTypeVO linkTypeVO) {
+ Objects.requireNonNull(linkTypeVO,"閾炬帴绫诲瀷涓嶈兘涓虹┖");
+ return LinkTypeAttributeWrapper.build().listEntityVO(baseMapper.selectList(Wrappers.<LinkTypeAttribute>query().lambda().eq(LinkTypeAttribute::getPkLinkType, linkTypeVO.getOid())));
+ }
+
+ /**
+ * 鎵归噺鑾峰彇闈為粯璁ゅ瓧娈电殑閾炬帴绫诲瀷灞炴��
+ *
+ * @param linkTypeDOList 閾炬帴绫诲瀷
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public Map<String, List<LinkTypeAttributeVO>> batchGetAttributesNoDefault(List<LinkType> linkTypeDOList) {
+ VciBaseUtil.alertNotNull(linkTypeDOList,"閾炬帴绫诲瀷闆嗗悎");
+ Set<String> oidSet = linkTypeDOList.stream().map(LinkType::getOid).collect(Collectors.toSet());
+ if (CollectionUtils.isEmpty(oidSet)){
+ return new HashMap<>();
+ }
+ List<LinkTypeAttribute> attributes = baseMapper.selectList(Wrappers.<LinkTypeAttribute>query().lambda().in(LinkTypeAttribute::getPkLinkType, oidSet));
+ return LinkTypeAttributeWrapper.build().listEntityVO(Optional.ofNullable(attributes).orElseGet(ArrayList::new)).stream().collect(Collectors.groupingBy(LinkTypeAttributeVO::getPkLinkType));
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeServiceImpl.java
index e616cd2..571c89d 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LinkTypeServiceImpl.java
@@ -4,15 +4,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.api.exception.NacosException;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
-import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
-import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
-import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
-import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper;
-import com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.omd.constant.BtmTypeConstant;
import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO;
@@ -27,7 +20,6 @@
import com.vci.ubcs.omd.repeater.DomainRepeater;
import com.vci.ubcs.omd.service.*;
import com.vci.ubcs.omd.vo.*;
-import com.vci.ubcs.omd.wrapper.BtmTypeWrapper;
import com.vci.ubcs.omd.wrapper.LinkTypeAttributeWrapper;
import com.vci.ubcs.omd.wrapper.LinkTypeWrapper;
import com.vci.ubcs.starter.exception.VciBaseException;
@@ -49,12 +41,11 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.util.CollectionUtils;
-import java.io.Serializable;
import java.util.*;
-import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -169,7 +160,8 @@
if(!CollectionUtils.isEmpty(pkLinkTypeCollection)){
List<LinkType> linkTypeDOList = listLinkTypeDOByOidCollection(pkLinkTypeCollection);
if(!CollectionUtils.isEmpty(linkTypeDOList)) {
- return LinkTypeWrapper.build().listEntityVO(linkTypeDOList);
+ Map<String,List<LinkTypeAttributeVO>> pkLinkTypeAndAttributeMap = linkTypeAttributeService.batchGetAttributesNoDefault(linkTypeDOList);
+ return LinkTypeWrapper.build().listEntityVO(linkTypeDOList,pkLinkTypeAndAttributeMap);
}
}
return null;
@@ -194,6 +186,7 @@
linkTypeDOList.addAll(linkTypeDOS);
}
});
+ return linkTypeDOList;
}
return null;
}
@@ -241,7 +234,8 @@
if(!CollectionUtils.isEmpty(linkTypeIdCollection)){
List<LinkType> linkTypeDOList = listLinkTypeDOByIdCollection(linkTypeIdCollection);
if(!CollectionUtils.isEmpty(linkTypeDOList)) {
- return LinkTypeWrapper.build().listEntityVO(linkTypeDOList);
+ Map<String,List<LinkTypeAttributeVO>> pkLinkTypeAndAttributeMap = linkTypeAttributeService.batchGetAttributesNoDefault(linkTypeDOList);
+ return LinkTypeWrapper.build().listEntityVO(linkTypeDOList, pkLinkTypeAndAttributeMap);
}
}
return null;
@@ -352,6 +346,7 @@
* @throws VciBaseException 娣诲姞鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
@Override
+ @Transactional
public LinkTypeVO addSave(LinkTypeVO linkTypeVO, boolean autoCreateTable) throws VciBaseException {
TransactionStatus transaction = null;
if(autoCreateTable) {
@@ -398,20 +393,29 @@
}
LinkType linkTypeDO = new LinkType();
BeanUtil.copy(linkTypeVO, linkTypeDO);
+ if (StringUtils.isBlank(linkTypeDO.getTableName())){
+ linkTypeDO.setTableName(getTableName(linkTypeDO.getId(),linkTypeDO.getDomain()));
+ }
String creator = AuthUtil.getUserAccount();
Date now = new Date();
- linkTypeDO.setCreator(creator);
- linkTypeDO.setCreateTime(now);
- linkTypeDO.setOwner(creator);
- linkTypeDO.setBtmName(BtmTypeConstant.LINK_TYPE);
- linkTypeDO.setTs(now);
+ LinkTypeWrapper.build().setBeforeInsert(linkTypeDO,creator,now);
//澶勭悊灞炴��
- addAttributeForLink(linkTypeVO.getAttributes(),linkTypeDO.getOid(),creator,now);
+ List<LinkTypeAttributeVO> attributeVOList = addAttributeForLink(linkTypeVO.getAttributes(), linkTypeDO.getOid(), creator, now);
baseMapper.insert(linkTypeDO);
if(autoCreateTable) {
- dataSourceTransactionManager.commit(transaction);
+ LinkTypeVO typeVO = LinkTypeWrapper.build().entityVO(linkTypeDO);
+ typeVO.setAttributes(attributeVOList);
+ List<LinkTypeAttributeVO> attributes = typeVO.getAttributes();
+ attributes.addAll(linkTypeAttributeService.getDefaultAttributes(typeVO));
+ typeVO.setAttributes(attributes);
+ R r = DomainRepeater.submitLinkType(typeVO.getDomain(), typeVO);
+ if (!r.isSuccess()){
+ dataSourceTransactionManager.rollback(transaction);
+ }else {
+ dataSourceTransactionManager.commit(transaction);
+ }
}
}catch (VciBaseException e){
if(autoCreateTable) {
@@ -424,9 +428,9 @@
}
throw e;
}
- if(autoCreateTable) {
+ /*if(autoCreateTable) {
checkTableSame(linkTypeVO);
- }
+ }*/
return linkTypeVO;
}
@@ -437,11 +441,11 @@
* @param creator 鍒涘缓浜�
* @param now 褰撳墠鏃堕棿
*/
- private void addAttributeForLink(List<LinkTypeAttributeVO> attributesVOList,String pkLinkType,String creator,Date now){
+ private List<LinkTypeAttributeVO> addAttributeForLink(List<LinkTypeAttributeVO> attributesVOList,String pkLinkType,String creator,Date now){
List<LinkTypeAttribute> linkTypeAttributeDOList = new ArrayList<>();
if(!CollectionUtils.isEmpty(attributesVOList)) {
List<String> attributeIdList = new ArrayList<>();
- attributesVOList.stream().forEachOrdered(s -> {
+ attributesVOList.forEach(s -> {
linkTypeAttributeService.checkAttribute(s);
linkTypeAttributeDOList.add(LinkTypeAttributeWrapper.build().copyVO2DO(s, pkLinkType, creator, now));
attributeIdList.add(s.getId().toLowerCase().trim());
@@ -449,7 +453,9 @@
//妫�鏌ュ睘鎬ф槸鍚﹂兘瀛樺湪
attributeService.checkAttributeExists(attributeIdList);
linkTypeAttributeService.saveOrUpdateBatch(linkTypeAttributeDOList,10000);
+ return LinkTypeAttributeWrapper.build().listEntityVO(linkTypeAttributeDOList);
}
+ return null;
}
/**
@@ -478,8 +484,8 @@
}
if (!CollectionUtils.isEmpty(modifyAttributeInfoDOList)) {
modifyAttributeService.saveOrUpdateBatch(modifyAttributeInfoDOList);
+ modifyAttributeService.finishModify(modifyAttributeInfoDOList);
}
- modifyAttributeService.finishModify(modifyAttributeInfoDOList);
}
/**
@@ -542,15 +548,10 @@
if(StringUtils.isNotBlank(unExistBtmTypeId)){
throw new VciBaseException("閾炬帴绫诲瀷浣跨敤鐨勪笟鍔$被鍨媨0}涓嶅瓨鍦紝璇锋煡璇�",new Object[]{unExistBtmTypeId});
}
-
String creator = AuthUtil.getUserAccount();
Date now = new Date();
- linkTypeDO.setLastModifier(creator);
- linkTypeDO.setLastModifyTime(now);
- linkTypeDO.setTs(now);
+ linkTypeDO = LinkTypeWrapper.build().setBeforeUpdate(linkTypeDO,creator,now);
//澶勭悊灞炴��
-
-
LinkTypeWrapper.build().copyLinkTypeVO2DO(linkTypeVO,linkTypeDO,creator,new Date());
//鍏堟煡璇㈣繖涓摼鎺ョ被鍨嬪寘鍚灏戝睘鎬�
@@ -564,22 +565,23 @@
}
saveOrUpdate(linkTypeDO);
if(autoCreateTable) {
+ List<LinkTypeAttributeVO> defaultAttributes = linkTypeAttributeService.getDefaultAttributes(linkTypeVO);
+ List<LinkTypeAttributeVO> attributes = linkTypeVO.getAttributes();
+ attributes.addAll(defaultAttributes);
+ linkTypeVO.setAttributes(attributes);
+ BtmAndLinkTypeDdlDTO ddlDTO = new BtmAndLinkTypeDdlDTO();
+ DomainRepeater.checkDifferent(ddlDTO,linkTypeVO.getDomain());
dataSourceTransactionManager.commit(transaction);
}
- }catch (VciBaseException e){
+ } catch (Throwable e){
if(autoCreateTable) {
dataSourceTransactionManager.rollback(transaction);
}
- throw e;
- }catch (Throwable e) {
- if(autoCreateTable) {
- dataSourceTransactionManager.rollback(transaction);
- }
- throw e;
+ throw new VciBaseException(e.getMessage());
}
- if(autoCreateTable) {
+ /*if(autoCreateTable) {
checkTableSame(linkTypeVO);
- }
+ }*/
return linkTypeVO;
}
@@ -807,19 +809,19 @@
attributeVO.setLastModifier(creator);
attributeVO.setLastModifyTime(now);
attributeVO.setTs(now);
- //鏌ヨ閾炬帴绫诲瀷鏄惁瀛樺湪
linkTypeAttributeService.saveOrUpdate(attributeDO);
if (autoEdit2Table) {
BtmAndLinkTypeDdlDTO ddlDTO = new BtmAndLinkTypeDdlDTO();
-// ddlDTO.setLinkTypeList();
-// DomainRepeater.checkDifferent(,domain);
+ LinkTypeVO linkTypeVO = LinkTypeWrapper.build().entityVO(linkTypeDO);
+ ddlDTO.setLinkTypeList(Collections.singletonList(linkTypeVO));
+ DomainRepeater.checkDifferent(ddlDTO,domain);
dataSourceTransactionManager.commit(transaction);
}
-// }catch (NacosException e){
-// if(autoEdit2Table) {
-// dataSourceTransactionManager.rollback(transaction);
-// }
-// throw new RuntimeException(e);
+ }catch (NacosException e){
+ if(autoEdit2Table) {
+ dataSourceTransactionManager.rollback(transaction);
+ }
+ throw new RuntimeException(e);
}catch (Throwable e){
if(autoEdit2Table) {
dataSourceTransactionManager.rollback(transaction);
@@ -873,7 +875,7 @@
public List<BtmTreeVO> treeDomain() {
try {
Map<String, String> domain = Optional.ofNullable(DomainRepeater.getDomain()).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(DomainVO::getValue, DomainVO::getLabel));
- List<LinkTypeVO> vos = LinkTypeWrapper.build().listEntityVO(baseMapper.selectAll());
+ List<LinkTypeVO> vos = LinkTypeWrapper.build().listEntityVO(baseMapper.selectAll(), null);
Map<String, List<LinkTypeVO>> domainMap = vos.stream().collect(Collectors.groupingBy(LinkTypeVO::getDomain));
List<BtmTreeVO> treeList = new ArrayList<>();
domainMap.forEach((k,v)-> {
@@ -882,11 +884,13 @@
BtmTreeVO parent = new BtmTreeVO();
parent.setName(label);
parent.setId(k);
+ parent.setLabel(label);
parent.setChildList(v.stream().map(s -> {
BtmTreeVO child = new BtmTreeVO();
child.setOid(s.getOid());
- child.setName(s.getId() + " " + (s.getName() == null ? "" : s.getName()));
+ child.setLabel(s.getId() + (s.getName() == null ? "" : "(" + s.getName() + ")"));
child.setId(s.getId());
+ child.setName(s.getName());
return child;
}).collect(Collectors.toList()));
treeList.add(parent);
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeAttributeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeAttributeWrapper.java
index f9574b3..086aeb0 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeAttributeWrapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeAttributeWrapper.java
@@ -1,5 +1,6 @@
package com.vci.ubcs.omd.wrapper;
+import com.vci.ubcs.omd.cache.EnumCache;
import com.vci.ubcs.omd.constant.BtmTypeConstant;
import com.vci.ubcs.omd.dto.BtmTypeLinkAttributesDTO;
import com.vci.ubcs.omd.entity.BtmTypeAttribute;
@@ -34,6 +35,7 @@
public BtmTypeAttributeVO entityVO(BtmTypeAttribute entity) {
BtmTypeAttributeVO vo = Objects.requireNonNull(BeanUtil.copy(entity, BtmTypeAttributeVO.class));
// 鍦ㄨ繖閲岃缃灇涓炬樉绀哄��
+ vo.setAttrDataTypeText(EnumCache.getValue("attributeType",vo.getAttrDataType()));
return vo;
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeAttributeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeAttributeWrapper.java
index 9186157..4b4222b 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeAttributeWrapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeAttributeWrapper.java
@@ -1,6 +1,7 @@
package com.vci.ubcs.omd.wrapper;
import com.alibaba.cloud.commons.lang.StringUtils;
+import com.vci.ubcs.omd.cache.EnumCache;
import com.vci.ubcs.omd.constant.BtmTypeConstant;
import com.vci.ubcs.omd.entity.LinkTypeAttribute;
import com.vci.ubcs.omd.vo.LinkTypeAttributeVO;
@@ -29,6 +30,7 @@
@Override
public LinkTypeAttributeVO entityVO(LinkTypeAttribute entity) {
LinkTypeAttributeVO vo = BeanUtil.copy(entity, LinkTypeAttributeVO.class);
+ vo.setAttrDataTypeText(EnumCache.getValue("attributeType",vo.getAttrDataType()));
return vo;
}
@@ -49,6 +51,8 @@
attributeDO.setCreateTime(now);
attributeDO.setTs(now);
attributeDO.setOwner(creator);
+ attributeDO.setLastModifier(creator);
+ attributeDO.setLastModifyTime(now);
attributeDO.setBtmName(BtmTypeConstant.LINK_TYPE_ATTRIBUTE);
return attributeDO;
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeWrapper.java
index 6086205..7406ba9 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeWrapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LinkTypeWrapper.java
@@ -1,15 +1,19 @@
package com.vci.ubcs.omd.wrapper;
+import com.vci.ubcs.omd.cache.BtmTypeCache;
import com.vci.ubcs.omd.constant.BtmTypeConstant;
import com.vci.ubcs.omd.entity.LinkType;
+import com.vci.ubcs.omd.vo.BtmTypeVO;
+import com.vci.ubcs.omd.vo.LinkTypeAttributeVO;
import com.vci.ubcs.omd.vo.LinkTypeVO;
+import com.vci.ubcs.starter.web.enumpck.NewAppConstantEnum;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.util.CollectionUtils;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -26,13 +30,39 @@
@Override
public LinkTypeVO entityVO(LinkType entity) {
- LinkTypeVO vo = BeanUtil.copy(entity, LinkTypeVO.class);
+ LinkTypeVO vo = Optional.ofNullable(BeanUtil.copy(entity, LinkTypeVO.class)).orElseGet(LinkTypeVO::new);
+ List<String> fromIdList = Func.toStrList(",", vo.getFromBtmType());
+ List<String> toIdList = Func.toStrList(",", vo.getToBtmType());
+ Set<String> btmIdSet = new HashSet<>();
+ btmIdSet.addAll(fromIdList);
+ btmIdSet.addAll(toIdList);
+ List<BtmTypeVO> btmTypeVOList = BtmTypeCache.selectByIdCollection(new ArrayList<>(btmIdSet));
+ List<BtmTypeVO> fromBtm = new ArrayList<>();
+ List<BtmTypeVO> toBtm = new ArrayList<>();
+ Optional.ofNullable(btmTypeVOList).orElseGet(ArrayList::new).forEach(btm -> {
+ if (vo.getFromBtmType().contains(btm.getId())){
+ fromBtm.add(btm);
+ }
+ if (vo.getToBtmType().contains(btm.getId())){
+ toBtm.add(btm);
+ }
+ });
+ vo.setFromBtmTypes(fromBtm);
+ vo.setToBtmTypes(toBtm);
// 鏋氫妇澶勭悊
+ vo.setDomainText(NewAppConstantEnum.getTextByName(vo.getDomain()));
return vo;
}
- public List<LinkTypeVO> listEntityVO(List<LinkType> entityList){
- return Optional.ofNullable(entityList).orElseGet(ArrayList::new).stream().map(this::entityVO).collect(Collectors.toList());
+ public List<LinkTypeVO> listEntityVO(List<LinkType> entityList, Map<String, List<LinkTypeAttributeVO>> pkLinkTypeAndAttributeMap){
+ List<LinkTypeVO> voList = Optional.ofNullable(entityList).orElseGet(ArrayList::new).stream().map(this::entityVO).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(voList) && pkLinkTypeAndAttributeMap != null){
+ voList.forEach(vo -> {
+ List<LinkTypeAttributeVO> attributes = pkLinkTypeAndAttributeMap.getOrDefault(vo.getOid(), new ArrayList<>());
+ vo.setAttributes(attributes);
+ });
+ }
+ return voList;
}
public void copyLinkTypeVO2DO(LinkTypeVO linkTypeVO, LinkType linkTypeDO, String creator, Date now) {
@@ -51,4 +81,36 @@
linkTypeDO.setLastModifyTime(now);
linkTypeDO.setBtmName(BtmTypeConstant.LINK_TYPE);
}
+
+ /**
+ * 缂栬緫淇濆瓨鍓嶈缃粯璁ゅ瓧娈靛��
+ *
+ * @param linkTypeDO 閾炬帴绫诲瀷
+ * @param modifier 淇敼浜�
+ * @param modifyTime 淇敼鏃堕棿
+ * @return
+ */
+ public LinkType setBeforeUpdate(LinkType linkTypeDO, String modifier, Date modifyTime) {
+ linkTypeDO.setLastModifier(modifier);
+ linkTypeDO.setTs(modifyTime);
+ linkTypeDO.setLastModifyTime(modifyTime);
+ return linkTypeDO;
+ }
+
+ /**
+ * 鎻掑叆鍓嶈缃粯璁ゅ瓧娈�
+ * @param linkTypeDO 閾炬帴绫诲瀷
+ * @param creator 鍒涘缓浜�
+ * @param createTime 鍒涘缓鏃堕棿
+ */
+ public void setBeforeInsert(LinkType linkTypeDO, String creator, Date createTime) {
+ linkTypeDO.setOid(VciBaseUtil.getPk());
+ linkTypeDO.setCreator(creator);
+ linkTypeDO.setCreateTime(createTime);
+ linkTypeDO.setOwner(creator);
+ linkTypeDO.setBtmName(BtmTypeConstant.LINK_TYPE);
+ linkTypeDO.setTs(createTime);
+ linkTypeDO.setLastModifyTime(createTime);
+ linkTypeDO.setLastModifier(creator);
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/LinkTypeAttributeMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/LinkTypeAttributeMapper.xml
index 87e6848..d68ea8d 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/LinkTypeAttributeMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/LinkTypeAttributeMapper.xml
@@ -33,6 +33,6 @@
</sql>
<sql id="tableName">
- pl_omd_link_type_attr
+ pl_omd_link_type_attribute
</sql>
</mapper>
--
Gitblit v1.9.3