Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(controller): report revert error #2615

Merged
merged 1 commit into from
Aug 11, 2023
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 @@ -51,7 +51,7 @@ public interface ReportMapper {
@Select("SELECT " + COLUMNS_FOR_SELECT + " FROM report WHERE uuid = #{uuid}")
ReportEntity selectByUuid(@Param("uuid") String uuid);

@Select("SELECT " + COLUMNS_FOR_SELECT + " FROM report WHERE uuid = #{uuid} FOR UPDATE")
@Select("SELECT " + COLUMNS_FOR_SELECT + " FROM report WHERE deleted_time = 0 and uuid = #{uuid} FOR UPDATE")
ReportEntity selectByUuidForUpdate(@Param("uuid") String uuid);

@Update("UPDATE report SET shared = #{shared} where id = #{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package ai.starwhale.mlops.domain.report;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import ai.starwhale.mlops.domain.MySqlContainerHolder;
Expand Down Expand Up @@ -83,10 +85,12 @@ public void test() {
mapper.remove(entity.getId());
list = mapper.selectByProject("", 1L);
assertEquals(0, list.size());
assertNull(mapper.selectByUuidForUpdate(entity.getUuid()));

mapper.recover(entity.getId());
list = mapper.selectByProject("", 1L);
assertEquals(1, list.size());
assertNotNull(mapper.selectByUuidForUpdate(entity.getUuid()));

// filter
list = mapper.selectByProject("title", 1L);
Expand Down
Loading