Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private ChatMessagePO convertToChatMessagePO(ChatMessage chatMessage, Long chatT
} else {
return null;
}
ChatThreadPO chatThreadPO = chatThreadDao.findByThreadId(chatThreadId);
ChatThreadPO chatThreadPO = chatThreadDao.findById(chatThreadId);
chatMessagePO.setUserId(chatThreadPO.getUserId());
chatMessagePO.setThreadId(chatThreadId);
return chatMessagePO;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.io.Serializable;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = true)
Expand All @@ -36,8 +35,8 @@ public class AuthPlatformPO extends BasePO implements Serializable {
@Column(name = "id")
private Long id;

@Column(name = "credentials", columnDefinition = "json", nullable = false)
private Map<String, String> credentials;
@Column(name = "credentials", nullable = false)
private String credentials;

@Column(name = "platform_id", nullable = false)
private Long platformId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.io.Serializable;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = true)
Expand All @@ -38,8 +37,8 @@ public class ChatThreadPO extends BasePO implements Serializable {
@Column(name = "model", nullable = false, length = 255)
private String model;

@Column(name = "thread_info", columnDefinition = "json")
private Map<String, String> threadInfo;
@Column(name = "thread_info")
private String threadInfo;

@Column(name = "user_id", nullable = false)
private Long userId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.io.Serializable;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = true)
Expand All @@ -39,8 +38,8 @@ public class PlatformPO extends BasePO implements Serializable {
@Column(name = "name", nullable = false, length = 255)
private String name;

@Column(name = "credential", columnDefinition = "json", nullable = false)
private Map<String, String> credential;
@Column(name = "credential", nullable = false)
private String credential;

@Column(name = "support_models", length = 255)
private String supportModels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,5 @@
import org.apache.ibatis.annotations.Param;

public interface AuthPlatformDao extends BaseDao<AuthPlatformPO> {
AuthPlatformPO findByAuthId(@Param("authId") Long authId);

AuthPlatformPO findByPlatformId(@Param("platformId") Long platformId);

void saveWithCredentials(AuthPlatformPO authPlatformPO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -63,14 +65,24 @@ public interface BaseDao<Entity> {
/**
* Partially update the entities by primary key.
*/
@UpdateProvider(type = BaseSqlProvider.class, method = "partialUpdateByIds")
int partialUpdateByIds(List<Entity> entities);
@Transactional
default int partialUpdateByIds(List<Entity> entities) {
for (Entity entity : entities) {
partialUpdateById(entity);
}
return entities.size();
}

/**
* Fully update the entities by primary key.
*/
@UpdateProvider(type = BaseSqlProvider.class, method = "updateByIds")
int updateByIds(List<Entity> entities);
@Transactional
default int updateByIds(List<Entity> entities) {
for (Entity entity : entities) {
updateById(entity);
}
return entities.size();
}

/**
* Query the entity by primary key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
public interface ChatThreadDao extends BaseDao<ChatThreadPO> {
List<ChatThreadPO> findAllByUserId(@Param("userId") Long userId);

ChatThreadPO findByThreadId(@Param("id") Long id);

List<ChatThreadPO> findAllByAuthIdAndUserId(@Param("authId") Long authId, @Param("userId") Long userId);

void saveWithThreadInfo(ChatThreadPO chatThreadPO);

List<ChatThreadPO> findAllByAuthId(@Param("authId") Long authId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@

import org.apache.bigtop.manager.dao.po.PlatformPO;

public interface PlatformDao extends BaseDao<PlatformPO> {
PlatformPO findByPlatformId(Long id);
}
public interface PlatformDao extends BaseDao<PlatformPO> {}
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,6 @@ public <Entity> String partialUpdateById(Entity entity, ProviderContext context)
return SQLBuilder.update(tableMetaData, entity, databaseId, true);
}

public <Entity> String partialUpdateByIds(List<Entity> entities, ProviderContext context) {
Assert.notNull(entities, "entities must not be null");
Assert.notEmpty(entities, "entities list must not be empty");

String databaseId = context.getDatabaseId();

Class<?> entityClass = entities.get(0).getClass();

TableMetaData tableMetaData = TableMetaData.forClass(entityClass);

return SQLBuilder.updateList(tableMetaData, entities, databaseId, true);
}

public <Entity> String updateById(Entity entity, ProviderContext context) {
Assert.notNull(entity, "entity must not null");

Expand All @@ -95,19 +82,6 @@ public <Entity> String updateById(Entity entity, ProviderContext context) {
return SQLBuilder.update(tableMetaData, entity, databaseId, false);
}

public <Entity> String updateByIds(List<Entity> entities, ProviderContext context) {
Assert.notNull(entities, "entities must not be null");
Assert.notEmpty(entities, "entities list must not be empty");

String databaseId = context.getDatabaseId();

Class<?> entityClass = entities.get(0).getClass();

TableMetaData tableMetaData = TableMetaData.forClass(entityClass);

return SQLBuilder.updateList(tableMetaData, entities, databaseId, false);
}

public String selectById(Serializable id, ProviderContext context) {
String databaseId = context.getDatabaseId();

Expand Down
Loading