feat(制品库功能完善): 受控库和产品库 均增加 名称和标识字段

受控库限制名称不能重复
This commit is contained in:
OTTO 2024-07-30 10:32:08 +08:00
parent 742b70df64
commit 0337fc34a8
18 changed files with 53 additions and 46 deletions

View File

@ -24,7 +24,7 @@ import java.util.List;
@Api(tags = "制品库-制品相关接口")
@RequestMapping("/{enterpriseIdentifier}/pmsProductLibraryComponent")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
@ApiImplicitParam(name = "enterpriseIdentifier", value = "组织标识", paramType = "path", dataType = "String")
})
public class PmsProductLibraryComponentController extends BaseController {
@Autowired

View File

@ -27,7 +27,7 @@ import java.util.List;
@Api(tags = "产品库-相关接口")
@RequestMapping("/{enterpriseIdentifier}/pmsProductLibrary")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
@ApiImplicitParam(name = "enterpriseIdentifier", value = "组织标识", paramType = "path", dataType = "String")
})
public class PmsProductLibraryController extends BaseController {
@Autowired

View File

@ -25,7 +25,7 @@ import java.util.List;
@Api(tags = "制品库-仓库相关接口")
@RequestMapping("/{enterpriseIdentifier}/pmsProductLibraryRepositories")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
@ApiImplicitParam(name = "enterpriseIdentifier", value = "组织标识", paramType = "path", dataType = "String")
})
public class PmsProductLibraryRepositoriesController extends BaseController {
@Autowired

View File

@ -26,7 +26,7 @@ import java.util.List;
@Api(tags = "快照库-相关接口")
@RequestMapping("/{enterpriseIdentifier}/pmsProductLibrarySnapshot")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
@ApiImplicitParam(name = "enterpriseIdentifier", value = "组织标识", paramType = "path", dataType = "String")
})
public class PmsProductLibrarySnapshotController extends BaseController {
@Autowired

View File

@ -81,15 +81,15 @@ public class PmsProductLibraryComponent extends BaseEntity {
private Long deptId;
/**
* 关联企业ID
* 关联组织ID
*/
@ApiModelProperty(value = "关联企业ID")
@ApiModelProperty(value = "关联组织ID")
private Long pmsEnterpriseId;
/**
* 关联企业ID
* 关联组织ID
*/
@ApiModelProperty(value = "关联企业标识", hidden = true)
@ApiModelProperty(value = "关联组织标识", hidden = true)
private String pmsEnterpriseIdentifier;
/**

View File

@ -59,15 +59,15 @@ public class PmsProductLibraryRepositories extends BaseEntity {
private Long deptId;
/**
* 关联企业ID
* 关联组织ID
*/
@ApiModelProperty(value = "关联企业标识", hidden = true)
@ApiModelProperty(value = "关联组织标识", hidden = true)
private String pmsEnterpriseIdentifier;
/**
* 关联企业ID
* 关联组织ID
*/
@ApiModelProperty(value = "关联企业ID")
@ApiModelProperty(value = "关联组织ID")
private Long pmsEnterpriseId;
/**
@ -108,7 +108,7 @@ public class PmsProductLibraryRepositories extends BaseEntity {
}
/**
* 在Nexus上创建的产品库标识应该为用户输入的product+制品库标识+企业标识
* 在Nexus上创建的产品库标识应该为用户输入的product+制品库标识+组织标识
*
* @return Nexus产品库标识
*/
@ -117,7 +117,7 @@ public class PmsProductLibraryRepositories extends BaseEntity {
}
/**
* 在Nexus上创建的快照库标识应该为用户输入的snapshot+企业标识+制品库标识+快照库标识
* 在Nexus上创建的快照库标识应该为用户输入的snapshot+组织标识+制品库标识+快照库标识
*
* @return Nexus快照库标识
*/
@ -126,7 +126,7 @@ public class PmsProductLibraryRepositories extends BaseEntity {
}
/**
* 在Nexus上创建的制品库标识应该为用户输入的制品库标识+企业标识
* 在Nexus上创建的制品库标识应该为用户输入的制品库标识+组织标识
*
* @return Nexus制品库标识
*/

View File

@ -26,7 +26,7 @@ public class GroupRepositoriesOperateVo {
private String name;
@ApiModelProperty(value = "虚拟仓库名称")
private String alias;
@ApiModelProperty(value = "企业标识", hidden = true)
@ApiModelProperty(value = "组织标识", hidden = true)
private String enterpriseIdentifier;
@ApiModelProperty(value = "制品库类型", hidden = true)
private String type = ProductLibraryRepositoriesTypeEnum.GROUP.getKey();

View File

@ -25,7 +25,7 @@ public class HostedRepositoriesOperateVo {
private String alias;
@ApiModelProperty(value = "制品库标识", hidden = true)
private String name;
@ApiModelProperty(value = "企业标识", hidden = true)
@ApiModelProperty(value = "组织标识", hidden = true)
private String enterpriseIdentifier;
@ApiModelProperty(value = "制品库类型", hidden = true)
private String type = ProductLibraryRepositoriesTypeEnum.HOSTED.getKey();

View File

@ -24,7 +24,7 @@ public class ProductRepositoriesOperateVo {
private String alias;
@ApiModelProperty(value = "产品库标识", hidden = true)
private String name;
@ApiModelProperty(value = "企业标识", hidden = true)
@ApiModelProperty(value = "组织标识", hidden = true)
private String enterpriseIdentifier;
@ApiModelProperty(value = "制品库类型", hidden = true)
private String type = ProductLibraryRepositoriesTypeEnum.HOSTED.getKey();

View File

@ -26,7 +26,7 @@ public class ProductRepositoriesSnapshotInputVo {
private String alias;
@ApiModelProperty(value = "制品库标识", hidden = true)
private String repoName;
@ApiModelProperty(value = "关联企业标识", hidden = true)
@ApiModelProperty(value = "关联组织标识", hidden = true)
private String enterpriseIdentifier;
public NexusHostedRepoInputVo toNexusRepoDataVo(PmsProductLibraryRepositories repo) {

View File

@ -66,7 +66,7 @@ public interface PmsProductLibraryRepositoriesMapper {
* 根据名称查找制品库
*
* @param name 制品库标识
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param format 制品格式
* @return 制品库数量
*/
@ -77,7 +77,7 @@ public interface PmsProductLibraryRepositoriesMapper {
*
* @param repoName 制品库标识
* @param snapshotName 快照库标识
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @return 快照库数量
*/
Integer selectRepositoriesSnapshotBySnapshotNameCount(@Param("pmsEnterpriseIdentifier") String pmsEnterpriseIdentifier, @Param("repoName") String repoName, @Param("snapshotName") String snapshotName);
@ -86,16 +86,16 @@ public interface PmsProductLibraryRepositoriesMapper {
* 根据制品库别名查找制品库
*
* @param alias 制品库别名
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param format 制品格式
* @return 制品库数量
*/
Integer selectPmsProductLibraryRepositoriesByAliasCount(@Param("alias") String alias, @Param("pmsEnterpriseIdentifier") String pmsEnterpriseIdentifier, @Param("format") String format);
PmsProductLibraryRepositories selectPmsProductLibraryRepositoriesByAlias(@Param("alias") String alias, @Param("pmsEnterpriseIdentifier") String pmsEnterpriseIdentifier, @Param("format") String format);
/**
* 根据制品库标识查找制品库
*
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param name 制品库标识
* @return 制品库
*/
@ -104,7 +104,7 @@ public interface PmsProductLibraryRepositoriesMapper {
/**
* 根据产品库标识查找产品库
*
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param name 产品库标识
* @return 产品库
*/
@ -113,7 +113,7 @@ public interface PmsProductLibraryRepositoriesMapper {
/**
* 根据制品库标识以及快照库标识查找快照库
*
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param repoName 制品库标识
* @param snapshotName 快照库标识
* @return 快照库
@ -122,7 +122,7 @@ public interface PmsProductLibraryRepositoriesMapper {
/**
* 查询产品库列表
*
* @param pmsEnterpriseIdentifier 企业标识
* @param pmsEnterpriseIdentifier 组织标识
* @param name 产品库标识
* @return 产品库列表
*/

View File

@ -24,7 +24,7 @@ public interface IPmsProductLibraryComponentService {
/**
* 查询制品库-制品列表
*
* @param enterpriseIdentifier 企业表示
* @param enterpriseIdentifier 组织表示
* @param componentSearchVo 制品库-制品
* @param isProduct
* @return 制品库-制品集合
@ -63,7 +63,7 @@ public interface IPmsProductLibraryComponentService {
/**
* 获取制品文件详情
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param repoName 制品库标识
* @param assetId 制品文件标识
* @param isProduct 是否产品库
@ -74,7 +74,7 @@ public interface IPmsProductLibraryComponentService {
/**
* 获取制品详情
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param repoName 制品库标识
* @param componentId 制品标识
* @param isProduct 是否产品库
@ -85,7 +85,7 @@ public interface IPmsProductLibraryComponentService {
/**
* 获取制品文件夹是否能删除状态
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param componentSearchVo 文件夹查询条件
* @param isProduct 是否产品库
* @return 能否删除状态
@ -99,7 +99,7 @@ public interface IPmsProductLibraryComponentService {
/**
* 删除制品
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param repoName 制品库标识
* @param snapshotName
* @param assetId 制品文件

View File

@ -26,7 +26,7 @@ public interface IPmsProductLibraryProductRepoService {
/**
* 查询产品库列表
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param name 产品库标识
* @return 产品库列表
*/
@ -69,7 +69,7 @@ public interface IPmsProductLibraryProductRepoService {
/**
* 查询关键制品列表
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param componentSearchVo 查询条件
* @return 制品列表
*/

View File

@ -33,7 +33,7 @@ public interface IPmsProductLibraryRepositoriesService {
/**
* 查询制品仓库分页列表
*
* @param enterpriseIdentifier 企业表示
* @param enterpriseIdentifier 组织表示
* @param searchVo 搜索制品库标识
* @return 制品仓库分页列表
*/

View File

@ -92,7 +92,7 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
/**
* 查询制品库-制品列表
*
* @param enterpriseIdentifier 企业标识
* @param enterpriseIdentifier 组织标识
* @param componentSearchVo 制品库-制品
* @param isProduct
* @return 制品库-制品

View File

@ -107,7 +107,7 @@ public class PmsProductLibraryProductRepoServiceImpl implements IPmsProductLibra
Integer count = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByNameCount(
productRepositoriesInputVo.getName(), productRepositoriesInputVo.getEnterpriseIdentifier(), productRepositoriesInputVo.getFormat());
if (count > 0) {
throw new ServiceException("该产品库标识在当前企业下已存在(产品库标识[%s])", productRepositoriesInputVo.getName());
throw new ServiceException("该产品库标识在当前组织下已存在(产品库标识[%s])", productRepositoriesInputVo.getName());
}
NexusHostedRepoInputVo requestBody = productRepositoriesInputVo.toNexusRepoDataVo();

View File

@ -84,7 +84,7 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
Integer count = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByNameCount(
groupRepositoriesInputVo.getName(), groupRepositoriesInputVo.getEnterpriseIdentifier(), groupRepositoriesInputVo.getFormat());
if (count > 0) {
throw new ServiceException("该制品库标识在当前企业下已存在(制品库标识[%s])", groupRepositoriesInputVo.getName());
throw new ServiceException("该制品库标识在当前组织下已存在(制品库标识[%s])", groupRepositoriesInputVo.getName());
}
checkGroupMemberRepoList(groupRepositoriesInputVo);
NexusGroupRepoInputVo requestBody = groupRepositoriesInputVo.toNexusGroupRepoInputVo();
@ -168,13 +168,13 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
Integer nameCount = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByNameCount(
hostedPmsProductLibraryRepositoriesInputVo.getName(), hostedPmsProductLibraryRepositoriesInputVo.getEnterpriseIdentifier(), hostedPmsProductLibraryRepositoriesInputVo.getFormat());
if (nameCount > 0) {
throw new ServiceException("该制品库标识在当前企业下已存在(制品库标识[%s])", hostedPmsProductLibraryRepositoriesInputVo.getName());
throw new ServiceException("该制品库标识在当前组织下已存在(制品库标识[%s])", hostedPmsProductLibraryRepositoriesInputVo.getName());
}
// 校验制品库别名
Integer aliasCount = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByAliasCount(
PmsProductLibraryRepositories aliasRepo = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByAlias(
hostedPmsProductLibraryRepositoriesInputVo.getAlias(), hostedPmsProductLibraryRepositoriesInputVo.getEnterpriseIdentifier(), hostedPmsProductLibraryRepositoriesInputVo.getFormat());
if (aliasCount > 0) {
throw new ServiceException("该制品库标识在当前企业下已存在(制品库标识[%s])", hostedPmsProductLibraryRepositoriesInputVo.getName());
if (aliasRepo != null) {
throw new ServiceException("该制品库名称在当前组织下已存在(制品库名称[%s])", hostedPmsProductLibraryRepositoriesInputVo.getAlias());
}
checkInputParameter(hostedPmsProductLibraryRepositoriesInputVo);
NexusHostedRepoInputVo requestBody = hostedPmsProductLibraryRepositoriesInputVo.toNexusRepoDataVo();
@ -228,12 +228,21 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
*/
@Override
public int updateHostedPmsProductLibraryRepositories(HostedRepositoriesOperateVo hostedRepositoriesOperateVo) {
if (StringUtils.isBlank(hostedRepositoriesOperateVo.getAlias())) {
throw new ServiceException("制品库名称不能为空");
}
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryRepositoriesByName(
hostedRepositoriesOperateVo.getEnterpriseIdentifier(),
hostedRepositoriesOperateVo.getName());
checkLockRepositoryStatus(hostedRepositoriesOperateVo.getEnterpriseIdentifier(), oldRepo.getId());
hostedRepositoriesOperateVo.setFormat(oldRepo.getFormat());
hostedRepositoriesOperateVo.setId(oldRepo.getId());
// 校验制品库别名
PmsProductLibraryRepositories aliasRepo = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByAlias(
hostedRepositoriesOperateVo.getAlias(), hostedRepositoriesOperateVo.getEnterpriseIdentifier(), hostedRepositoriesOperateVo.getFormat());
if (aliasRepo != null && !aliasRepo.getId().equals(oldRepo.getId())) {
throw new ServiceException("该制品库名称在当前组织下已存在(制品库名称[%s])", hostedRepositoriesOperateVo.getAlias());
}
checkInputParameter(hostedRepositoriesOperateVo);
// 构建更新对象
PmsProductLibraryRepositories pmsProductLibraryRepositories = hostedRepositoriesOperateVo.toPmsProductLibraryRepositories();

View File

@ -135,10 +135,8 @@
and pe.enterprise_identifier = #{pmsEnterpriseIdentifier}
and pplr.snapshot_name IS NOT NULL
</select>
<select id="selectPmsProductLibraryRepositoriesByAliasCount" resultType="java.lang.Integer">
select count(0)
from pms_product_library_repositories pplr
left join pms_enterprise as pe on pplr.pms_enterprise_id = pe.id
<select id="selectPmsProductLibraryRepositoriesByAlias" resultMap="PmsProductLibraryRepositoriesResult">
<include refid="selectPmsProductLibraryRepositoriesAliasVo"/>
where pplr.alias = #{alias}
and pe.enterprise_identifier = #{pmsEnterpriseIdentifier}
<choose>