Commit 42fd71d9b6b3734a0fb17c90cacc259cf3549f7f

Authored by xp.Huang
1 parent f338d8e6

fix: 组态查看组件信息,添加组态ID(configurationId)过滤

@@ -125,16 +125,17 @@ public class TkConfigurationNodeController extends BaseController { @@ -125,16 +125,17 @@ public class TkConfigurationNodeController extends BaseController {
125 } 125 }
126 126
127 127
128 - @GetMapping("/{levelType}/{levelId}") 128 + @GetMapping("/{configurationId}/{levelType}/{levelId}")
129 @ApiOperation("组件信息") 129 @ApiOperation("组件信息")
130 public ResponseEntity<ConfigurationNodeDetailDTO> nodeInform( 130 public ResponseEntity<ConfigurationNodeDetailDTO> nodeInform(
  131 + @ApiParam(value = "组态ID", required = true) @PathVariable("configurationId") String configurationId,
131 @ApiParam(value = "组态资源类型,例如:CONFIGURE、CONTENT、NODE", required = true, defaultValue = "NODE") @PathVariable("levelType") String levelType, 132 @ApiParam(value = "组态资源类型,例如:CONFIGURE、CONTENT、NODE", required = true, defaultValue = "NODE") @PathVariable("levelType") String levelType,
132 @ApiParam(value = "组态资源ID", required = true) @PathVariable("levelId") String levelId) throws ThingsboardException { 133 @ApiParam(value = "组态资源ID", required = true) @PathVariable("levelId") String levelId) throws ThingsboardException {
133 String tenantId = getCurrentUser().getCurrentTenantId(); 134 String tenantId = getCurrentUser().getCurrentTenantId();
134 135
135 - List<ConfigurationDatasourceDTO> sources = datasourceService.listConfigurationDatasource(tenantId, levelType, levelId);  
136 - List<ConfigurationEventDTO> events = eventService.listConfigurationEvent(tenantId, levelType, levelId);  
137 - List<ConfigurationActDTO> acts = actService.listConfigurationAct(tenantId, levelType, levelId); 136 + List<ConfigurationDatasourceDTO> sources = datasourceService.listConfigurationDatasource(configurationId,tenantId, levelType, levelId);
  137 + List<ConfigurationEventDTO> events = eventService.listConfigurationEvent(configurationId,tenantId, levelType, levelId);
  138 + List<ConfigurationActDTO> acts = actService.listConfigurationAct(configurationId,tenantId, levelType, levelId);
138 ConfigurationNodeDetailDTO result = new ConfigurationNodeDetailDTO(); 139 ConfigurationNodeDetailDTO result = new ConfigurationNodeDetailDTO();
139 if (sources != null && sources.size() > 0) { 140 if (sources != null && sources.size() > 0) {
140 result.setDataSources(sources); 141 result.setDataSources(sources);
@@ -62,13 +62,14 @@ public class TkConfigurationActServiceImpl @@ -62,13 +62,14 @@ public class TkConfigurationActServiceImpl
62 } 62 }
63 63
64 @Override 64 @Override
65 - public List<ConfigurationActDTO> listConfigurationAct(String tenantId,String levelType,String levelId) { 65 + public List<ConfigurationActDTO> listConfigurationAct(String configurationId,String tenantId,String levelType,String levelId) {
66 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType) 66 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType)
67 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){ 67 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){
68 throw new TkDataValidationException("please provide correct levelType!"); 68 throw new TkDataValidationException("please provide correct levelType!");
69 } 69 }
70 LambdaQueryWrapper<TkConfigurationActEntity> filter = new QueryWrapper<TkConfigurationActEntity>().lambda() 70 LambdaQueryWrapper<TkConfigurationActEntity> filter = new QueryWrapper<TkConfigurationActEntity>().lambda()
71 .eq(TkConfigurationActEntity::getTenantId,tenantId) 71 .eq(TkConfigurationActEntity::getTenantId,tenantId)
  72 + .eq(TkConfigurationActEntity::getConfigurationId,configurationId)
72 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationActEntity::getContentId, levelId) 73 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationActEntity::getContentId, levelId)
73 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationActEntity::getId, levelId); 74 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationActEntity::getId, levelId);
74 List<TkConfigurationActEntity> result = baseMapper.selectList(filter); 75 List<TkConfigurationActEntity> result = baseMapper.selectList(filter);
@@ -60,13 +60,14 @@ public class TkConfigurationDatasourceServiceImpl @@ -60,13 +60,14 @@ public class TkConfigurationDatasourceServiceImpl
60 } 60 }
61 61
62 @Override 62 @Override
63 - public List<ConfigurationDatasourceDTO> listConfigurationDatasource(String tenantId,String levelType,String levelId) { 63 + public List<ConfigurationDatasourceDTO> listConfigurationDatasource(String configurationId,String tenantId,String levelType,String levelId) {
64 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType) 64 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType)
65 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){ 65 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){
66 throw new TkDataValidationException("please provide correct levelType!"); 66 throw new TkDataValidationException("please provide correct levelType!");
67 } 67 }
68 LambdaQueryWrapper<TkConfigurationDatasourceEntity> filter = new QueryWrapper<TkConfigurationDatasourceEntity>().lambda() 68 LambdaQueryWrapper<TkConfigurationDatasourceEntity> filter = new QueryWrapper<TkConfigurationDatasourceEntity>().lambda()
69 .eq(TkConfigurationDatasourceEntity::getTenantId,tenantId) 69 .eq(TkConfigurationDatasourceEntity::getTenantId,tenantId)
  70 + .eq(TkConfigurationDatasourceEntity::getConfigurationId,configurationId)
70 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationDatasourceEntity::getContentId, levelId) 71 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationDatasourceEntity::getContentId, levelId)
71 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationDatasourceEntity::getNodeId, levelId); 72 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationDatasourceEntity::getNodeId, levelId);
72 List<TkConfigurationDatasourceEntity> result = baseMapper.selectList(filter); 73 List<TkConfigurationDatasourceEntity> result = baseMapper.selectList(filter);
@@ -62,13 +62,14 @@ public class TkConfigurationEventServiceImpl @@ -62,13 +62,14 @@ public class TkConfigurationEventServiceImpl
62 } 62 }
63 63
64 @Override 64 @Override
65 - public List<ConfigurationEventDTO> listConfigurationEvent(String tenantId,String levelType,String levelId) { 65 + public List<ConfigurationEventDTO> listConfigurationEvent(String configurationId,String tenantId,String levelType,String levelId) {
66 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType) 66 if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType)
67 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){ 67 && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){
68 throw new TkDataValidationException("please provide correct levelType!"); 68 throw new TkDataValidationException("please provide correct levelType!");
69 } 69 }
70 LambdaQueryWrapper<TkConfigurationEventEntity> filter = new QueryWrapper<TkConfigurationEventEntity>().lambda() 70 LambdaQueryWrapper<TkConfigurationEventEntity> filter = new QueryWrapper<TkConfigurationEventEntity>().lambda()
71 .eq(TkConfigurationEventEntity::getTenantId,tenantId) 71 .eq(TkConfigurationEventEntity::getTenantId,tenantId)
  72 + .eq(TkConfigurationEventEntity::getConfigurationId,configurationId)
72 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationEventEntity::getContentId, levelId) 73 .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), TkConfigurationEventEntity::getContentId, levelId)
73 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationEventEntity::getId, levelId); 74 .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), TkConfigurationEventEntity::getId, levelId);
74 List<TkConfigurationEventEntity> result = baseMapper.selectList(filter); 75 List<TkConfigurationEventEntity> result = baseMapper.selectList(filter);
@@ -27,10 +27,11 @@ public interface TkConfigurationActService { @@ -27,10 +27,11 @@ public interface TkConfigurationActService {
27 27
28 /** 28 /**
29 * 查看动画效果信息 29 * 查看动画效果信息
  30 + * @param configurationId 组态ID
30 * @param tenantId 租户ID 31 * @param tenantId 租户ID
31 * @param levelType 组件类型 32 * @param levelType 组件类型
32 * @param levelId 内容ID、结点ID任选其一 33 * @param levelId 内容ID、结点ID任选其一
33 * @return 34 * @return
34 */ 35 */
35 - List<ConfigurationActDTO> listConfigurationAct(String tenantId,String levelType,String levelId); 36 + List<ConfigurationActDTO> listConfigurationAct(String configurationId,String tenantId,String levelType,String levelId);
36 } 37 }
@@ -29,9 +29,10 @@ public interface TkConfigurationDatasourceService { @@ -29,9 +29,10 @@ public interface TkConfigurationDatasourceService {
29 29
30 /** 30 /**
31 * 查看数据交互信息 31 * 查看数据交互信息
  32 + * @param configurationId 组态ID
32 * @param levelType 组件类型 33 * @param levelType 组件类型
33 * @param levelId 内容ID、结点ID任选其一 34 * @param levelId 内容ID、结点ID任选其一
34 * @return 35 * @return
35 */ 36 */
36 - List<ConfigurationDatasourceDTO> listConfigurationDatasource(String tenantId,String levelType,String levelId); 37 + List<ConfigurationDatasourceDTO> listConfigurationDatasource(String configurationId,String tenantId,String levelType,String levelId);
37 } 38 }
@@ -27,9 +27,10 @@ public interface TkConfigurationEventService { @@ -27,9 +27,10 @@ public interface TkConfigurationEventService {
27 27
28 /** 28 /**
29 * 查看数据交互信息 29 * 查看数据交互信息
  30 + * @param configurationId 组态ID
30 * @param levelType 组件类型 31 * @param levelType 组件类型
31 * @param levelId 内容ID、结点ID任选其一 32 * @param levelId 内容ID、结点ID任选其一
32 * @return 33 * @return
33 */ 34 */
34 - List<ConfigurationEventDTO> listConfigurationEvent(String tenantId,String levelType,String levelId); 35 + List<ConfigurationEventDTO> listConfigurationEvent(String configurationId,String tenantId,String levelType,String levelId);
35 } 36 }