File tree 2 files changed +10
-8
lines changed
java/ru/mystamps/web/dao/impl
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,8 @@ public String findLastCreatedByUser(Integer userId) {
223
223
return jdbcTemplate .queryForObject (
224
224
findLastCreatedByUserSql ,
225
225
Collections .singletonMap ("created_by" , userId ),
226
- String .class );
226
+ String .class
227
+ );
227
228
} catch (EmptyResultDataAccessException ignored ) {
228
229
return null ;
229
230
}
@@ -237,10 +238,9 @@ public String findPopularCountryInCollection(Integer userId) {
237
238
try {
238
239
return jdbcTemplate .queryForObject (
239
240
findPopularCountryInCollectionSql ,
240
- Collections .< String , Object > emptyMap ( ),
241
+ Collections .singletonMap ( "user_id" , userId ),
241
242
String .class
242
243
);
243
-
244
244
} catch (EmptyResultDataAccessException ignored ) {
245
245
return null ;
246
246
}
Original file line number Diff line number Diff line change @@ -92,10 +92,12 @@ country.find_last_created_by_user = \
92
92
LIMIT 1
93
93
94
94
country.find_popular_country_from_user_collection = \
95
- SELECT c .slug \
95
+ SELECT co .slug \
96
96
FROM collections c \
97
97
JOIN collections_series cs ON c.id = cs.collection_id \
98
- WHERE c.user_id = :user_id \
99
- GROUP BY country_id \
100
- ORDER BY COUNT(*) DESC\
101
- LIMIT 1
98
+ JOIN series s ON s.id = cs.series_id \
99
+ JOIN countries co ON co.id = s.country_id \
100
+ WHERE c.user_id = :user_id \
101
+ GROUP BY co.id \
102
+ ORDER BY COUNT(*) DESC \
103
+ LIMIT 1
You can’t perform that action at this time.
0 commit comments