Skip to content

Commit

Permalink
test boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
lhpqaq committed Sep 14, 2024
1 parent 8be1500 commit d436bb8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class PlatformAuthorizedPO extends BasePO implements Serializable {
private Long platformId;

@Column(name = "is_deleted")
private Integer isDeleted;
private Boolean isDeleted;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
AND is_deleted = 0
</select>

<update id="deleteByThreadId" parameterType="int">
<update id="deleteByThreadId" parameterType="java.lang.Long">
UPDATE llm_chat_message
SET is_deleted = 1
WHERE thread_id = #{threadId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.bigtop.manager.dao.repository.ChatThreadDao">
<sql id="baseColumns">
id, user_id, platform_id, model
id, user_id, platform_id, model, is_deleted, thread_info
</sql>

<resultMap id="ChatThreadResultMap" type="org.apache.bigtop.manager.dao.po.ChatThreadPO">
Expand Down Expand Up @@ -56,13 +56,13 @@
thread_info = VALUES(thread_info)
</insert>

<update id="deleteByPlatformId" parameterType="int">
<update id="deleteByPlatformId" parameterType="java.lang.Long">
UPDATE llm_chat_thread
SET is_deleted = 1
WHERE platformId = #{platformId}
</update>

<update id="deleteByThreadId" parameterType="int">
<update id="deleteByThreadId" parameterType="java.lang.Long">
UPDATE llm_chat_thread
SET is_deleted = 1
WHERE id = #{id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
<mapper namespace="org.apache.bigtop.manager.dao.repository.PlatformAuthorizedDao">

<sql id="baseColumns">
id, credentials, platfotrm_id
id, credentials, platfotrm_id, is_deleted
</sql>

<resultMap id="PlatformAuthorizedResultMap" type="org.apache.bigtop.manager.dao.po.PlatformAuthorizedPO">
<result property="credentials" column="credentials" typeHandler="org.apache.bigtop.manager.dao.handler.JsonTypeHandler"/>
</resultMap>

<select id="findByPlatformId" resultMap="PlatformAuthorizedResultMap">
SELECT * FROM llm_platform_authorized WHERE id = #{id} AND is_deleted = 0
SELECT * FROM llm_platform_authorized WHERE id = #{id} AND is_deleted = false
</select>

<select id="findAllPlatform" resultMap="PlatformAuthorizedResultMap">
SELECT * FROM llm_platform_authorized WHERE is_deleted = 0
SELECT * FROM llm_platform_authorized WHERE is_deleted = false
</select>

<insert id="saveWithCredentials" parameterType="org.apache.bigtop.manager.dao.po.PlatformAuthorizedPO" useGeneratedKeys="true" keyProperty="id">
Expand All @@ -46,9 +46,9 @@
credentials = VALUES(credentials)
</insert>

<update id="deleteByPlatformId" parameterType="int">
<update id="deleteByPlatformId" parameterType="java.lang.Long">
UPDATE llm_platform_authorized
SET is_deleted = 1
SET is_deleted = true
WHERE id = #{id}
</update>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public boolean deleteAuthorizedPlatform(Long platformId) {
List<PlatformAuthorizedPO> authorizedPlatformPOs = platformAuthorizedDao.findAllPlatform();
for (PlatformAuthorizedPO authorizedPlatformPO : authorizedPlatformPOs) {
if (authorizedPlatformPO.getId().equals(platformId)) {
log.info("Delete authorized platform: {}", authorizedPlatformPO.getId());
platformAuthorizedDao.deleteByPlatformId(authorizedPlatformPO.getId());
chatThreadDao.deleteByPlatformId(authorizedPlatformPO.getId());
return true;
Expand Down

0 comments on commit d436bb8

Please sign in to comment.