Skip to content

Commit 8487a12

Browse files
committed
refactor: move a query for series_sales table to appropriate properties file.
Part of #1051
1 parent 6e5c842 commit 8487a12

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/main/java/ru/mystamps/web/feature/series/JdbcSeriesDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class JdbcSeriesDao implements SeriesDao {
7878
@Value("${series.find_by_country_slug}")
7979
private String findByCountrySlugSql;
8080

81-
@Value("${series.find_purchases_and_sales_by_series_id}")
81+
@Value("${series_sales.find_sales_by_series_id}")
8282
private String findPurchasesAndSalesBySeriesIdSql;
8383

8484
@Value("${series.count_all_series}")

src/main/resources/sql/series_dao_queries.properties

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -184,26 +184,6 @@ series.find_by_country_slug = \
184184
ON count.id = s.country_id \
185185
WHERE count.slug = :slug
186186

187-
series.find_purchases_and_sales_by_series_id = \
188-
SELECT date \
189-
, seller.name AS seller_name \
190-
, seller.url AS seller_url \
191-
, buyer.name AS buyer_name \
192-
, buyer.url AS buyer_url \
193-
, transaction_url \
194-
, first_price \
195-
, first_currency \
196-
, second_price \
197-
, second_currency \
198-
, cond \
199-
FROM series_sales ss \
200-
JOIN transaction_participants seller \
201-
ON seller.id = ss.seller_id \
202-
LEFT JOIN transaction_participants buyer \
203-
ON buyer.id = ss.buyer_id \
204-
WHERE ss.series_id = :series_id \
205-
ORDER BY ss.date DESC
206-
207187
series.count_all_series = \
208188
SELECT COUNT(*) \
209189
FROM series

src/main/resources/sql/series_sales_dao_queries.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,23 @@ VALUES \
2828
, :created_at \
2929
, :created_by \
3030
)
31+
32+
series_sales.find_sales_by_series_id = \
33+
SELECT date \
34+
, seller.name AS seller_name \
35+
, seller.url AS seller_url \
36+
, buyer.name AS buyer_name \
37+
, buyer.url AS buyer_url \
38+
, transaction_url \
39+
, first_price \
40+
, first_currency \
41+
, second_price \
42+
, second_currency \
43+
, cond \
44+
FROM series_sales ss \
45+
JOIN transaction_participants seller \
46+
ON seller.id = ss.seller_id \
47+
LEFT JOIN transaction_participants buyer \
48+
ON buyer.id = ss.buyer_id \
49+
WHERE ss.series_id = :series_id \
50+
ORDER BY ss.date DESC

0 commit comments

Comments
 (0)