Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -374,7 +374,7 @@ }, // 属性池检索 attrRefSearch(form,done){ this.attrRef.key = form.key; this.attrRef.key = form.id; this.attrRefOnLoad(); done(); this.attrRef.key = null; Source/UBCS-WEB/src/views/modeling/originalAdd.vue
@@ -39,14 +39,14 @@ </el-form-item> <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true"> <el-tab-pane label="参照" name="referTab"> <el-form-item label="参照类型" label-width="100px"> <el-form-item label="参照类型" label-width="100px" class="referTypeForm"> <el-select v-model="attribute.referTypeKey" @change="referTypeSelectChange"> <el-option v-for="item in btmRefer.referTypeList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="参照名称" label-width="100px"> <el-form-item label="参照名称" label-width="100px" class="referNameForm"> <el-input v-model="attribute.referToName" @focus="openReferConfig" clearable="true" :disabled="referToFlag" @clear="clearReferTo"> <i slot="suffix" class="el-input__icon el-icon-search"></i> @@ -486,4 +486,16 @@ .attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner { width: 200px; }</style> } .attributeForm>.el-form-item>.el-form-item__content{ width :190px; } .referTypeForm > .el-form-item__content > .el-select > .el-input>.el-input__inner { width: 200px; } .referNameForm > .el-form-item__content > .el-input > .el-input__inner { width: 200px; } </style> Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java
@@ -95,8 +95,8 @@ @GetMapping("/query-page") @ApiImplicitParams({ @ApiImplicitParam(name = "key",value = "属性名模糊",paramType = "query",dataType = "string"), @ApiImplicitParam(name = "notIn",value = "属性名排除",paramType = "query",dataType = "string") @ApiImplicitParam(name = "key",value = "属性编号模糊",paramType = "query",dataType = "string"), @ApiImplicitParam(name = "notIn",value = "属性编号排除",paramType = "query",dataType = "string") }) @ApiOperationSupport(order = 6) @ApiOperation(value = "查询列表",notes = "传入查的值和不查的值") Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java
@@ -28,4 +28,12 @@ * @return */ List<BtmType> selectApplyRange(String oid); /** * 检验属性编号是否已经存在 * @param id 属性编号 * @param oid 数据主键 * @return 条数 */ Long checkIdExist(String id, String oid); } Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java
@@ -27,10 +27,7 @@ import org.springframework.util.CollectionUtils; import javax.validation.constraints.NotEmpty; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -77,13 +74,9 @@ @Override public boolean submit(AttributeDTO dto) { VciBaseUtil.alertNotNull(dto.getId(),"属性编号",dto.getName(),"属性名称",dto.getTypeKey(),"属性类型",dto.getMaxLength(),"属性长度"); if (!Pattern.compile(REGEXP).matcher(dto.getId()).matches()){ throw new VciBaseException("属性编号{0}只能是英文",new Object[]{dto.getId()}); } LambdaQueryWrapper<Attribute> wrapper = Wrappers.<Attribute>query().lambda().eq(Attribute::getId, dto.getId()); Long count = baseMapper.selectCount((Func.isEmpty(dto.getOid())) ? wrapper : wrapper.notIn(Attribute::getOid, dto.getOid())); if (count > 0L) { throw new ServiceException("属性编号已存在!"); String msg = checkAttributeId(dto.getId(),dto.getOid()); if (StringUtils.isNotBlank(msg)){ throw new VciBaseException(msg); } Attribute attribute = AttributeWrapper.build().copyBeforeSave(dto); CacheUtil.clear(OmdCacheConstant.ATTR_CACHE); @@ -91,6 +84,23 @@ } /** * 元数据的ID校验 * @param id 编号值 * @param oid 数据主键 * @return 校验结果 */ private String checkAttributeId(String id, String oid) { if (!Pattern.compile(REGEXP).matcher(id).matches()){ return "属性编号"+id+"只能是英文"; } Long count = baseMapper.checkIdExist(id.toLowerCase(Locale.ROOT),oid); if (count > 0L) { return "属性编号"+id+"(不区分大小写)已存在!"; } return null; } /** * 删除 * * @param oids 主键集合 Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml
@@ -58,4 +58,12 @@ where attr.oid = #{oid} </select> <select id="checkIdExist" resultType="java.lang.Long"> select COUNT(*) FROM <include refid="tableName"/> where LOWER(ID) = #{id} <if test="oid != null"> and OID != #{oid} </if> </select> </mapper>