Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
4ccf07dd
Commit
4ccf07dd
authored
Dec 18, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix query right join select
parent
296ca215
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
31 deletions
+32
-31
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+0
-3
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+2
-2
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+30
-26
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
4ccf07dd
...
@@ -64,7 +64,6 @@ class AlbumsContractModule @Inject constructor(
...
@@ -64,7 +64,6 @@ class AlbumsContractModule @Inject constructor(
private
val
fetchTopLevelAlbumsDb
=
private
val
fetchTopLevelAlbumsDb
=
db
.
getTopLevelAlbums
()
db
.
getTopLevelAlbums
()
.
toObservable
()
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
...
@@ -99,8 +98,6 @@ class AlbumsContractModule @Inject constructor(
...
@@ -99,8 +98,6 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchAlbumsDb
(
parentAlbumId
:
Int
)
=
private
fun
fetchAlbumsDb
(
parentAlbumId
:
Int
)
=
db
.
getChildAlbums
(
parentAlbumId
)
db
.
getChildAlbums
(
parentAlbumId
)
.
toList
()
.
toObservable
()
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
4ccf07dd
...
@@ -18,8 +18,8 @@ interface IDb {
...
@@ -18,8 +18,8 @@ interface IDb {
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
fun
userObservableResult
(
uuid
:
Int
):
Observable
<
ReactiveResult
<
UserEntity
>>
fun
userObservableResult
(
uuid
:
Int
):
Observable
<
ReactiveResult
<
UserEntity
>>
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
):
Observable
<
ArticleEntity
>
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
):
Observable
<
ArticleEntity
>
fun
getTopLevelAlbums
():
Single
<
Mutable
List
<
ImageAlbumEntity
>>
fun
getTopLevelAlbums
():
Observable
<
List
<
ImageAlbumEntity
>>
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
List
<
ImageAlbumEntity
>
>
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
):
ImageAlbumJunctionEntity
?
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
):
ImageAlbumJunctionEntity
?
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
4ccf07dd
...
@@ -45,52 +45,58 @@ class RequeryRepository @Inject constructor(
...
@@ -45,52 +45,58 @@ class RequeryRepository @Inject constructor(
)
)
:
IDb
{
:
IDb
{
private
inline
fun
<
reified
T
:
Persistable
>
fetchAll
()
=
private
inline
fun
<
reified
T
:
Persistable
>
fetchAll
()
=
store
.
select
(
T
::
class
)
store
.
select
(
T
::
class
)
override
fun
upsertUser
(
entity
:
UserEntity
):
Observable
<
UserEntity
>
=
override
fun
upsertUser
(
entity
:
UserEntity
):
Observable
<
UserEntity
>
=
store
.
upsert
(
entity
).
toObservable
()
store
.
upsert
(
entity
).
toObservable
()
override
fun
<
T
:
Persistable
>
upsert
(
entity
:
T
)
=
store
.
upsert
(
entity
)
override
fun
<
T
:
Persistable
>
upsert
(
entity
:
T
)
=
store
.
upsert
(
entity
)
override
fun
<
T
:
List
<
Persistable
>
>
upsert
(
entity
:
T
):
Single
<
Iterable
<
Persistable
>>
=
override
fun
<
T
:
List
<
Persistable
>
>
upsert
(
entity
:
T
):
Single
<
Iterable
<
Persistable
>>
=
store
.
upsert
(
entity
)
store
.
upsert
(
entity
)
override
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
=
override
fun
<
T
:
List
<
Persistable
>
>
blockingUpsert
(
entity
:
T
)
=
store
.
upsert
(
entity
).
toObservable
().
blockingSubscribe
()
store
.
upsert
(
entity
).
toObservable
().
blockingSubscribe
()
override
fun
fetchFeeds
():
Observable
<
FeedEntity
>
=
override
fun
fetchFeeds
():
Observable
<
FeedEntity
>
=
fetchAll
<
FeedEntity
>().
get
().
observable
()
fetchAll
<
FeedEntity
>().
get
().
observable
()
override
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
=
override
fun
getFeed
(
feedAlias
:
String
):
ReactiveResult
<
FeedEntity
>
=
fetchAll
<
FeedEntity
>().
where
(
FeedEntity
.
ALIAS
.
eq
(
feedAlias
))
fetchAll
<
FeedEntity
>().
where
(
FeedEntity
.
ALIAS
.
eq
(
feedAlias
))
.
get
()
.
get
()
override
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
=
override
fun
getArticle
(
id
:
Int
):
ReactiveResult
<
ArticleEntity
>
=
fetchAll
<
ArticleEntity
>().
where
(
ArticleEntity
.
ID
.
eq
(
id
))
fetchAll
<
ArticleEntity
>().
where
(
ArticleEntity
.
ID
.
eq
(
id
))
.
get
()
.
get
()
override
fun
getTopLevelAlbums
():
Single
<
MutableList
<
ImageAlbumEntity
>>
=
override
fun
getTopLevelAlbums
():
Observable
<
List
<
ImageAlbumEntity
>>
=
fetchAll
<
ImageAlbumEntity
>()
Observable
.
fromArray
(
.
join
(
ImageAlbumJunctionEntity
::
class
)
store
.
raw
(
.
on
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
ImageAlbumEntity
.
ID
))
ImageAlbumEntity
::
class
,
.
where
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
isNull
())
"SELECT alb.* from ImageAlbumJunction albJun "
+
.
get
().
observable
().
toList
()
"left join ImageAlbum alb on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is null "
override
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
ImageAlbumEntity
>
=
).
toList
()
store
.
select
(
ImageAlbumEntity
::
class
)
)
.
join
(
ImageAlbumJunctionEntity
::
class
)
.
on
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
ImageAlbumEntity
.
ID
))
override
fun
getChildAlbums
(
parentId
:
Int
):
Observable
<
List
<
ImageAlbumEntity
>>
=
.
where
(
ImageAlbumJunctionEntity
.
PARENT_ID
.
eq
(
parentId
))
Observable
.
fromArray
(
.
get
().
observable
()
store
.
raw
(
ImageAlbumEntity
::
class
,
"SELECT alb.* from ImageAlbumJunction albJun "
+
"left join ImageAlbum alb on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is $parentId "
).
toList
()
)
override
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
=
override
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
=
store
.
select
(
GalleryPhotoEntity
::
class
)
store
.
select
(
GalleryPhotoEntity
::
class
)
.
where
(
GalleryPhotoEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
where
(
GalleryPhotoEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
get
().
observable
()
.
get
().
observable
()
override
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
)
override
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
,
startIndex
:
Int
)
:
Observable
<
ArticleEntity
>
=
:
Observable
<
ArticleEntity
>
=
fetchAll
<
ArticleEntity
>()
fetchAll
<
ArticleEntity
>()
.
where
(
ArticleEntity
.
FEED_ID
.
eq
(
feedAlias
))
.
where
(
ArticleEntity
.
FEED_ID
.
eq
(
feedAlias
))
...
@@ -99,25 +105,23 @@ class RequeryRepository @Inject constructor(
...
@@ -99,25 +105,23 @@ class RequeryRepository @Inject constructor(
.
offset
(
startIndex
)
.
offset
(
startIndex
)
.
get
().
observable
()
.
get
().
observable
()
override
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
)
=
override
fun
checkIfExistsAlbumJunction
(
albumId
:
Int
,
parentAlbumId
:
Int
)
=
fetchAll
<
ImageAlbumJunctionEntity
>()
fetchAll
<
ImageAlbumJunctionEntity
>()
.
where
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
where
(
ImageAlbumJunctionEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
and
(
ImageAlbumJunctionEntity
.
PARENT_ID
.
eq
(
parentAlbumId
))
.
and
(
ImageAlbumJunctionEntity
.
PARENT_ID
.
eq
(
parentAlbumId
))
.
get
()
.
get
()
.
firstOrNull
()
.
firstOrNull
()
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
fetchAll
<
UserEntity
>().
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
fetchAll
<
UserEntity
>().
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
store
.
upsert
(
entity
)
store
.
upsert
(
entity
)
override
fun
userObservableResult
(
uuid
:
Int
)
=
override
fun
userObservableResult
(
uuid
:
Int
)
=
store
.
select
(
UserEntity
::
class
)
store
.
select
(
UserEntity
::
class
)
.
where
(
UserEntity
.
UUID
.
eq
(
uuid
))
.
where
(
UserEntity
.
UUID
.
eq
(
uuid
))
.
get
()
.
get
()
.
observableResult
()
.
observableResult
()
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment