| | |
| | | width="70%" |
| | | style="height: 115vh;" |
| | | > |
| | | <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 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"> |
| | | <el-input v-model="btmType.tableName" :prefix-icon="icons.tableName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属领域" label-width="100px" prop="domain"> |
| | | <el-select v-model="btmType.domain" :prefix-icon="icons.domain"> |
| | | <el-form-item label="所属领域" label-width="100px" prop="domain" class="domainSelect"> |
| | | <el-select v-model="btmType.bizDomain" :prefix-icon="icons.domain"> |
| | | <el-option v-for="item in domainOption" |
| | | :label="item.label" :value="item.value" :key="item.value"></el-option> |
| | | :label="item.label" :value="item.value" :key="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="版本规则" label-width="100px"> |
| | |
| | | <el-form-item label="开启视图" label-width="100px" class="viewFlag"> |
| | | <el-switch v-model="btmType.viewFlag" active-color="#13ce66" @change="viewChange"></el-switch> |
| | | </el-form-item> |
| | | <el-form-item label="视图语句" label-width="100px"> |
| | | <el-form-item label="视图语句" label-width="100px" class="viewInput"> |
| | | <el-input v-model="btmType.view" :prefix-icon="icons.view" :disabled="!btmType.viewFlag"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | |
| | | <el-button type="danger" |
| | | icon="el-icon-plus" |
| | | size="small" |
| | | @click="rowAdd()">属性选择</el-button> |
| | | @click="rowAdd()">属性选择 |
| | | </el-button> |
| | | </template> |
| | | <template slot="attrDataTypeText" slot-scope="{row}"> |
| | | <el-tag>{{ row.attrDataTypeText }}</el-tag> |
| | | </template> |
| | | <template slot="menu" slot-scope="{row,index}"> |
| | | <el-button icon="el-icon-edit" size="small" type="text" v-if="!row.$cellEdit" @click="cellEditClick(row)">编辑</el-button> |
| | | <el-button icon="el-icon-delete" size="small" type="text" v-if="!row.$cellEdit" @click="removeFormAttrTable(row,index)">移除</el-button> |
| | | <el-button icon="el-icon-check" size="small" type="text" v-if="row.$cellEdit" @click="cellEditSave(row,index)">保存</el-button> |
| | | <el-button icon="el-icon-edit" size="small" type="text" v-if="!row.$cellEdit" @click="cellEditClick(row)">编辑 |
| | | </el-button> |
| | | <el-button icon="el-icon-delete" size="small" type="text" v-if="!row.$cellEdit" |
| | | @click="removeFormAttrTable(row,index)">移除 |
| | | </el-button> |
| | | <el-button icon="el-icon-check" size="small" type="text" v-if="row.$cellEdit" @click="cellEditSave(row,index)"> |
| | | 保存 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | import { add,update } from '@/api/omd/btmType'; |
| | | import { queryPage } from '@/api/omd/OmdAttribute'; |
| | | import { getPage } from '@/api/omd/revisionRule'; |
| | | |
| | | export default { |
| | | name: 'BusinessAdd', |
| | | props: { |
| | |
| | | menu: true, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | columnBtn: false, |
| | | menuWidth: 150, |
| | | addBtn:false, |
| | | highlightCurrentRow: true, |
| | |
| | | prop: 'name', |
| | | align: 'center', |
| | | cell: true |
| | | }, |
| | | { |
| | | },{ |
| | | label: "类型", |
| | | prop: "attrDataType", |
| | | prop: "attrDataTypeText", |
| | | align: 'center', |
| | | slot: true |
| | | }, |
| | |
| | | }, |
| | | // 属性池加载 |
| | | attrRefOnLoad(){ |
| | | if (this.attrRef.queryNotIn != ''){ |
| | | if (this.attrRef.queryNotIn != '' && this.btmType.attributes !== undefined && this.btmType.attributes.length > 0) { |
| | | this.attrRef.queryNotIn = ''; |
| | | this.btmType.attributes.forEach(item => { |
| | | this.attrRef.queryNotIn += (item.id + ",") |
| | |
| | | if(!this.btmType.attributes) { |
| | | this.btmType.attributes = []; |
| | | } |
| | | console.log(this.attrRef.selectData); |
| | | this.attrRef.selectData.forEach(item => { |
| | | this.btmType.attributes.push({ |
| | | id: item.id, |
| | | name: item.name, |
| | | typeValue: item.typeValue, |
| | | typeKey: item.typeValue, |
| | | attrDataType : item.typeKey, |
| | | attrDataTypeText: item.typeValue, |
| | | defaultValue: item.defaultValue, |
| | | description: item.description, |
| | | attributeLength: item.maxLength, |
| | | referBtmTypeId: item.referTypeCode, |
| | | referBtmTypeName: item.referToName, |
| | | enumId: item.dictCode, |
| | | // enumName: item, |
| | | }); |
| | | this.attrRef.queryNotIn += (item.id + ",") |
| | | }); |
| | |
| | | |
| | | }, |
| | | // 版本规则选中事件 |
| | | revisionChange(){}, |
| | | revisionChange() { |
| | | }, |
| | | // 确认选中版本规则 |
| | | confirmRevision(){ |
| | | this.btmType.revisionFlag = true; |
| | |
| | | width: 200px; |
| | | } |
| | | |
| | | .domainSelect > .el-form-item__content > .el-select > .el-input > .el-input__inner { |
| | | width: 200px; |
| | | } |
| | | |
| | | .viewFlag { |
| | | width: 305px; |
| | | } |
| | | |
| | | .viewInput > .el-form-item__content > .el-input > .el-input__inner { |
| | | width: 200px; |
| | | } |
| | | |
| | | .descClass > .el-input__inner { |
| | | width: 57vw |
| | | } |
| | |
| | | @Override |
| | | public String toString() { |
| | | StringBuilder stringBuilder = new StringBuilder().append(dataType); |
| | | if (dataLength != null && dataPrecision != null){ |
| | | stringBuilder.append(StringPool.SPACE).append(StringPool.LEFT_BRACKET).append(dataLength).append(StringPool.COMMA).append(dataPrecision).append(StringPool.RIGHT_BRACKET).append(StringPool.SPACE); |
| | | }else if (dataLength != null) { |
| | | stringBuilder.append(StringPool.SPACE).append(StringPool.LEFT_BRACKET).append(dataLength).append(StringPool.RIGHT_BRACKET).append(StringPool.SPACE); |
| | | if (dataLength != null){ |
| | | stringBuilder.append(StringPool.SPACE).append(StringPool.LEFT_BRACKET).append(dataLength); |
| | | if (dataPrecision != null){ |
| | | stringBuilder.append(StringPool.COMMA).append(dataPrecision).append(StringPool.RIGHT_BRACKET).append(StringPool.SPACE); |
| | | }else { |
| | | stringBuilder.append(StringPool.RIGHT_BRACKET).append(StringPool.SPACE); |
| | | } |
| | | } |
| | | if (!nullable){ |
| | | stringBuilder.append(StringPool.SPACE).append("not null").append(StringPool.SPACE); |
| | | } |
| | | if (StringUtil.isNotBlank(defaultValue)){ |
| | | stringBuilder.append(StringPool.SPACE).append("default").append(StringPool.SPACE).append(defaultValue).append(StringPool.SPACE); |
| | | stringBuilder.append(StringPool.SPACE).append("default").append(StringPool.SPACE).append(StringPool.SINGLE_QUOTE).append(defaultValue).append(StringPool.SINGLE_QUOTE).append(StringPool.SPACE); |
| | | } |
| | | return stringBuilder.toString(); |
| | | } |
| | |
| | | /** |
| | | * 业务类型所属领域 |
| | | */ |
| | | private String domain; |
| | | private String bizDomain; |
| | | } |
| | |
| | | * @author LiHang |
| | | * @date 2023/4/26 |
| | | */ |
| | | @Component |
| | | @Component("vciSpringUtil") |
| | | public class VciSpringUtil implements ApplicationContextAware { |
| | | |
| | | private static ApplicationContext applicationContext; |
| | |
| | | import com.vci.ubcs.ddl.mapper.DdlDmMapper; |
| | | import com.vci.ubcs.ddl.mapper.DdlMapper; |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 达梦数据库执行表操作sql的处理器 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DdlDmMapperProcessor extends DdlMapperProcessor{ |
| | | |
| | | private static final DdlMapper MAPPER = VciSpringUtil.getBean(DdlDmMapper.class); |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DdlMapperProcessStrategy { |
| | | |
| | | @Value("${spring.datasource.driver-class-name}") |
| | |
| | | import com.vci.ubcs.ddl.mapper.DdlMapper; |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DdlMsMapperProcessor extends DdlMapperProcessor{ |
| | | |
| | | private static DdlMapper mapper = VciSpringUtil.getBean(DdlMSMapper.class); |
| | |
| | | import com.vci.ubcs.ddl.mapper.DdlMySqlMapper; |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Repository; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DdlMySqlMapperProcessor extends DdlMapperProcessor{ |
| | | |
| | | private static DdlMapper mapper = VciSpringUtil.getBean(DdlMySqlMapper.class); |
| | |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DdlOracleMapperProcessor extends DdlMapperProcessor{ |
| | | |
| | | private static DdlMapper mapper = VciSpringUtil.getBean(DdlOracleMapper.class); |
| | |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * Description: 应用于达梦数据,生成创建表操作sql的处理器 |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllDmMapperProcessor extends DllMapperProcessor { |
| | | |
| | | private static final DllMapper MAPPER = VciSpringUtil.getBean(DllDmMapper.class); |
| | |
| | | |
| | | static { |
| | | // 需要重新映射的字段类型在这里写 |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDouble, new DdlFieldMappingAttrBO("DOUBLE", 26, 8, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTInteger, new DdlFieldMappingAttrBO("INTEGER", 10, null, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDouble, new DdlFieldMappingAttrBO("DOUBLE", 53, null, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTInteger, new DdlFieldMappingAttrBO("INTEGER", null, null, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTLong, new DdlFieldMappingAttrBO("NUMBER", 38, null, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTBoolean, new DdlFieldMappingAttrBO("VARCHAR", 5, null, true, null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDate, new DdlFieldMappingAttrBO("DATE", null, null, true, null)); |
| | |
| | | @Override |
| | | public String getColumnTypeSql(VciFieldTypeEnum fieldType, BtmTypeAttributeVO attributeVO) { |
| | | DdlFieldMappingAttrBO mappingBO = getMappingBO(fieldType); |
| | | if (fieldType.equals(VciFieldTypeEnum.VTDouble)) { |
| | | mappingBO.setDataPrecision(attributeVO.getPrecisionLength() == -1 ? 8 : attributeVO.getPrecisionLength()); |
| | | } |
| | | //先只针对数字类型的进行处理 |
| | | if (fieldType.equals(VciFieldTypeEnum.VTInteger) ){ |
| | | mappingBO.setDataLength(null); |
| | | } else if (fieldType.equals(VciFieldTypeEnum.VTDouble) || fieldType.equals(VciFieldTypeEnum.VTLong)) { |
| | | if (attributeVO.getAttributeLength() <= mappingBO.getDataLength()) { |
| | | if (mappingBO.getDataLength() != null) { |
| | | //mappingBO用来做最后的校验,如果定义的BO没有字段长度,则说明这个类型生成的sql不应该指定长度。如果指定了长度,说明是字段长度的最大值,VARCHAR、CLOB除外 |
| | | if (!(fieldType.equals(VciFieldTypeEnum.VTClob) || fieldType.equals(VciFieldTypeEnum.VTString)) |
| | | && attributeVO.getAttributeLength() > mappingBO.getDataLength()) { |
| | | mappingBO.setDataLength(attributeVO.getAttributeLength()); |
| | | } |
| | | }else { |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllMapperProcessorStrategy { |
| | | |
| | | @Value("${spring.datasource.driver-class-name}") |
| | |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Arrays; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllMsMapperProcessor extends DllMapperProcessor { |
| | | |
| | | private static DllMapper mapper = VciSpringUtil.getBean(DllMsMapper.class); |
| | |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllMySqlMapperProcessor extends DllMapperProcessor { |
| | | |
| | | private static final DllMapper MAPPER = VciSpringUtil.getBean(DllMySqlMapper.class); |
| | |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllOracleMapperProcessor extends DllMapperProcessor { |
| | | |
| | | private static DllMapper mapper = VciSpringUtil.getBean(DllOracleMapper.class); |
| | |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | @DependsOn("vciSpringUtil") |
| | | public class DllSqlLiteMapperProcessor extends DllMapperProcessor{ |
| | | private static DllMapper mapper = VciSpringUtil.getBean(DllSqlLiteMapper.class); |
| | | |
| | |
| | | package com.vci.ubcs.omd.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.vci.ubcs.omd.entity.BtmTypeAttribute; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | int batchDelete(@Param("records") List<String> records); |
| | | |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | int batchUpdate(@Param("records") List<BtmTypeAttribute> btmTypeAttributeDOList); |
| | | |
| | | /** |
| | |
| | | } |
| | | checkBtmTypeBeforeSave(btmTypeDTO); |
| | | BtmType btmTypeDO = Optional.ofNullable(BeanUtil.copy(btmTypeDTO, BtmType.class)).orElseGet(BtmType::new); |
| | | btmTypeDO.setBizDomain(btmTypeDTO.getDomain()); |
| | | btmTypeDO.setBizDomain(btmTypeDTO.getBizDomain()); |
| | | List<BtmTypeLinkAttributesDTO> attributes = btmTypeDTO.getAttributes(); |
| | | List<BtmTypeAttributeVO> afterAttributes; |
| | | if (StringUtils.isBlank(btmTypeDO.getOid())){ |
| | |
| | | try { |
| | | if (autoCreateTable) { |
| | | // checkTableSame(btmTypeVO); |
| | | R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), btmTypeVO); |
| | | R result = DomainRepeater.submitBtmType(btmTypeDTO.getBizDomain(), btmTypeVO); |
| | | if (result.isSuccess()){ |
| | | List<ModifyAttributeInfo> infoList = new ArrayList<>(); |
| | | Object data = result.getData(); |
| | |
| | | pl_omd_btm_type |
| | | </sql> |
| | | <update id="batchUpdate" parameterType="java.util.List"> |
| | | <foreach collection="records" item="item" index="index" open="begin" close=";end;" separator=";"> |
| | | BEGIN |
| | | <foreach collection="records" item="item" index="index" separator=";"> |
| | | update <include refid="tableName"/> set |
| | | id = #{item.id,jdbcType=VARCHAR}, |
| | | name = #{item.name,jdbcType=VARCHAR}, |
| | |
| | | last_modifier = #{item.lastModifier,jdbcType=VARCHAR}, |
| | | last_modify_time = #{item.lastModifyTime,jdbcType=TIMESTAMP}, |
| | | ts = #{item.ts,jdbcType=TIMESTAMP} |
| | | where oid = #{item.oid,jdbcType=VARCHAR} |
| | | </foreach> |
| | | ;END; |
| | | </update> |
| | | <delete id="batchDelete"> |
| | | delete from |