Commit a31053b128afa0365a59df51938353c7f3b24f45

Authored by 云中非
1 parent f7e6ff1f

refactor: 组态分页查询新增过滤条件:平台

@@ -3,6 +3,7 @@ package org.thingsboard.server.controller.yunteng; @@ -3,6 +3,7 @@ package org.thingsboard.server.controller.yunteng;
3 import io.swagger.annotations.Api; 3 import io.swagger.annotations.Api;
4 import io.swagger.annotations.ApiOperation; 4 import io.swagger.annotations.ApiOperation;
5 import lombok.RequiredArgsConstructor; 5 import lombok.RequiredArgsConstructor;
  6 +import org.apache.commons.lang3.StringUtils;
6 import org.springframework.http.ResponseEntity; 7 import org.springframework.http.ResponseEntity;
7 import org.springframework.security.access.prepost.PreAuthorize; 8 import org.springframework.security.access.prepost.PreAuthorize;
8 import org.springframework.validation.annotation.Validated; 9 import org.springframework.validation.annotation.Validated;
@@ -39,6 +40,7 @@ public class YtConfigurationCenterController extends BaseController { @@ -39,6 +40,7 @@ public class YtConfigurationCenterController extends BaseController {
39 @RequestParam(PAGE_SIZE) int pageSize, 40 @RequestParam(PAGE_SIZE) int pageSize,
40 @RequestParam(PAGE) int page, 41 @RequestParam(PAGE) int page,
41 @RequestParam(value = "name", required = false) String name, 42 @RequestParam(value = "name", required = false) String name,
  43 + @RequestParam(value = "platform", required = false) String platform,
42 @RequestParam(value = "organizationId", required = false) String organizationId, 44 @RequestParam(value = "organizationId", required = false) String organizationId,
43 @RequestParam(value = ORDER_FILED, required = false) String orderBy, 45 @RequestParam(value = ORDER_FILED, required = false) String orderBy,
44 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) 46 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType)
@@ -49,12 +51,15 @@ public class YtConfigurationCenterController extends BaseController { @@ -49,12 +51,15 @@ public class YtConfigurationCenterController extends BaseController {
49 queryMap.put(PAGE, page); 51 queryMap.put(PAGE, page);
50 queryMap.put(ORDER_FILED, orderBy); 52 queryMap.put(ORDER_FILED, orderBy);
51 queryMap.put("tenantId", getCurrentUser().getCurrentTenantId()); 53 queryMap.put("tenantId", getCurrentUser().getCurrentTenantId());
52 - if (null != name) { 54 + if (StringUtils.isNotBlank(name)) {
53 queryMap.put("name", name); 55 queryMap.put("name", name);
54 } 56 }
55 - if (null != organizationId) { 57 + if (StringUtils.isNotBlank(organizationId)) {
56 queryMap.put("organizationId", organizationId); 58 queryMap.put("organizationId", organizationId);
57 } 59 }
  60 + if (StringUtils.isNotBlank(platform)) {
  61 + queryMap.put("platform", platform);
  62 + }
58 if (null != orderType) { 63 if (null != orderType) {
59 queryMap.put(ORDER_TYPE, orderType.name()); 64 queryMap.put(ORDER_TYPE, orderType.name());
60 } 65 }
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
40 <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> 40 <if test="queryMap.tenantId !=null and queryMap.tenantId !=''">
41 AND a.tenant_id = #{queryMap.tenantId} 41 AND a.tenant_id = #{queryMap.tenantId}
42 </if> 42 </if>
  43 + <if test="queryMap.platform !=null and queryMap.platform !=''">
  44 + AND a.platform = #{queryMap.platform}
  45 + </if>
43 <if test="queryMap.name !=null and queryMap.name !=''"> 46 <if test="queryMap.name !=null and queryMap.name !=''">
44 AND a.name LIKE concat('%',#{queryMap.name}::TEXT,'%') 47 AND a.name LIKE concat('%',#{queryMap.name}::TEXT,'%')
45 </if> 48 </if>