add isFavorite to project list api (#26)

* feat: add isFavorite to project list api

* feat:update frontend resources
This commit is contained in:
vran
2022-02-25 20:55:00 +08:00
committed by GitHub
parent decd76dd42
commit e799940c2d
29 changed files with 49 additions and 23 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.List;
import static com.databasir.dao.Tables.*;
@@ -59,4 +60,14 @@ public class UserFavoriteProjectDao extends BaseDao<UserFavoriteProjectPojo> {
.fetchInto(UserFavoriteProjectPojo.class);
return new PageImpl<>(data, request, total);
}
public List<UserFavoriteProjectPojo> selectByUserIdAndProjectIds(Integer userId, List<Integer> projectIds) {
if (projectIds == null || projectIds.isEmpty()) {
return Collections.emptyList();
}
return this.getDslContext()
.select(USER_FAVORITE_PROJECT.fields()).from(USER_FAVORITE_PROJECT)
.where(USER_FAVORITE_PROJECT.USER_ID.eq(userId).and(USER_FAVORITE_PROJECT.PROJECT_ID.in(projectIds)))
.fetchInto(UserFavoriteProjectPojo.class);
}
}