修改已知问题。

This commit is contained in:
chenxudong 2025-03-26 18:01:44 +08:00
parent 5b2817d66e
commit 5390bd1e40
2 changed files with 21 additions and 4 deletions

View File

@ -194,7 +194,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
List<String> accessibleIds; List<String> accessibleIds;
if (querySource == PrjQuerySource.SYS_DB.value) { if (querySource == PrjQuerySource.SYS_DB.value || querySource == PrjQuerySource.REPO_DB.value) {
accessibleIds = permissionService.getAccessibleTree(); accessibleIds = permissionService.getAccessibleTree();
if (CollUtil.isEmpty(accessibleIds)) { if (CollUtil.isEmpty(accessibleIds)) {
return ElectromagneticResultUtil.success(new ArrayList<>()); return ElectromagneticResultUtil.success(new ArrayList<>());

View File

@ -66,11 +66,15 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
} }
// 首先检查工程是否存在 // 首先检查工程是否存在
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class) LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID) .eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getDataOwn, dataOwnCode) .eq(EdFileInfo::getDataOwn, dataOwnCode)
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code) .eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
.eq(EdFileInfo::getFileName, prjName)); .eq(EdFileInfo::getFileName, prjName);
if (DataOwnEnum.isUserCode(dataOwnCode)) {
queryWrapper.eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId());
}
Long count = this.baseMapper.selectCount(queryWrapper);
if (count > 0) { if (count > 0) {
String info = StrFormatter.format("{} 项目已经存在", prjName); String info = StrFormatter.format("{} 项目已经存在", prjName);
@ -81,7 +85,20 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
try { try {
// 保存信息到MySQL // 保存信息到MySQL
String maxPrjId = this.baseMapper.maxPrjId(); String maxPrjId = this.baseMapper.maxPrjId();
int prjCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, PRJ_PARENT_ID)).intValue(); int prjCount;
if (DataOwnEnum.isUserCode(dataOwnCode)) {
prjCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_PRJ.code).eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId()))
.intValue();
} else if (DataOwnEnum.isSysCode(dataOwnCode)) {
prjCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code))
.intValue();
} else {
prjCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getDataOwn, DataOwnEnum.REPO_PRJ.code))
.intValue();
}
int id = Integer.parseInt(StrUtil.isEmpty(maxPrjId) ? "100000" : maxPrjId); int id = Integer.parseInt(StrUtil.isEmpty(maxPrjId) ? "100000" : maxPrjId);
String newPrjId = String.valueOf(id + 1); String newPrjId = String.valueOf(id + 1);