committed by
Andrew Shvayka
37 changed files with 846 additions and 422 deletions
@ -1,46 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data; |
|||
|
|||
import lombok.Data; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Slf4j |
|||
@Data |
|||
public class Resource implements HasTenantId, Serializable { |
|||
|
|||
private static final long serialVersionUID = 7379609705527272306L; |
|||
|
|||
private TenantId tenantId; |
|||
private ResourceType resourceType; |
|||
private String resourceId; |
|||
private String textSearch; |
|||
private String value; |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder res = new StringBuilder("Resource{"); |
|||
res.append("tenantId=").append(tenantId); |
|||
res.append(", resourceType='").append(resourceType).append('\''); |
|||
res.append(", resourceId='").append(resourceId).append('\''); |
|||
res.append(", textSearch='").append(textSearch).append('\''); |
|||
res.append('}'); |
|||
return res.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.thingsboard.server.common.data.id.TbResourceId; |
|||
|
|||
@Slf4j |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
public class TbResource extends TbResourceInfo { |
|||
|
|||
private static final long serialVersionUID = 7379609705527272306L; |
|||
|
|||
private String data; |
|||
|
|||
public TbResource() { |
|||
super(); |
|||
} |
|||
|
|||
public TbResource(TbResourceId id) { |
|||
super(id); |
|||
} |
|||
|
|||
public TbResource(TbResourceInfo resourceInfo) { |
|||
super(resourceInfo); |
|||
} |
|||
|
|||
public TbResource(TbResource resource) { |
|||
super(resource); |
|||
this.data = resource.getData(); |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
StringBuilder builder = new StringBuilder(); |
|||
builder.append("Resource [tenantId="); |
|||
builder.append(getTenantId()); |
|||
builder.append(", id="); |
|||
builder.append(getUuidId()); |
|||
builder.append(", createdTime="); |
|||
builder.append(createdTime); |
|||
builder.append(", title="); |
|||
builder.append(getTitle()); |
|||
builder.append(", resourceType="); |
|||
builder.append(getResourceType()); |
|||
builder.append(", resourceKey="); |
|||
builder.append(getResourceKey()); |
|||
builder.append(", data="); |
|||
builder.append(data); |
|||
builder.append("]"); |
|||
return builder.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.thingsboard.server.common.data.id.TbResourceId; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
@Slf4j |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
public class TbResourceInfo extends SearchTextBased<TbResourceId> implements HasTenantId { |
|||
|
|||
private TenantId tenantId; |
|||
private String title; |
|||
private ResourceType resourceType; |
|||
private String resourceKey; |
|||
private String searchText; |
|||
|
|||
public TbResourceInfo() { |
|||
super(); |
|||
} |
|||
|
|||
public TbResourceInfo(TbResourceId id) { |
|||
super(id); |
|||
} |
|||
|
|||
public TbResourceInfo(TbResourceInfo resourceInfo) { |
|||
super(resourceInfo); |
|||
this.tenantId = resourceInfo.getTenantId(); |
|||
this.title = resourceInfo.getTitle(); |
|||
this.resourceType = resourceInfo.getResourceType(); |
|||
this.resourceKey = resourceInfo.resourceKey; |
|||
} |
|||
|
|||
@Override |
|||
public String getSearchText() { |
|||
return searchText; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
StringBuilder builder = new StringBuilder(); |
|||
builder.append("ResourceInfo [tenantId="); |
|||
builder.append(tenantId); |
|||
builder.append(", id="); |
|||
builder.append(getUuidId()); |
|||
builder.append(", createdTime="); |
|||
builder.append(createdTime); |
|||
builder.append(", title="); |
|||
builder.append(title); |
|||
builder.append(", resourceType="); |
|||
builder.append(resourceType); |
|||
builder.append(", resourceKey="); |
|||
builder.append(resourceKey); |
|||
builder.append("]"); |
|||
return builder.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data.id; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonCreator; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import org.thingsboard.server.common.data.EntityType; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
public class TbResourceId extends UUIDBased implements EntityId { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@JsonCreator |
|||
public TbResourceId(@JsonProperty("id") UUID id) { |
|||
super(id); |
|||
} |
|||
|
|||
@JsonIgnore |
|||
@Override |
|||
public EntityType getEntityType() { |
|||
return EntityType.TB_RESOURCE; |
|||
} |
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.model.sql; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import org.thingsboard.server.common.data.Resource; |
|||
|
|||
import javax.persistence.Transient; |
|||
import java.io.Serializable; |
|||
import java.util.UUID; |
|||
|
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Data |
|||
public class ResourceCompositeKey implements Serializable { |
|||
|
|||
@Transient |
|||
private static final long serialVersionUID = -3789469030818742769L; |
|||
|
|||
private UUID tenantId; |
|||
private String resourceType; |
|||
private String resourceId; |
|||
|
|||
public ResourceCompositeKey(Resource resource) { |
|||
this.tenantId = resource.getTenantId().getId(); |
|||
this.resourceType = resource.getResourceType().name(); |
|||
this.resourceId = resource.getResourceId(); |
|||
} |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.model.sql; |
|||
|
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import org.thingsboard.server.common.data.ResourceType; |
|||
import org.thingsboard.server.common.data.TbResource; |
|||
import org.thingsboard.server.common.data.id.TbResourceId; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.dao.model.BaseSqlEntity; |
|||
import org.thingsboard.server.dao.model.SearchTextEntity; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Table; |
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_DATA_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_KEY_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TABLE_NAME; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TENANT_ID_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TITLE_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TYPE_COLUMN; |
|||
import static org.thingsboard.server.dao.model.ModelConstants.SEARCH_TEXT_PROPERTY; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Entity |
|||
@Table(name = RESOURCE_TABLE_NAME) |
|||
public class TbResourceEntity extends BaseSqlEntity<TbResource> implements SearchTextEntity<TbResource> { |
|||
|
|||
@Column(name = RESOURCE_TENANT_ID_COLUMN, columnDefinition = "uuid") |
|||
private UUID tenantId; |
|||
|
|||
@Column(name = RESOURCE_TITLE_COLUMN) |
|||
private String title; |
|||
|
|||
@Column(name = RESOURCE_TYPE_COLUMN) |
|||
private String resourceType; |
|||
|
|||
@Column(name = RESOURCE_KEY_COLUMN) |
|||
private String resourceKey; |
|||
|
|||
@Column(name = SEARCH_TEXT_PROPERTY) |
|||
private String searchText; |
|||
|
|||
@Column(name = RESOURCE_DATA_COLUMN) |
|||
private String data; |
|||
|
|||
public TbResourceEntity() { |
|||
} |
|||
|
|||
public TbResourceEntity(TbResource resource) { |
|||
this.setUuid(resource.getId().getId()); |
|||
this.tenantId = resource.getTenantId().getId(); |
|||
this.title = resource.getTitle(); |
|||
this.resourceType = resource.getResourceType().name(); |
|||
this.resourceKey = resource.getResourceKey(); |
|||
this.searchText = resource.getSearchText(); |
|||
this.data = resource.getData(); |
|||
} |
|||
|
|||
@Override |
|||
public TbResource toData() { |
|||
TbResource resource = new TbResource(); |
|||
resource.setId(new TbResourceId(id)); |
|||
resource.setCreatedTime(createdTime); |
|||
resource.setTenantId(new TenantId(tenantId)); |
|||
resource.setTitle(title); |
|||
resource.setResourceType(ResourceType.valueOf(resourceType)); |
|||
resource.setResourceKey(resourceKey); |
|||
resource.setSearchText(searchText); |
|||
resource.setData(data); |
|||
return resource; |
|||
} |
|||
|
|||
@Override |
|||
public String getSearchTextSource() { |
|||
return title; |
|||
} |
|||
} |
|||
@ -1,47 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import org.thingsboard.server.common.data.Resource; |
|||
import org.thingsboard.server.common.data.ResourceType; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface ResourceDao { |
|||
|
|||
Resource saveResource(Resource resource); |
|||
|
|||
Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
PageData<Resource> findAllByTenantId(TenantId tenantId, PageLink pageLink); |
|||
|
|||
PageData<Resource> findResourcesByTenantIdAndResourceType(TenantId tenantId, |
|||
ResourceType resourceType, |
|||
PageLink pageLink); |
|||
|
|||
List<Resource> findAllByTenantIdAndResourceType(TenantId tenantId, ResourceType resourceType); |
|||
|
|||
List<Resource> findResourcesByTenantIdAndResourceType(TenantId tenantId, |
|||
ResourceType resourceType, |
|||
String[] objectIds, |
|||
String searchText); |
|||
void removeAllByTenantId(TenantId tenantId); |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import org.thingsboard.server.common.data.ResourceType; |
|||
import org.thingsboard.server.common.data.TbResource; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.dao.Dao; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface TbResourceDao extends Dao<TbResource> { |
|||
|
|||
TbResource saveResource(TbResource resource); |
|||
|
|||
TbResource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); |
|||
|
|||
PageData<TbResource> findAllByTenantId(TenantId tenantId, PageLink pageLink); |
|||
|
|||
PageData<TbResource> findResourcesByTenantIdAndResourceType(TenantId tenantId, |
|||
ResourceType resourceType, |
|||
PageLink pageLink); |
|||
|
|||
List<TbResource> findResourcesByTenantIdAndResourceType(TenantId tenantId, |
|||
ResourceType resourceType, |
|||
String[] objectIds, |
|||
String searchText); |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.resource; |
|||
|
|||
import org.thingsboard.server.common.data.TbResourceInfo; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.dao.Dao; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
public interface TbResourceInfoDao extends Dao<TbResourceInfo> { |
|||
|
|||
PageData<TbResourceInfo> findTbResourcesByTenantId(UUID tenantId, PageLink pageLink); |
|||
|
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.resource; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.springframework.stereotype.Component; |
|||
import org.thingsboard.server.common.data.TbResourceInfo; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.page.PageData; |
|||
import org.thingsboard.server.common.data.page.PageLink; |
|||
import org.thingsboard.server.dao.DaoUtil; |
|||
import org.thingsboard.server.dao.model.sql.TbResourceInfoEntity; |
|||
import org.thingsboard.server.dao.resource.TbResourceInfoDao; |
|||
import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
|||
|
|||
import java.util.Objects; |
|||
import java.util.UUID; |
|||
|
|||
@Slf4j |
|||
@Component |
|||
public class JpaTbResourceInfoDao extends JpaAbstractSearchTextDao<TbResourceInfoEntity, TbResourceInfo> implements TbResourceInfoDao { |
|||
|
|||
@Autowired |
|||
private TbResourceInfoRepository resourceInfoRepository; |
|||
|
|||
@Override |
|||
protected Class<TbResourceInfoEntity> getEntityClass() { |
|||
return TbResourceInfoEntity.class; |
|||
} |
|||
|
|||
@Override |
|||
protected CrudRepository<TbResourceInfoEntity, UUID> getCrudRepository() { |
|||
return resourceInfoRepository; |
|||
} |
|||
|
|||
@Override |
|||
public PageData<TbResourceInfo> findTbResourcesByTenantId(UUID tenantId, PageLink pageLink) { |
|||
return DaoUtil.toPageData(resourceInfoRepository |
|||
.findByTenantId( |
|||
tenantId, |
|||
TenantId.NULL_UUID, |
|||
Objects.toString(pageLink.getTextSearch(), ""), |
|||
DaoUtil.toPageable(pageLink))); } |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
/** |
|||
* Copyright © 2016-2021 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.resource; |
|||
|
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.springframework.data.repository.query.Param; |
|||
import org.thingsboard.server.dao.model.sql.TbResourceInfoEntity; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
public interface TbResourceInfoRepository extends CrudRepository<TbResourceInfoEntity, UUID> { |
|||
|
|||
@Query("SELECT tr FROM TbResourceInfoEntity tr WHERE tr.tenantId = :tenantId " + |
|||
"AND LOWER(tr.searchText) LIKE LOWER(CONCAT(:searchText, '%'))" + |
|||
"AND (tr.tenantId = :tenantId " + |
|||
"OR (tr.tenantId = :systemAdminId " + |
|||
"AND NOT EXISTS " + |
|||
"(SELECT sr FROM TbResourceEntity sr " + |
|||
"WHERE sr.tenantId = :tenantId " + |
|||
"AND tr.resourceType = sr.resourceType " + |
|||
"AND tr.resourceKey = sr.resourceKey)))") |
|||
Page<TbResourceInfoEntity> findByTenantId(@Param("tenantId") UUID tenantId, |
|||
@Param("systemAdminId") UUID sysadminId, |
|||
@Param("searchText") String searchText, |
|||
Pageable pageable); |
|||
} |
|||
Loading…
Reference in new issue