fix:仿真参数库,判断是否有参数对象

This commit is contained in:
2026-02-28 10:54:52 +08:00
parent 717e9238d1
commit 403a31d5cc
3 changed files with 36 additions and 0 deletions

View File

@@ -74,6 +74,17 @@ public class SimulationParameterLibraryController {
return simulationParameterLibraryService.getSimulationParameterTree(type, id);
}
/**
* 判断是否有参数对象
*/
@SysLog("判断是否有参数对象")
@GetMapping("/hasParameterObject")
@Operation(summary = "判断是否有参数对象", description = "判断是否有参数对象")
public SdmResponse hasParameterObject(@Parameter(description = "1模型库/2模型库分类") @RequestParam(value = "type") Integer type, @Parameter(description = "传对应模型库id/模型库分类id") @RequestParam(value = "id") Long id) {
return simulationParameterLibraryService.hasParameterObject(type, id);
}
/**
* 编辑仿真参数库、仿真参数库分类、真参数库分类的参数对象的名称
* @return

View File

@@ -35,6 +35,14 @@ public interface ISimulationParameterLibraryService extends IService<SimulationP
*/
SdmResponse getSimulationParameterTree(Integer type,Long id);
/**
* 判断是否有参数对象
* @param type 1模型库/2模型库分类
* @param id 对应id
* @return 是否有参数对象
*/
SdmResponse hasParameterObject(Integer type, Long id);
/**
* 删除仿真参数库数据(参数库、参数分类、参数推向)
* @return

View File

@@ -253,6 +253,23 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
return SdmResponse.success(jsonObjects);
}
@Override
public SdmResponse hasParameterObject(Integer type, Long id) {
long count = 0;
if (type == SimulationParameterDataTypeEnum.LIBRARY.getValue()) {
// 如果是模型库,直接根据 library_id 查询对象表
count = simulationParameterLibraryCategoryObjectService.lambdaQuery()
.eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, id)
.count();
} else if (type == SimulationParameterDataTypeEnum.CATEGORY.getValue()) {
// 如果是分类,直接检查其下是否有参数对象
count = simulationParameterLibraryCategoryObjectService.lambdaQuery()
.eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, id)
.count();
}
return SdmResponse.success(count > 0);
}
@Override
public SdmResponse deleteSimulationParameter(SimulationParamLibraryReq req) {
// 根据参数类型和参数id删除参数