From 41c256180e5e7900c88b71a9f22590db21f87a7a Mon Sep 17 00:00:00 2001 From: lihang <lihang@vci-tech.com> Date: 星期二, 09 五月 2023 16:54:36 +0800 Subject: [PATCH] 业务类型修正 --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/repeater/DomainRepeater.java | 75 ++- Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/constant/BtmTypeFieldConstant.java | 8 Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeVO.java | 5 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/BtmTypeController.java | 75 +++ Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmTypeAttribute.java | 4 Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeMapper.xml | 221 +++++++++++ Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java | 2 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeMapper.java | 14 Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeTreeVO.java | 27 + Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmAttributeServiceImpl.java | 12 Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/Attribute.java | 2 Source/UBCS-WEB/src/api/omd/btmType.js | 43 ++ Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java | 7 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java | 7 Source/UBCS-WEB/src/views/modeling/original.vue | 4 Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/ModifyAttributeInfo.java | 5 Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml | 76 ++- Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeAttributeMapper.xml | 111 +++++ Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue | 112 +++++ Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/processor/dll/DllMapperProcessor.java | 16 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeAttributeService.java | 6 Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmType.java | 2 Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/ModifyAttributeInfoMapper.xml | 47 ++ Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java | 22 + Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java | 2 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeAttributeMapper.java | 4 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java | 184 +++++++++ 27 files changed, 974 insertions(+), 119 deletions(-) diff --git a/Source/UBCS-WEB/src/api/omd/btmType.js b/Source/UBCS-WEB/src/api/omd/btmType.js new file mode 100644 index 0000000..1d9218e --- /dev/null +++ b/Source/UBCS-WEB/src/api/omd/btmType.js @@ -0,0 +1,43 @@ +import request from '@/router/axios'; + +export const initTree = () => { + return request({ + url: '/api/ubcs-omd/btm-type/tree-domain', + method: 'get', + }) +} + +export const refOnLoad = (domain) => { + return request({ + url: '/api/ubcs-omd/btm-type/get-from-table', + method: 'get', + params: { + domain: domain + } + }) +} + +export const getDomain = () => { + return request({ + url: '/api/ubcs-omd/btm-type/domain', + method: 'get' + }) +} + +export const saveFromTable = (list,domain) => { + return request({ + url: '/api/ubcs-omd/btm-type/save-from-table/' + domain, + method: 'post', + data: list + }) +} + +export const getDetail = (oid) => { + return request({ + url: '/api/ubcs-omd/btm-type/detail', + method: 'get', + params: { + oid: oid + } + }) +} \ No newline at end of file diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue new file mode 100644 index 0000000..5a75644 --- /dev/null +++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue @@ -0,0 +1,112 @@ +<template> + <el-dialog + title="涓氬姟绫诲瀷" + :visible.sync="showSubmitDialog" + append-to-body + @close="closeSubmitDialog" + width="70%" + > + <el-form ref="form" :model="btmType" show-message="true" inline> + <el-form-item label="鑻辨枃鍚嶇О:" label-width="100px"> + <el-input v-model="btmType.id" prefix-icon="el-icon-finished"></el-input> + </el-form-item> + <el-form-item label="涓枃鍚嶇О:" label-width="100px"> + <el-input v-model="btmType.name" prefix-icon="el-icon-info"></el-input> + </el-form-item> + <el-form-item label="鏁版嵁搴撹〃鍚�:" label-width="100px"> + <el-input v-model="btmType.tableName" prefix-icon="el-icon-date"></el-input> + </el-form-item> + <el-form-item label="鎵�灞為鍩�:" label-width="100px"> + <el-select v-model="btmType.domain" prefix-icon="el-icon-folder-opened"> + <el-option v-for="item in domainOption" + :label="item"></el-option> + </el-select> + </el-form-item> + <el-form-item label="鐗堟湰瑙勫垯:" label-width="100px"> + <el-input v-model="btmType.revisionRuleId" prefix-icon="el-icon-s-check"></el-input> + </el-form-item> + <el-form-item label="鐢熷懡鍛ㄦ湡:" label-width="100px"> + <el-input v-model="btmType.lifeCycleId" prefix-icon="el-icon-refresh-right"></el-input> + </el-form-item> + <el-form-item label="瑙嗗浘:" label-width="100px"> + <el-input v-model="btmType.view" prefix-icon="el-icon-view"></el-input> + </el-form-item> + <el-form-item label="鎻忚堪:" label-width="100px"> + <el-input v-model="btmType.description" + prefix-icon="el-icon-chat-line-square" + style="width:254%;"></el-input> + </el-form-item> + </el-form> + <avue-crud :option="option" :data="btmType.attributes"></avue-crud> + </el-dialog> +</template> + + +<script> +import { } from '@/api/omd/btmType'; +import { } from '@/api/omd/OmdAttribute'; +export default { + name: 'BusinessAdd', + props: { + btmType:{ + type: Object + }, + domainOption:{ + type: Array + } + }, + data() { + return { + form: {}, + showSubmitDialog : false, + option: { + height: "330px", + selection: true, + headerAlign: 'center', + border: true, + index: true, + rowKey: 'id', + tabs: true, + menu: false, + highlightCurrentRow: true, + column: [ + { + label: '灞炴�ц嫳鏂囧悕绉�', + prop: 'id', + align: 'center' + }, { + label: '灞炴�т腑鏂囧悕绉�', + prop: 'name', + align: 'center' + }, + { + label: "灞炴�х被鍨�", + prop: "attrDataType", + align: 'center' + }, + { + label: "榛樿鍊�", + prop: "defaultValue", + align: 'center' + }, + { + label: "璇存槑", + prop: "description", + align: 'center' + } + ] + }, + } + }, + created() { + console.log('123'); + }, + methods: { + closeSubmitDialog(){ + this.showSubmitDialog = false; + } + } +} +</script> + +<style></style> \ No newline at end of file diff --git a/Source/UBCS-WEB/src/views/modeling/original.vue b/Source/UBCS-WEB/src/views/modeling/original.vue index 8597d3e..818ba05 100644 --- a/Source/UBCS-WEB/src/views/modeling/original.vue +++ b/Source/UBCS-WEB/src/views/modeling/original.vue @@ -147,6 +147,7 @@ index: true, rowKey: 'id', tabs: true, + highlightCurrentRow:true, column: [ { label: '灞炴�х紪鍙�', @@ -540,6 +541,9 @@ this.loading = false; this.data = res.data.data.records this.itemData = this.data[0]; + this.$nextTick(() => { + this.$refs.crud.setCurrentRow(this.data[0]); + }) }) }, rowClick(row) { diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/constant/BtmTypeFieldConstant.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/constant/BtmTypeFieldConstant.java index 67c34cc..674618c 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/constant/BtmTypeFieldConstant.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/constant/BtmTypeFieldConstant.java @@ -74,10 +74,10 @@ }; BASE_MODEL_COMPATIBILITY_MAP = new HashMap() { { - this.put("lastr", "islastr"); - this.put("firstr", "isfirstr"); - this.put("lastv", "islastv"); - this.put("firstv", "isfirstv"); + this.put("lastr", "lastr"); + this.put("firstr", "firstr"); + this.put("lastv", "lastv"); + this.put("firstv", "firstv"); } }; LIFECYCLE_MANAGE_FIELD_MAP = new HashMap() { diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/Attribute.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/Attribute.java index 8abd472..6d45916 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/Attribute.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/Attribute.java @@ -126,7 +126,7 @@ */ @ApiModelProperty("鍙傜収鐨勪富閿�") @JsonSerialize(using = ToStringSerializer.class) - private Long referToId; + private String referToId; /** * 鍙傜収瀵硅薄鐨勫悕绉� diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmType.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmType.java index c221329..e6c83e0 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmType.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmType.java @@ -135,7 +135,7 @@ /** * 涓氬姟绫诲瀷鍚嶇О */ - private String btmname; + private String btmName; /** * 鎷ユ湁鑰� diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmTypeAttribute.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmTypeAttribute.java index 28738a4..9d902d0 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmTypeAttribute.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/BtmTypeAttribute.java @@ -14,7 +14,7 @@ * @date 2019/10/11 3:21 PM */ @Data -@TableName("pl_omd_btm_type_attr") +@TableName("pl_omd_btm_type_attribute") @ApiModel(value = "涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬�", description = "涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬�") public class BtmTypeAttribute implements java.io.Serializable{ @@ -106,7 +106,7 @@ /** * 涓氬姟绫诲瀷鍚嶇О */ - private String btmname; + private String btmName; /** * 鎷ユ湁鑰� diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/ModifyAttributeInfo.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/ModifyAttributeInfo.java index 6526d96..82a2d1c 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/ModifyAttributeInfo.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/entity/ModifyAttributeInfo.java @@ -125,4 +125,9 @@ * 鍒涘缓鏃堕棿 */ private Date createTime; + + /** + * 鏃堕棿鎴� + */ + private Date ts; } diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeTreeVO.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeTreeVO.java new file mode 100644 index 0000000..e0d2770 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeTreeVO.java @@ -0,0 +1,27 @@ +package com.vci.ubcs.omd.vo; + + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * Description: 涓氬姟绫诲瀷鏍戠殑鏄剧ず瀵硅薄 + * + * @author LiHang + * @date 2023/5/5 + */ +@Data +public class BtmTypeTreeVO implements Serializable{ + /** + * 搴忓垪鍖� + */ + private static final long serialVersionUID = -1243940048761060562L; + + private String name; + + private String oid; + + private List<BtmTypeTreeVO> childList; +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeVO.java b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeVO.java index 4c4f54e..74bee2c 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeVO.java +++ b/Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/BtmTypeVO.java @@ -2,6 +2,7 @@ import lombok.Data; +import java.io.Serializable; import java.util.Date; import java.util.List; @@ -11,7 +12,7 @@ * @date 2019/10/11 5:24 PM */ @Data -public class BtmTypeVO implements java.io.Serializable{ +public class BtmTypeVO implements Serializable { /** * 绂佹淇敼杩欎釜鍊� @@ -139,7 +140,7 @@ /** * 涓氬姟绫诲瀷鍚嶇О */ - private String btmname; + private String btmName; /** * 鎷ユ湁鑰� diff --git a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/processor/dll/DllMapperProcessor.java b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/processor/dll/DllMapperProcessor.java index b211b73..eab3885 100644 --- a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/processor/dll/DllMapperProcessor.java +++ b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/processor/dll/DllMapperProcessor.java @@ -153,18 +153,18 @@ List<VciFieldTypeEnum> fieldTypes = listFieldInMapByColumnStr(columnStr, map); VciFieldTypeEnum finalField = null; int i = Integer.MAX_VALUE; - if (CollectionUtils.isEmpty(fieldTypes)){ - return null; - } if (fieldTypes.size() == 1){ return fieldTypes.get(0); } for (VciFieldTypeEnum fieldType : fieldTypes) { - DdlFieldMappingAttrBO bo = map.get(fieldType); - int i1 = Math.abs(bo.getDataLength() - length); - if (i1 < i){ - finalField = fieldType; - i = i1; + if (fieldType.equals(VciFieldTypeEnum.VTString)) { + finalField = VciFieldTypeEnum.VTString; + } + if (fieldType.equals(VciFieldTypeEnum.VTDateTime)){ + finalField = VciFieldTypeEnum.VTDateTime; + } + if (fieldType.equals(VciFieldTypeEnum.VTInteger) && length <= 26){ + finalField = VciFieldTypeEnum.VTInteger; } } return finalField; 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 f493a6b..6bd64b9 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 @@ -1104,13 +1104,13 @@ List<BtmTypeVO> btmTypeVOList = new ArrayList<>(); allTableBO.forEach(table -> { BtmTypeVO vo = new BtmTypeVO(); - vo.setTableName(table.getTableName()); + vo.setTableName(table.getTableName().toLowerCase()); vo.setDescription(table.getTableDesc()); List<DdlTableInDataBaseBO> columns = selectTableColumnInfo(table.getTableName()); List<BtmTypeAttributeVO> attributes = new ArrayList<>(); columns.forEach(col -> { BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO(); - attributeVO.setId(col.getId()); + attributeVO.setId(col.getId().toLowerCase()); attributeVO.setName(col.getName()); attributeVO.setNullableFlag(col.getNullableFlag()); attributeVO.setAttributeLength(col.getAttributeLength()); @@ -1120,6 +1120,9 @@ if (field != null){ attributeVO.setAttrDataType(field.name()); } + if(col.getPrecisionLength() != null){ + attributeVO.setAttrDataType(VciFieldTypeEnum.VTDouble.name()); + } attributes.add(attributeVO); }); vo.setAttributes(attributes); diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/BtmTypeController.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/BtmTypeController.java index 698a29a..87a2030 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/BtmTypeController.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/BtmTypeController.java @@ -1,7 +1,9 @@ package com.vci.ubcs.omd.controller; +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; @@ -9,6 +11,7 @@ import com.vci.ubcs.omd.entity.BtmType; import com.vci.ubcs.omd.repeater.DomainRepeater; import com.vci.ubcs.omd.service.IBtmTypeService; +import com.vci.ubcs.omd.vo.BtmTypeTreeVO; import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; import io.swagger.annotations.*; @@ -21,13 +24,13 @@ 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.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * Description: 涓氬姟绫诲瀷鎺у埗鍣� @@ -92,7 +95,7 @@ @ApiImplicitParam(name = "name", value = "涓氬姟绫诲瀷涓枃鍚嶇О", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "tableName", value = "涓氬姟绫诲瀷鏁版嵁搴撹〃鍚�", paramType = "query", dataType = "string"), }) - @ApiOperationSupport(order = 2) + @ApiOperationSupport(order = 3) @ApiOperation(value = "鏌ヨ鍒楄〃", notes = "浼犲叆鏌ヨ") public R<IPage<BtmTypeVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> condition, Query query) { IPage<BtmTypeVO> pageVO = new Page<>(); @@ -110,7 +113,7 @@ * @return 鎵ц缁撴灉 */ @PostMapping("/submit/{auto}") - @ApiOperationSupport(order = 3) + @ApiOperationSupport(order = 4) @ApiOperation(value = "鏂板鎴栦慨鏀�", notes = "浼犲叆涓氬姟绫诲瀷瀵硅薄") public R submit(@Valid @RequestBody BtmTypeDTO dto,@PathVariable(value = "auto") boolean auto) { CacheUtil.clear(OmdCacheConstant.BTM_CACHE); @@ -124,7 +127,7 @@ * @return 鎵ц缁撴灉 */ @PostMapping("/remove") - @ApiOperationSupport(order = 4) + @ApiOperationSupport(order = 5) @ApiOperation(value = "鍒犻櫎", notes = "涓婚敭闆嗗悎") public R remove(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String ids) { CacheUtil.clear(OmdCacheConstant.BTM_CACHE); @@ -141,7 +144,7 @@ * 鑾峰彇棰嗗煙鍊� */ @GetMapping("/domain") - @ApiOperationSupport(order = 5) + @ApiOperationSupport(order = 6) @ApiOperation(value = "鑾峰彇棰嗗煙鍊�") public R<List<String>> getDomain(){ try { @@ -150,4 +153,62 @@ return R.fail(e.getErrMsg()); } } + + /** + * 鎸塪omain鍒嗙粍锛屾煡璇笟鍔$被鍨嬬殑鏍戝舰缁撴瀯 + */ + @GetMapping("/tree-domain") + @ApiOperationSupport(order = 7) + @ApiOperation(value = "涓氬姟绫诲瀷鏍戝舰缁撴瀯", notes = "涓氬姟绫诲瀷鏍戝舰缁撴瀯") + public R<List<BtmTypeTreeVO>> treeDomain(){ + return R.data(btmTypeService.treeDomain()); + } + + /** + * 浠庢暟鎹簱琛ㄤ腑鑾峰彇 + * @param domain 棰嗗煙鍊� + * @return 璇诲彇缁撴灉 + */ + @GetMapping("/get-from-table") + @ApiOperation(value = "浠庢暟鎹簱琛ㄤ腑璇诲彇",notes = "浠庢暟鎹簱琛ㄤ腑璇诲彇") + @ApiOperationSupport(order = 8) + public R<List<BtmTypeVO>> getFromTable(String domain){ + return R.data(btmTypeService.getFromTable(domain)); + } + + /** + * 鏁版嵁搴撻�夋嫨鐨勮〃淇濆瓨涓轰笟鍔$被鍨� + * @param btmTypeDTOList 椤甸潰浼犺緭瀵硅薄 + * @return 鎵ц缁撴灉 + */ + @PostMapping("/save-from-table/{domain}") + @ApiOperation(value = "浠庢暟鎹簱涓繚瀛�",notes = "浠庢暟鎹簱涓繚瀛�") + @ApiOperationSupport(order = 9) + public R saveFromTable(@RequestBody List<BtmTypeDTO> btmTypeDTOList,@PathVariable(value = "domain") String domain){ + // 鏁版嵁搴撹〃涓嶈兘閲嶅 + Set<String> tableNames = btmTypeDTOList.stream().map(BtmTypeDTO::getTableName).filter(StringUtils::isNotBlank).collect(Collectors.toSet()); + long count = btmTypeService.count(Wrappers.<BtmType>query().lambda().in(BtmType::getTableName,tableNames)); + if (count > 0){ + return R.fail("鎵�閫夎〃鍦ㄤ笟鍔$被鍨嬩腑宸插瓨鍦�"); + } + // 涓氬姟绫诲瀷涓嶈兘閲嶅 + btmTypeDTOList = btmTypeDTOList.stream().peek(s -> { + String id; + String tableName = s.getTableName(); + if (tableName.contains(StringPool.UNDERSCORE)) { + List<String> strList = Arrays.asList(tableName.split(StringPool.UNDERSCORE)); + id = strList.get(strList.size() - 1); + } else { + id = tableName; + } + s.setId(id.toLowerCase()); + }).collect(Collectors.toList()); + List<String> btmTypeIdList = btmTypeDTOList.stream().map(BtmTypeDTO::getId).collect(Collectors.toList()); + + long countId = btmTypeService.count(Wrappers.<BtmType>query().lambda().in(BtmType::getId, btmTypeIdList)); + if (countId > 0){ + return R.fail("鎵�閫夎〃涓庡凡瀛樺湪涓氬姟绫诲瀷鍐茬獊"); + } + return R.data(btmTypeService.saveFromTable(btmTypeDTOList,domain)); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java index 45f779a..c0084a2 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java @@ -21,13 +21,6 @@ List<Attribute> selectAll(); /** - * 涓婚敭鏌ヨ - * @param primaryKey 涓婚敭 - * @return 鏌ヨ缁撴灉 - */ - Attribute selectByPrimaryKey(Long primaryKey); - - /** * 涓婚敭鎵归噺鏌ヨ * @param primaryKeyCollection 涓婚敭闆嗗悎 * @return 鏌ヨ缁撴灉 diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeAttributeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeAttributeMapper.java index 867a903..23db8b1 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeAttributeMapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeAttributeMapper.java @@ -15,10 +15,10 @@ */ public interface BtmTypeAttributeMapper extends BladeMapper<BtmTypeAttribute> { - int batchDelete(List<String> records); + int batchDelete(@Param("records") List<String> records); - int batchUpdate(List<BtmTypeAttribute> btmTypeAttributeDOList); + int batchUpdate(@Param("records") List<BtmTypeAttribute> btmTypeAttributeDOList); /** * 鑾峰彇涓氬姟绫诲瀷涓殑鎸囧畾灞炴�� diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeMapper.java index 035e810..7d153eb 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeMapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/BtmTypeMapper.java @@ -1,5 +1,6 @@ package com.vci.ubcs.omd.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.vci.ubcs.omd.entity.BtmTypeAttribute; import com.vci.ubcs.omd.entity.BtmType; import org.apache.ibatis.annotations.Param; @@ -9,21 +10,13 @@ import java.util.Collection; import java.util.List; -@Repository public interface BtmTypeMapper extends BladeMapper<BtmType> { /** * 鏍规嵁涓婚敭鍒犻櫎瀵硅薄 * @param oid 鐢熷懡鍛ㄦ湡涓婚敭 * @return 褰卞搷鐨勮鏁� */ - int deleteByPrimaryKey(String oid); - - /** - * 鎻掑叆涓氬姟绫诲瀷 - * @param record 瑕佹坊鍔犵殑涓氬姟绫诲瀷瀵硅薄 - * @return 褰卞搷鐨勮鏁� - */ - int insert(BtmType record); + int deleteByPrimaryKey(@Param("oid") String oid); /** * 鏍规嵁涓婚敭鑾峰彇鏁版嵁瀵硅薄 @@ -113,6 +106,7 @@ * @param records 鎵归噺鐨勪俊鎭� * @return 鎵ц鎬绘暟 */ - Long batchInsert(@Param("records") List<BtmTypeAttribute> records); + @InterceptorIgnore(tenantLine = "1") + Long batchInsert(@Param("records") List<BtmType> records); } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/repeater/DomainRepeater.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/repeater/DomainRepeater.java index 24e772c..e7ad4cc 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/repeater/DomainRepeater.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/repeater/DomainRepeater.java @@ -2,11 +2,13 @@ import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.cloud.nacos.NacosServiceManager; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; +import com.vci.ubcs.common.constant.LauncherConstant; import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO; import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.vo.LinkTypeVO; @@ -15,11 +17,9 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringPool; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; @@ -68,12 +68,27 @@ * Nacos鏈嶅姟鍒楄〃 */ private static NamingService namingService; - @Autowired private NacosServiceManager manager; @Autowired private NacosDiscoveryProperties properties; + + + /** + * 鎷垮彇鏈嶅姟涓殑鎵�鏈夎〃淇℃伅 + * @param serviceName 鏈嶅姟鍚嶇О + * @return 杩斿洖缁撴灉 + * @throws NacosException 鎵句笉鍒版湇鍔℃椂鎶涘嚭寮傚父 + */ + public static R getFromTable(String serviceName) throws NacosException{ + ResponseEntity<R> responseEntity = executeGet(getUrl(serviceName, API_GET_ALL_TABLE_INFO), new HashMap<>()); + if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { + R body = Objects.requireNonNull(responseEntity.getBody()); + return body; + } + return R.fail(String.valueOf(responseEntity.getStatusCode().value())); + } @PostConstruct private void init() { @@ -198,29 +213,41 @@ } /** + * 鎵цhttpGet鎺ュ彛 + * + * @param url 鍦板潃 + * @param extraHeaders 璇锋眰澶村弬鏁� + * @return 鎵ц缁撴灉 + */ + private static ResponseEntity<R> executeGet(String url,Map<String, String> extraHeaders) { + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("Blade-Auth", AuthUtil.getHeader()); + HttpEntity<String> request = new HttpEntity<>(httpHeaders); + if (!CollectionUtils.isEmpty(extraHeaders)){ + StringBuilder sb = new StringBuilder().append("?"); + extraHeaders.forEach( (k,v) -> { + sb.append(k).append(StringPool.EQUALS).append(v).append(StringPool.AMPERSAND); + }); + String str = sb.toString(); + if (str.endsWith(StringPool.AMPERSAND)){ + str = str.substring(0,str.length()-1); + } + url = url + str; + } + return restTemplate.exchange(url, HttpMethod.GET,request,R.class,""); + } + + /** * 鑾峰彇鎵�鏈夊凡娉ㄥ唽鐨勬湇鍔� * @return 涓嶅寘鍚粯璁ゆ湇鍔$殑鍏朵粬鏈嶅姟 * @throws NacosException */ public static List<String> getDomain() throws NacosException { - List<ServiceInfo> services = namingService.getSubscribeServices(); - Set<String> serviceNames = new HashSet<>(); - serviceNames.add(AppConstant.APPLICATION_GATEWAY_NAME); - serviceNames.add(AppConstant.APPLICATION_ADMIN_NAME); - serviceNames.add(AppConstant.APPLICATION_AUTH_NAME); - serviceNames.add(AppConstant.APPLICATION_DESK_NAME); - serviceNames.add(AppConstant.APPLICATION_DEVELOP_NAME); - serviceNames.add(AppConstant.APPLICATION_FLOW_NAME); - serviceNames.add(AppConstant.APPLICATION_FLOWDESIGN_NAME); - serviceNames.add(AppConstant.APPLICATION_LOG_NAME); - serviceNames.add(AppConstant.APPLICATION_REPORT_NAME); - serviceNames.add(AppConstant.APPLICATION_SWAGGER_NAME); - serviceNames.add(AppConstant.APPLICATION_SYSTEM_NAME); - serviceNames.add(AppConstant.APPLICATION_TURBINE_NAME); - serviceNames.add(AppConstant.APPLICATION_USER_NAME); - serviceNames.add(AppConstant.APPLICATION_WEBSOCKET_NAME); - serviceNames.add(AppConstant.APPLICATION_ZIPKIN_NAME); - serviceNames.add(AppConstant.APPLICATION_NAME_OMD); - return services.stream().map(ServiceInfo::getName).filter(s -> !serviceNames.contains(s)).collect(Collectors.toList()); + RestTemplate restTemplate = new RestTemplate(); + String url = "http://" +LauncherConstant.NACOS_DEV_ADDR + "/nacos/v1/ns/service/list?pageNo=1&pageSize=50"; + String forObject = restTemplate.getForObject(url, String.class); + JSONObject jsonObject = JSON.parseObject(forObject); + return (List<String>) jsonObject.get("doms"); } } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeAttributeService.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeAttributeService.java index 372316a..2e06c1f 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeAttributeService.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeAttributeService.java @@ -27,12 +27,6 @@ List<BtmTypeAttributeVO> checkAndInsert(String btmTypeOid, List<BtmTypeLinkAttributesDTO> attributesDTOList, String creator, Date now); /** - * 鎵归噺鎻掑叆 - * @param records 鏁版嵁瀵硅薄闆嗗悎 - */ - int batchInsert(List<BtmTypeAttribute> records); - - /** * 涓氬姟绫诲瀷涓婚敭鏌ュ睘鎬� * @param btmTypeOid 涓氬姟绫诲瀷涓婚敭 * @return 鏌ヨ缁撴灉 diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java index f59367e..d47082a 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java @@ -5,6 +5,7 @@ import com.vci.ubcs.omd.entity.BtmType; import com.vci.ubcs.omd.entity.BtmTypeAttribute; import com.vci.ubcs.omd.entity.ModifyAttributeInfo; +import com.vci.ubcs.omd.vo.BtmTypeTreeVO; import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; import com.vci.ubcs.omd.vo.LinkTypeVO; @@ -210,4 +211,25 @@ * @return 鎵ц缁撴灉 */ R submit(BtmTypeDTO btmTypeDTO,boolean autoCreateTable); + + /** + * 鎸塪omain鍒嗙粍锛屾煡璇笟鍔$被鍨嬪睘鎬х粨鏋� + * @return 鏌ヨ缁撴灉 + */ + List<BtmTypeTreeVO> treeDomain(); + + /** + * 浠庢暟鎹簱琛ㄤ腑鑾峰彇 + * @param domain 棰嗗煙鍊� + * @return 璇诲彇缁撴灉 + */ + List<BtmTypeVO> getFromTable(String domain); + + /** + * 閫夋嫨鏁版嵁搴撹〃淇濆瓨涓轰笟鍔$被鍨� + * @param btmTypeDTOList 椤甸潰浼犺緭瀵硅薄 + * @param domain 棰嗗煙 + * @return 鎵ц缁撴灉 + */ + List<BtmTypeVO> saveFromTable(List<BtmTypeDTO> btmTypeDTOList,String domain); } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java index a2deddc..b4f9ac5 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java @@ -60,7 +60,7 @@ @Override public AttributeVO getAttributeDetail(Long id) { Func.requireNotNull(id,"涓婚敭涓嶈兘涓虹┖"); - return AttributeWrapper.build().entityVO(baseMapper.selectByPrimaryKey(id)); + return AttributeWrapper.build().entityVO(baseMapper.selectById(id)); } /** 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 880efbc..a37c01c 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 @@ -62,7 +62,7 @@ if (!exists){ return null; } - batchInsert(btmTypeAttributeDOList); + saveBatch(btmTypeAttributeDOList); return BtmTypeAttributeWrapper.build().listEntityVO(btmTypeAttributeDOList); // btmTypeAttributeDOList.stream().forEachOrdered(s -> { // btmTypeAttributeDOMapper.insert(s); @@ -116,16 +116,6 @@ // }); } return null; - } - - /** - * 鎵归噺鎻掑叆 - * - * @param records 鏁版嵁瀵硅薄闆嗗悎 - */ - @Override - public int batchInsert(List<BtmTypeAttribute> records) { - return baseMapper.insertBatchSomeColumn(records); } /** 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 994199f..8c7215d 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 @@ -1,15 +1,19 @@ package com.vci.ubcs.omd.service.impl; import com.alibaba.cloud.commons.lang.StringUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.api.exception.NacosException; 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.dto.BtmAndLinkTypeDdlDTO; +import com.vci.ubcs.omd.entity.Attribute; import com.vci.ubcs.omd.repeater.DomainRepeater; +import com.vci.ubcs.omd.service.IAttributeService; import com.vci.ubcs.omd.service.IBtmTypeAttributeService; import com.vci.ubcs.omd.service.IModifyAttributeService; -import com.vci.ubcs.omd.wrapper.BtmTypeAttributeWrapper; +import com.vci.ubcs.omd.vo.BtmTypeTreeVO; import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; import com.vci.ubcs.omd.wrapper.ModifyAttributeWrapper; import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; @@ -24,6 +28,7 @@ import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; import com.vci.ubcs.omd.vo.LinkTypeVO; import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.enumpck.BooleanEnum; import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.util.VciBaseUtil; import com.vci.ubcs.starter.web.util.VciDateUtil; @@ -38,6 +43,7 @@ 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; @@ -71,6 +77,12 @@ */ @Autowired private IModifyAttributeService modifyAttributeService; + + /** + * 灞炴�х殑鏈嶅姟 + */ + @Autowired + private IAttributeService attributeService; /** * 琛ㄥ悕鍓嶇紑 @@ -621,4 +633,174 @@ public boolean changeStatus(@NotEmpty List<Long> ids, Integer status) { return false; } + + /** + * 鎸塪omain鍒嗙粍锛屾煡璇笟鍔$被鍨嬪睘鎬х粨鏋� + * + * @return 鏌ヨ缁撴灉 + */ + @Override + public List<BtmTypeTreeVO> treeDomain() { + try { + List<String> domain = DomainRepeater.getDomain(); + List<BtmTypeVO> vos = BtmTypeWrapper.build().listEntityVO(baseMapper.selectAll()); + Map<String, List<BtmTypeVO>> domainMap = vos.stream().collect(Collectors.groupingBy(BtmTypeVO::getDomain)); + List<BtmTypeTreeVO> treeList = new ArrayList<>(); + domainMap.forEach((k,v)-> { + if (domain.contains(k)){ + BtmTypeTreeVO parent = new BtmTypeTreeVO(); + parent.setOid(k); + parent.setName(k); + parent.setChildList(v.stream().map(s -> { + BtmTypeTreeVO child = new BtmTypeTreeVO(); + child.setOid(s.getOid()); + child.setName(s.getId() + " " + (s.getName() == null ? "" : s.getName())); + return child; + }).collect(Collectors.toList())); + treeList.add(parent); + } + }); + return treeList; + } catch (NacosException e) { + throw new RuntimeException(e); + } + } + + /** + * 浠庢暟鎹簱琛ㄤ腑鑾峰彇 + * + * @param domain 棰嗗煙鍊� + * @return 璇诲彇缁撴灉 + */ + @Override + public List<BtmTypeVO> getFromTable(String domain) { + VciBaseUtil.alertNotNull(domain,"棰嗗煙鍊�"); + try { + if (!DomainRepeater.getDomain().contains(domain)){ + return null; + } + R result = DomainRepeater.getFromTable(domain); + if (result.isSuccess()){ + List<BtmTypeVO> list = new ArrayList<>(); + Object dataList = result.getData(); + if (dataList instanceof List){ + ((List<?>) dataList).forEach(data -> { + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(data)); + list.add(BeanUtil.copy(jsonObject,BtmTypeVO.class)); + }); + } + return list; + }else { + return new ArrayList<>(); + } + } catch (NacosException e) { + throw new RuntimeException(e); + } + } + + /** + * 閫夋嫨鏁版嵁搴撹〃淇濆瓨涓轰笟鍔$被鍨� + * + * @param btmTypeDTOList 椤甸潰浼犺緭瀵硅薄 + * @param domain 棰嗗煙 + * @return 鎵ц缁撴灉 + */ + @Override + @Transactional + public List<BtmTypeVO> saveFromTable(List<BtmTypeDTO> btmTypeDTOList,String domain) { + // 涔嬪墠宸茬粡鍋氳繃閲嶅鏍¢獙浜嗭紝杩欒竟鐩存帴鎵ц淇濆瓨閫昏緫鍗冲彲 + List<BtmType> btmList = new ArrayList<>(); + List<BtmTypeAttribute> btmTypeAttributes = new ArrayList<>(); + Map<String,Attribute> idAttrMap = new HashMap<>(); + // 鏍¢獙灞炴�ф槸鍚﹀瓨鍦� + Set<String> attributeIds = new HashSet<>(); + Date now = new Date(); + String user = AuthUtil.getUserAccount(); + btmTypeDTOList.stream().forEach(dto -> { + BtmType btmType = Objects.requireNonNull(BeanUtil.copy(dto, BtmType.class)); + btmType.setOid(VciBaseUtil.getPk()); + btmType.setTs(now); + btmType.setCreator(user); + btmType.setBtmName("btmType"); + btmType.setCreateTime(now); + btmType.setDomain(domain); + btmType.setLastModifyTime(now); + btmType.setLastModifier(user); + btmType.setName(dto.getDescription()); + Set<String> ids = dto.getAttributes().stream().filter(s -> { + return ! (BtmTypeFieldConstant.BASIC_FIELD_MAP.containsKey(s.getId()) + || BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP.containsKey(s.getId()) + || BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP.containsKey(s.getId()) + || BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP.containsKey(s.getId()) + ); + }).map(attr -> { + // 娣诲姞灞炴�э紝1鏄牎楠岋紝2鏄坊鍔� + Attribute attribute = new Attribute(); + attribute.setKey(attr.getId()); + attribute.setLabel(attr.getName()); + attribute.setDictKey(attr.getAttrDataType()); + attribute.setMaxLength(attr.getAttributeLength()); + attribute.setPrecision(attr.getPrecisionLength()); + attribute.setDescription(attr.getDescription()); + attribute.setDefaultValue(attr.getDefaultValue()); + attribute.setNullable(String.valueOf(attr.isNullableFlag())); + attribute.setHashtag(attr.getDescription()); + attribute.setReferToId(attr.getReferBtmTypeId()); + attribute.setReferToName(attr.getReferBtmTypeName()); + attribute.setTs(now); + attribute.setCreateTime(now); + attribute.setCreateUser(AuthUtil.getUserId()); + idAttrMap.put(attribute.getKey(),attribute); + // 鍦ㄨ繖閲岀粰涓氬姟绫诲瀷璁剧疆鐗堟湰鎺у埗銆佺敓鍛藉懆鏈熸帶鍒躲�佸瘑绾ф帶鍒剁浉鍏崇殑淇℃伅 + + // 娣诲姞涓氬姟绫诲瀷鍜屽睘鎬х殑鍏崇郴 + BtmTypeAttribute btmTypeAttribute = Objects.requireNonNull(BeanUtil.copy(attr, BtmTypeAttribute.class)); + btmTypeAttribute.setPkBtmType(btmType.getOid()); + btmTypeAttribute.setCreator(user); + btmTypeAttribute.setCreateTime(now); + btmTypeAttribute.setLastModifier(user); + btmTypeAttribute.setLastModifyTime(now); +// btmTypeAttribute.setBtmName("btmTypeAttribute"); + btmTypeAttribute.setOid(VciBaseUtil.getPk()); + btmTypeAttribute.setBtmName(btmType.getId()); + btmTypeAttribute.setOwner(user); + btmTypeAttributes.add(btmTypeAttribute); + return attr; + }).map(BtmTypeLinkAttributesDTO::getId).collect(Collectors.toSet()); + attributeIds.addAll(ids); + btmType.setLifeCycleFlag(String.valueOf(ids.stream().anyMatch(BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP::containsKey))); + btmType.setRevisionFlag(String.valueOf(ids.stream().anyMatch(BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP::containsKey))); + btmType.setSecretFlag(String.valueOf(ids.stream().anyMatch(BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP::containsKey))); + btmType.setConsistence(BooleanEnum.TRUE.getValue()); + btmList.add(btmType); + }); + List<Attribute> existAttr = attributeService.list(Wrappers.<Attribute>query().lambda().in(Attribute::getKey, attributeIds)); + if (!CollectionUtils.isEmpty(btmList)){ + baseMapper.batchInsert(btmList); + } + if (!CollectionUtils.isEmpty(btmTypeAttributes)){ + btmTypeAttributeService.saveBatch(btmTypeAttributes); + } + BtmTypeFieldConstant.BASIC_FIELD_MAP.forEach((k,v) -> { + idAttrMap.remove(k); + }); + BtmTypeFieldConstant.LIFECYCLE_MANAGE_FIELD_MAP.forEach((k,v) -> { + idAttrMap.remove(k); + }); + BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP.forEach((k,v) -> { + idAttrMap.remove(k); + }); + BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP.forEach((k,v) -> { + idAttrMap.remove(k); + }); + if (CollectionUtils.isEmpty(existAttr)){ + attributeService.saveBatch(idAttrMap.values()); + }else { + List<Attribute> addList = idAttrMap.values().stream().filter(a -> existAttr.stream().noneMatch(b -> StringUtils.equals(a.getKey(), b.getKey()))).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(addList)) { + attributeService.saveBatch(addList); + } + } + return BtmTypeWrapper.build().listEntityVO(btmList); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java index 744366a..4a60ab2 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/BtmTypeWrapper.java @@ -84,7 +84,7 @@ */ public BtmType entityBeforeSave(BtmType btmTypeDO) { btmTypeDO.setOid(VciBaseUtil.getPk()); - btmTypeDO.setBtmname("btmType"); + btmTypeDO.setBtmName("btmType"); Date now = new Date(); String userAccount = AuthUtil.getUserAccount(); btmTypeDO.setLastModifier(userAccount); diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml index 89528cf..7da922c 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml @@ -5,46 +5,64 @@ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> <resultMap id="baseResultMap" type="com.vci.ubcs.omd.entity.Attribute"> <id column="id" property="id"/> - <result column="create_user" property="createUser"/> - <result column="create_dept" property="createDept"/> - <result column="create_time" property="createTime"/> - <result column="update_user" property="updateUser"/> - <result column="update_time" property="updateTime"/> - <result column="status" property="status"/> - <result column="is_deleted" property="isDeleted"/> <result column="tenant_id" property="tenantId"/> <result column="key" property="key"/> <result column="label" property="label"/> - <result column="create_user" property="createUser" jdbcType="NUMERIC"/> - <result column="create_dept" property="createDept" jdbcType="NUMERIC"/> - <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> - <result column="update_user" property="updateUser" jdbcType="NUMERIC"/> - <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> - <result column="status" property="status" jdbcType="NUMERIC"/> - <result column="is_deleted" property="isDeleted" jdbcType="NUMERIC"/> - <result column="tenant_id" property="tenantId" jdbcType="NUMERIC"/> - <result column="key" property="key" jdbcType="VARCHAR"/> - <result column="label" property="label" jdbcType="VARCHAR"/> + <result column="type_code" property="typeCode"/> + <result column="type_key" property="typeKey"/> <result column="hashtag" property="hashtag" jdbcType="VARCHAR"/> <result column="description" property="description" jdbcType="VARCHAR"/> + <result column="nullable" property="nullable"/> + <result column="max_length" property="maxLength"/> + <result column="precision" property="precision"/> + <result column="refer_type_code" property="referTypeCode"/> + <result column="refer_type_key" property="referTypeKey"/> + <result column="refer_to_id" property="referToId" jdbcType="VARCHAR"/> + <result column="refer_to_name" property="referToName"/> + <result column="using_dict" property="usingDict"/> + <result column="dict_code" property="dictCode"/> + <result column="dict_key" property="dictKey"/> + <result column="default_value" property="defaultValue"/> + <result column="status" property="status"/> + <result column="is_deleted" property="isDeleted"/> + <result column="create_user" property="createUser" jdbcType="VARCHAR"/> + <result column="create_dept" property="createDept" jdbcType="VARCHAR"/> + <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> + <result column="update_user" property="updateUser" jdbcType="VARCHAR"/> + <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="ts" property="ts" jdbcType="TIMESTAMP"/> </resultMap> <resultMap id="extraResultMap" type="com.vci.ubcs.omd.entity.Attribute"> - <result column="nullable" property="nullable" jdbcType="VARCHAR"/> - <result column="max_length" property="maxLength" jdbcType="NUMERIC"/> - <result column="precision" property="precision" jdbcType="NUMERIC"/> - <result column="refer_to_id" property="referToId" jdbcType="NUMERIC"/> - <result column="refer_type_code" property="referTypeCode" jdbcType="VARCHAR"/> - <result column="refer_type_key" property="referTypeKey" jdbcType="VARCHAR"/> - <result column="refer_to_name" property="referToName" jdbcType="VARCHAR"/> -<!-- <result column="using_dict" property="usingDict" jdbcType="VARCHAR"/>--> -<!-- <result column="dict_code" property="dictCode" jdbcType="VARCHAR"/>--> -<!-- <result column="dict_key" property="dictKey" jdbcType="VARCHAR"/>--> - <result column="default_value" property="defaultValue" jdbcType="VARCHAR"/> + </resultMap> - + <sql id="base_query_column"> + id, tenant_id ,key ,label ,type_code , type_key , hashtag , description, nullable , max_length, precision, + refer_type_code, refer_type_key, refer_to_id, refer_to_name, using_dict, dict_code, dict_key, default_value, + status, is_deleted, create_user, create_dept, create_time, update_user, update_time , ts + </sql> + <sql id="tableName"> + pl_omd_attribute + </sql> + <select id="selectAll" resultMap="baseResultMap"> + select + <include refid="base_query_column"/> + from + <include refid="tableName"/> + </select> + <select id="selectByPrimaryKeyCollection" resultMap="baseResultMap"> + select DISTINCT <include refid="base_query_column" /> + from <include refid="tableName"/> + <where> + <foreach collection="oids" item="item" index="arrayindex" open=" OID in ( " close=")" > + #{item,jdbcType=VARCHAR} + <if test="(arrayindex != oids.size() -1)"> + , + </if> + </foreach> + </where> + </select> </mapper> diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeAttributeMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeAttributeMapper.xml new file mode 100644 index 0000000..7ea52e2 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeAttributeMapper.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.vci.ubcs.omd.mapper.BtmTypeAttributeMapper"> + + <resultMap id="base_result_map" type="com.vci.ubcs.omd.entity.BtmTypeAttribute"> + <id column="oid" jdbcType="VARCHAR" property="oid"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="description" jdbcType="VARCHAR" property="description"/> + <result column="pk_btm_type" jdbcType="VARCHAR" property="pkBtmType"/> + <result column="attribute_length" jdbcType="DECIMAL" property="attributeLength"/> + <result column="attr_data_type" jdbcType="VARCHAR" property="attrDataType"/> + <result column="nullable_flag" jdbcType="VARCHAR" property="nullableFlag"/> + <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/> + <result column="precision_length" jdbcType="DECIMAL" property="precisionLength"/> + <result column="scale_length" property="scaleLength" jdbcType="DECIMAL"/> + <result column="range" jdbcType="VARCHAR" property="range"/> + <result column="refer_btm_type_id" jdbcType="VARCHAR" property="referBtmTypeId"/> + <result column="refer_btm_type_name" jdbcType="VARCHAR" property="referBtmTypeName"/> + <result column="enum_id" jdbcType="VARCHAR" property="enumId"/> + <result column="enum_name" jdbcType="VARCHAR" property="enumName"/> + <result column="btm_name" property="btmName" jdbcType="VARCHAR"/> + <result column="owner" property="owner" jdbcType="VARCHAR"/> + <result column="creator" jdbcType="VARCHAR" property="creator"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="last_modifier" jdbcType="VARCHAR" property="lastModifier"/> + <result column="last_modify_time" jdbcType="TIMESTAMP" property="lastModifyTime"/> + <result column="ts" jdbcType="TIMESTAMP" property="ts"/> + </resultMap> + + <sql id="base_query_column"> + oid, id, name, description, pk_btm_type, attribute_length, attr_data_type, nullable_flag, + default_value, precision_length, scale_length, range, refer_btm_type_id, refer_btm_type_name, + enum_id, enum_name, btm_name, owner, creator, create_time, last_modifier, last_modify_time, ts + </sql> + + <sql id="tableName"> + pl_omd_btm_type_attribute + </sql> + <sql id="btmTypeTableName"> + pl_omd_btm_type + </sql> + <update id="batchUpdate" parameterType="java.util.List"> + <foreach collection="records" item="item" index="index" open="begin" close=";end;" separator=";"> + update <include refid="tableName"/> set + id = #{item.id,jdbcType=VARCHAR}, + name = #{item.name,jdbcType=VARCHAR}, + descrption = #{item.decription,jdbcType=VARCHAR}, + pk_btm_type = #{item.pkBtmType,jdbcType=VARCHAR}, + attribute_length = #{item.attributeLength,jdbcType=DECIMAL}, + attr_data_type = #{item.attrDataType,jdbcType=VARCHAR}, + nullable_flag = #{item.nullableFlag,jdbcType=VARCHAR}, + default_value = #{item.defaultValue,jdbcType=VARCHAR}, + precision_length = #{item.precisionLength,jdbcType=DECIMAL}, + scale_length = #{item.scaleLength,jdbcType=DECIMAL}, + range = #{item.range,jdbcType=VARCHAR}, + refer_btm_type_id = #{item.referBtmTypeId,jdbcType=VARCHAR}, + refer_btm_type_name = #{item.referBtmTypeName,jdbcType=VARCHAR}, + enum_id = #{item.enumId,jdbcType=VARCHAR}, + enum_name = #{item.enumName,jdbcType=VARCHAR}, + btm_name = #{item.btmName,jdbcType=VARCHAR}, + owner = #{item.owner,jdbcType=VARCHAR}, + creator = #{item.creator,jdbcType=VARCHAR}, + create_time = #{item.createTime,jdbcType=TIMESTAMP}, + last_modifier = #{item.lastModifier,jdbcType=VARCHAR}, + last_modify_time = #{item.lastModifyTime,jdbcType=TIMESTAMP}, + ts = #{item.ts,jdbcType=TIMESTAMP} + </foreach> + </update> + <delete id="batchDelete"> + delete from + <include refid="tableName"/> + <where> + <foreach collection="records" item="item" index="arrayindex" open="oid in (" close=")"> + #{item,jdbcType=VARCHAR} + <if test="(arrayindex != records.size() -1)"> + , + </if> + </foreach> + </where> + </delete> + <select id="selectByBtmTypeIdAndAttributeIds" resultType="com.vci.ubcs.omd.entity.BtmTypeAttribute"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> + where PKBTMTYPE = (select oid from <include refid="btmTypeTableName"/> where lower(id) = lower(#{btmTypeId,jdbcType=VARCHAR}) ) + <if test="ids.size() > 0"> + and + <foreach collection="ids" item="item" index="arrayindex" open=" lower(ID) in ( " close=")" > + lower(#{item,jdbcType=VARCHAR}) + <if test="(arrayindex != ids.size() -1)"> + , + </if> + </foreach> + </if> + </select> + <select id="selectByBtmTypeIds" resultType="com.vci.ubcs.omd.entity.BtmTypeAttribute"> + select DISTINCT <include refid="base_query_column" /> + from <include refid="tableName" /> + where PKBTMTYPE IN ( + select oid from <include refid="btmTypeTableName"/> where + <foreach collection="ids" item="item" index="arrayindex" open=" lower(ID) in ( " close=")" > + lower(#{item,jdbcType=VARCHAR}) + <if test="(arrayindex != ids.size() -1)"> + , + </if> + </foreach> + ) + order by id asc + </select> + +</mapper> diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeMapper.xml new file mode 100644 index 0000000..548cc12 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/BtmTypeMapper.xml @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.vci.ubcs.omd.mapper.BtmTypeMapper"> + + + <resultMap id="BaseResultMap" type="com.vci.ubcs.omd.entity.BtmType"> + <id column="oid" jdbcType="VARCHAR" property="oid" /> + <result column="id" jdbcType="VARCHAR" property="id" /> + <result column="name" jdbcType="VARCHAR" property="name" /> + <result column="description" jdbcType="VARCHAR" property="description" /> + <result column="table_name" jdbcType="VARCHAR" property="tableName" /> + <result column="revision_rule_id" jdbcType="VARCHAR" property="revisionRuleId" /> + <result column="revision_rule_name" jdbcType="VARCHAR" property="revisionRuleName" /> + <result column="revision_sep" jdbcType="VARCHAR" property="revisionSep" /> + <result column="revision_flag" jdbcType="VARCHAR" property="revisionFlag" /> + <result column="input_revision_flag" jdbcType="VARCHAR" property="inputRevisionFlag" /> + <result column="secret_flag" jdbcType="VARCHAR" property="secretFlag" /> + <result column="abstract_flag" jdbcType="VARCHAR" property="abstractFlag" /> + <result column="impl_class" jdbcType="VARCHAR" property="implClass" /> + <result column="shape" jdbcType="VARCHAR" property="shape" /> + <result column="life_cycle_flag" jdbcType="VARCHAR" property="lifeCycleFlag" /> + <result column="life_cycle_id" jdbcType="VARCHAR" property="lifeCycleId" /> + <result column="life_cycle_name" jdbcType="VARCHAR" property="lifeCycleName" /> + <result column="version_rule" jdbcType="VARCHAR" property="versionRule" /> + <result column="sub_life_cycle_id" jdbcType="VARCHAR" property="subLifeCycleId" /> + <result column="sub_life_cycle_name" jdbcType="VARCHAR" property="subLifeCycleName" /> + <result column="view_flag" jdbcType="VARCHAR" property="viewFlag" /> + <result column="view_create_sql" jdbcType="VARCHAR" property="viewCreateSql" /> + <result column="btm_name" property="btmName" jdbcType="VARCHAR" /> + <result column="owner" property="owner" jdbcType="VARCHAR" /> + <result column="creator" jdbcType="VARCHAR" property="creator" /> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> + <result column="last_modifier" jdbcType="VARCHAR" property="lastModifier" /> + <result column="last_modify_time" jdbcType="TIMESTAMP" property="lastModifyTime" /> + <result column="ts" jdbcType="TIMESTAMP" property="ts" /> + <result column="domain" jdbcType="VARCHAR" property="domain" /> + <result column="consistence" jdbcType="VARCHAR" property="consistence" /> + </resultMap> + + <sql id="base_query_column"> + oid, id, name, description, table_name, revision_rule_id, revision_rule_name,revision_flag, + revision_sep, input_revision_flag, secret_flag, abstract_flag, impl_class, shape,life_cycle_flag, life_cycle_id,life_cycle_name, + version_rule,sub_life_cycle_id,sub_life_cycle_name, view_flag, view_create_sql,btm_name, owner, creator, create_time, last_modifier, + last_modify_time, ts,domain,consistence + </sql> + <sql id="tableName"> + pl_omd_btm_type + </sql> + <insert id="batchInsert" useGeneratedKeys="false"> + insert into <include refid="tableName"/> ( + <include refid="base_query_column"/> + ) + <foreach collection="records" item="item" separator="union all"> + ( + select #{item.oid,jdbcType=VARCHAR}, + #{item.id,jdbcType=VARCHAR}, + #{item.name,jdbcType=VARCHAR}, + #{item.description,jdbcType=VARCHAR}, + #{item.tableName,jdbcType=VARCHAR}, + #{item.revisionRuleId,jdbcType=VARCHAR}, + #{item.revisionRuleName,jdbcType=VARCHAR}, + #{item.revisionFlag,jdbcType=VARCHAR}, + #{item.revisionSep,jdbcType=VARCHAR}, + #{item.inputRevisionFlag,jdbcType=VARCHAR}, + #{item.secretFlag,jdbcType=VARCHAR}, + #{item.abstractFlag,jdbcType=VARCHAR}, + #{item.implClass,jdbcType=VARCHAR}, + #{item.shape,jdbcType=VARCHAR}, + #{item.lifeCycleFlag,jdbcType=VARCHAR}, + #{item.lifeCycleId,jdbcType=VARCHAR}, + #{item.lifeCycleName,jdbcType=VARCHAR}, + #{item.versionRule,jdbcType=VARCHAR}, + #{item.subLifeCycleId,jdbcType=VARCHAR}, + #{item.subLifeCycleName,jdbcType=VARCHAR}, + #{item.viewFlag,jdbcType=VARCHAR}, + #{item.viewCreateSql,jdbcType=VARCHAR}, + #{item.btmName,jdbcType=VARCHAR }, + #{item.owner,jdbcType=VARCHAR }, + #{item.creator,jdbcType=VARCHAR}, + #{item.createTime,jdbcType=TIMESTAMP}, + #{item.lastModifier,jdbcType=VARCHAR}, + #{item.lastModifyTime,jdbcType=TIMESTAMP}, + #{item.ts,jdbcType=TIMESTAMP}, + #{item.domain,jdbcType=VARCHAR}, + #{item.consistence,jdbcType=VARCHAR} + from dual + ) + </foreach> + </insert> + + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> + delete from <include refid="tableName"/> + where OID = #{oid,jdbcType=VARCHAR} + </delete> + + <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> + where OID = #{oid,jdbcType=VARCHAR} + </select> + + <select id="selectByPrimaryKeys" resultMap="BaseResultMap"> + select <include refid="base_query_column" /> + from <include refid="tableName" /> + where OID in ( ${oids,jdbcType=VARCHAR}) + </select> + + <select id="selectByPrimaryKeyCollection" resultMap="BaseResultMap"> + select <include refid="base_query_column" /> + from <include refid="tableName" /> + <where> + <foreach collection="oids" item="item" index="arrayindex" open=" OID in ( " close=")" > + #{item,jdbcType=VARCHAR} + <if test="(arrayindex != oids.size() -1)"> + , + </if> + </foreach> + </where> + </select> + + <select id="selectByIdCollection" resultMap="BaseResultMap"> + select <include refid="base_query_column" /> + from <include refid="tableName" /> + <where> + <foreach collection="ids" item="item" index="arrayindex" open=" lower(ID) in ( " close=")" > + lower(#{item,jdbcType=VARCHAR}) + <if test="(arrayindex != ids.size() -1)"> + , + </if> + </foreach> + </where> + </select> + + <select id="selectAll" resultMap="BaseResultMap"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> + </select> + + <update id="updateByPrimaryKey" parameterType="com.vci.ubcs.omd.entity.BtmType"> + update <include refid="tableName"/> + set id = #{id,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + table_name = #{tableName,jdbcType=VARCHAR}, + revision_rule_id = #{revisionRuleId,jdbcType=VARCHAR}, + revision_flag = #{revisionFlag,jdbcType=VARCHAR}, + revision_rule_name = #{revisionRuleName,jdbcType=VARCHAR}, + revision_sep = #{revisionSep,jdbcType=VARCHAR}, + input_revision_flag = #{inputRevisionFlag,jdbcType=VARCHAR}, + secret_flag = #{secretFlag,jdbcType=VARCHAR}, + abstract_flag = #{abstractFlag,jdbcType=VARCHAR}, + impl_class = #{implClass,jdbcType=VARCHAR}, + shape = #{shape,jdbcType=VARCHAR}, + life_cycle_flag = #{lifeCycleFlag,jdbcType=VARCHAR}, + life_cycle_id = #{lifeCycleId,jdbcType=VARCHAR}, + life_cycle_name = #{lifeCycleName,jdbcType=VARCHAR}, + version_rule = #{versionRule,jdbcType=VARCHAR}, + sub_life_cycle_id = #{subLifeCycleId,jdbcType=VARCHAR}, + sub_life_cycle_name = #{subLifeCycleName,jdbcType=VARCHAR}, + view_flag = #{viewFlag,jdbcType=VARCHAR}, + view_create_sql = #{viewCreateSql,jdbcType=VARCHAR}, + btm_name =#{btmName,jdbcType=VARCHAR }, + owner = #{owner,jdbcType=VARCHAR }, + creator = #{creator,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + last_modifier = #{lastModifier,jdbcType=VARCHAR}, + last_modify_time = #{lastModifyTime,jdbcType=TIMESTAMP}, + ts = #{ts,jdbcType=TIMESTAMP}, + domain = #{domain,jdbcType=VARCHAR}, + consistence = #{consistence,jdbcType=VARCHAR} + where OID = #{oid,jdbcType=VARCHAR} + </update> + + + <select id="selectNameByOid" resultType="java.lang.String"> + select NAME from <include refid="tableName" /> + where OID = #{oid,jdbcType=VARCHAR} + </select> + <select id="selectNameById" resultType="java.lang.String"> + select NAME from <include refid="tableName" /> + where ID = #{id,jdbcType=VARCHAR} + </select> + + + <select id="selectByAttributeOid" resultMap="BaseResultMap"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> where oid in ( + select DISTINCT PKBTMTYPE from <include refid="tableName"/>ATTRIBUTE + where lower(ATTRIBUTEID) in (select id from vcibt_ATTRIBUTE where oid = #{pkAttribute,jdbcType=VARCHAR} ) ) + </select> + + + <select id="selectByRevisionRuleOid" resultMap="BaseResultMap"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> where REVISIONRULEID in + (select DISTINCT id from vcibt_REVISIONRULE where oid = #{pkRevisionRule,jdbcType=VARCHAR} ) + </select> + + + <select id="selectByLifeCycleOid" resultMap="BaseResultMap"> + select <include refid="base_query_column"/> + from <include refid="tableName" /> where LIFECYCLEID in + (select DISTINCT id from vcibt_LIFECYCLE where oid = #{pkLifeCycle,jdbcType=VARCHAR} ) + </select> + + <delete id="batchDeleteByOids" > + delete from <include refid="tableName" /> + <where> + <foreach collection="oids" item="item" index="arrayindex" open=" oid in ( " close=")" > + #{item,jdbcType=VARCHAR} + <if test="(arrayindex != oids.size() -1)"> + , + </if> + </foreach> + </where> + </delete> + + + + +</mapper> diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/ModifyAttributeInfoMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/ModifyAttributeInfoMapper.xml new file mode 100644 index 0000000..d7b80ff --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/ModifyAttributeInfoMapper.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.vci.ubcs.omd.mapper.ModifyAttributeInfoMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="baseResultMap" type="com.vci.ubcs.omd.entity.ModifyAttributeInfo"> + <id column="oid" property="oid" jdbcType="VARCHAR" /> + <result column="id" property="id" jdbcType="VARCHAR" /> + <result column="name" property="name" jdbcType="VARCHAR" /> + <result column="description" property="description" jdbcType="VARCHAR" /> + <result column="business_type" property="businessType" jdbcType="VARCHAR" /> + <result column="table_name" property="tableName" jdbcType="VARCHAR" /> + <result column="task_name" property="taskName" jdbcType="VARCHAR" /> + <result column="modify_column_reason" property="modifyColumnReason" jdbcType="VARCHAR" /> + <result column="order_modify_user_name" property="orderModifyUserName" jdbcType="VARCHAR" /> + <result column="order_modify_date" property="orderModifyDate" jdbcType="TIMESTAMP" /> + <result column="handle_finish_flag" property="handleFinishFlag" jdbcType="VARCHAR" /> + <result column="handle_user_name" property="handleUserName" jdbcType="VARCHAR" /> + <result column="handle_date" property="handleDate" jdbcType="TIMESTAMP" /> + <result column="handle_result" property="handleResult" jdbcType="VARCHAR" /> + <result column="btm_name" property="btmname" jdbcType="VARCHAR" /> + <result column="creator" property="creator" jdbcType="VARCHAR" /> + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> + <result column="TS" property="ts" jdbcType="TIMESTAMP" /> + <result column="add_attributes" property="addAttributes" jdbcType="CLOB" /> + <result column="modify_attributes" property="modifyAttributes" jdbcType="CLOB" /> + <result column="delete_attributes" property="deleteAttributes" jdbcType="CLOB" /> + <result column="before_modify_attributes" property="beforeModifyAttributes" jdbcType="CLOB" /> + + </resultMap> + + <resultMap id="extraResultMap" type="com.vci.ubcs.omd.entity.Attribute"> + + </resultMap> + + <sql id="base_query_column"> + oid, id, name, description, business_type, table_name, task_name, modify_column_reason, order_modify_user_name, + order_modify_date, handle_finish_flag, handle_user_name, handle_date, handle_result, btm_name, creator, create_time, + ts, add_attributes, modify_attributes, delete_attributes, before_modify_attributes + </sql> + <sql id="tableName"> + pl_omd_modify_attribute_info + </sql> + + + +</mapper> -- Gitblit v1.9.3