fix:仿真参数库,同名参数对象校验

This commit is contained in:
2026-03-31 11:56:27 +08:00
parent 56cc865a17
commit 46ba9e3d1a

View File

@@ -139,6 +139,16 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
@Transactional(rollbackFor = Exception.class)
public SdmResponse addLibraryCategoryObject(SimulationParameterLibraryCategoryObjectReq req) {
try {
// 同名校验:检查同一参数库、同一分类下是否存在同名的参数对象
Long existingCount = simulationParameterLibraryCategoryObjectService.lambdaQuery()
.eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, req.getParameterLibraryId())
.eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getParameterLibraryCategoryId())
.eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryObjectName, req.getParameterLibraryCategoryObjectName())
.count();
if (existingCount > 0) {
return SdmResponse.failed("该分类下已存在同名参数对象:" + req.getParameterLibraryCategoryObjectName());
}
MultipartFile inputFile = req.getFile();
ObjectMapper objectMapper = new ObjectMapper();
MultipartFile fileToUpload;