diff --git a/frameworks/innerkitsimpl/medialibrary_data_extension/src/medialibrary_photo_operations.cpp b/frameworks/innerkitsimpl/medialibrary_data_extension/src/medialibrary_photo_operations.cpp index 1ac5e60d492bfadc5d2d07c626fa5b59db84cd97..ca67694c335df2978b575374f0c8912661959c21 100644 --- a/frameworks/innerkitsimpl/medialibrary_data_extension/src/medialibrary_photo_operations.cpp +++ b/frameworks/innerkitsimpl/medialibrary_data_extension/src/medialibrary_photo_operations.cpp @@ -319,7 +319,8 @@ static bool AppendValidOrderClause(MediaLibraryCommand &cmd, RdbPredicates &pred } string columnName = " (" + dateType + ", " + MediaColumn::MEDIA_ID + ") "; string value = " (SELECT " + dateType + ", " + MediaColumn::MEDIA_ID + " FROM " + - PhotoColumn::PHOTOS_TABLE + " WHERE " + MediaColumn::MEDIA_ID + " = " + photoId + ") "; + PhotoColumn::PHOTOS_TABLE + " WHERE " + MediaColumn::MEDIA_ID + " = " + photoId + " AND " + + MediaColumn::MEDIA_DATE_TRASHED + " = 0 AND " + MediaColumn::MEDIA_HIDDEN + " = 0 ) "; string whereClause = predicates.GetWhereClause(); whereClause += " AND " + columnName + comparisonOperator + value; predicates.SetWhereClause(whereClause);