Commit 11e7ab3dfa689fee83ff29f5039311ca20cb5941

Authored by 芯火源
1 parent ddb4de36

refactor: 脚本列表接口新增参数脚本类型

@@ -154,9 +154,9 @@ public class TkDeviceScriptController extends BaseController { @@ -154,9 +154,9 @@ public class TkDeviceScriptController extends BaseController {
154 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 154 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
155 @GetMapping("/me/list") 155 @GetMapping("/me/list")
156 @ApiOperation("选项列表") 156 @ApiOperation("选项列表")
157 - public ResponseEntity listDeviceScript() throws ThingsboardException { 157 + public ResponseEntity listDeviceScript(@RequestParam(value = "scriptType", required = false) TkScriptFunctionType scriptType) throws ThingsboardException {
158 List<TkDeviceScriptDTO> results = 158 List<TkDeviceScriptDTO> results =
159 - scriptService.findDeviceScript(getCurrentUser().getCurrentTenantId()); 159 + scriptService.findDeviceScript(getCurrentUser().getCurrentTenantId(),scriptType);
160 return ResponseEntity.ok(results); 160 return ResponseEntity.ok(results);
161 } 161 }
162 162
@@ -246,11 +246,12 @@ public class TkDeviceScriptServiceImpl @@ -246,11 +246,12 @@ public class TkDeviceScriptServiceImpl
246 } 246 }
247 247
248 @Override 248 @Override
249 - public List<TkDeviceScriptDTO> findDeviceScript(String tenantId) { 249 + public List<TkDeviceScriptDTO> findDeviceScript(String tenantId,TkScriptFunctionType scriptType) {
250 LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = 250 LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper =
251 new QueryWrapper<TkDeviceScriptEntity>() 251 new QueryWrapper<TkDeviceScriptEntity>()
252 .lambda() 252 .lambda()
253 - .eq(TkDeviceScriptEntity::getTenantId, tenantId); 253 + .eq(TkDeviceScriptEntity::getTenantId, tenantId)
  254 + .eq(scriptType!=null,TkDeviceScriptEntity::getScriptType, scriptType);
254 return baseMapper.selectList(queryWrapper).stream() 255 return baseMapper.selectList(queryWrapper).stream()
255 .map(item -> item.getDTO(TkDeviceScriptDTO.class)) 256 .map(item -> item.getDTO(TkDeviceScriptDTO.class))
256 .collect(Collectors.toList()); 257 .collect(Collectors.toList());
@@ -27,7 +27,7 @@ public interface TkDeviceScriptService extends BaseService<TkDeviceScriptEntity> @@ -27,7 +27,7 @@ public interface TkDeviceScriptService extends BaseService<TkDeviceScriptEntity>
27 27
28 TkPageData<TkDeviceScriptDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin); 28 TkPageData<TkDeviceScriptDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin);
29 29
30 - List<TkDeviceScriptDTO> findDeviceScript(String tenantId); 30 + List<TkDeviceScriptDTO> findDeviceScript(String tenantId,TkScriptFunctionType scriptType);
31 31
32 32
33 /** 33 /**