Browse Source

AI rule node: remove `findNextBatch()` method

pull/13371/head
Dmytro Skarzhynets 1 year ago
parent
commit
f06b1d5feb
No known key found for this signature in database GPG Key ID: 2B51652F224037DF
  1. 40
      common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/AiSettingsFields.java
  2. 7
      dao/src/main/java/org/thingsboard/server/dao/sql/ai/AiSettingsRepository.java

40
common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/AiSettingsFields.java

@ -1,40 +0,0 @@
/**
* Copyright © 2016-2025 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.edqs.fields;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class AiSettingsFields extends AbstractEntityFields {
private String provider;
private String model;
private String apiKey;
public AiSettingsFields(UUID id, long createdTime, UUID tenantId, long version, String provider, String name, String model, String apiKey) {
super(id, createdTime, tenantId, name, version);
this.provider = provider;
this.model = model;
this.apiKey = apiKey;
}
}

7
dao/src/main/java/org/thingsboard/server/dao/sql/ai/AiSettingsRepository.java

@ -35,12 +35,7 @@ public interface AiSettingsRepository extends JpaRepository<AiSettingsEntity, UU
Optional<AiSettingsEntity> findByTenantIdAndId(UUID tenantId, UUID id);
@Query("SELECT new org.thingsboard.server.common.data.edqs.fields.AiSettingsFields(" +
"ai.id, ai.createdTime, ai.tenantId, ai.version, ai.provider, ai.name, ai.model, ai.apiKey) " +
"FROM AiSettingsEntity ai WHERE ai.id > :id ORDER BY ai.id")
List<AiSettingsFields> findNextBatch(@Param("id") UUID id, Limit limit);
Long countByTenantId(UUID tenantId);
long countByTenantId(UUID tenantId);
@Transactional
void deleteByTenantId(UUID tenantId);

Loading…
Cancel
Save