@@ -102,6 +102,24 @@ public class JdbcSeriesDao implements SeriesDao {
102
102
@ Value ("${series.add_similar_series}" )
103
103
private String addSimilarSeriesSql ;
104
104
105
+ @ Value ("${series.add_michel_price}" )
106
+ private String addMichelPriceSql ;
107
+
108
+ @ Value ("${series.add_scott_price}" )
109
+ private String addScottPriceSql ;
110
+
111
+ @ Value ("${series.add_yvert_price}" )
112
+ private String addYvertPriceSql ;
113
+
114
+ @ Value ("${series.add_gibbons_price}" )
115
+ private String addGibbonsPriceSql ;
116
+
117
+ @ Value ("${series.add_solovyov_price}" )
118
+ private String addSolovyovPriceSql ;
119
+
120
+ @ Value ("${series.add_zagorski_price}" )
121
+ private String addZagorskiPriceSql ;
122
+
105
123
@ Override
106
124
public Integer add (AddSeriesDbDto series ) {
107
125
Map <String , Object > params = new HashMap <>();
@@ -349,4 +367,51 @@ public void markAsSimilar(Integer seriesId, Integer similarSeriesId) {
349
367
);
350
368
}
351
369
370
+ @ Override
371
+ public void addMichelPrice (AddCatalogPriceDbDto dto ) {
372
+ addCatalogPrice (addMichelPriceSql , dto );
373
+ }
374
+
375
+ @ Override
376
+ public void addScottPrice (AddCatalogPriceDbDto dto ) {
377
+ addCatalogPrice (addScottPriceSql , dto );
378
+ }
379
+
380
+ @ Override
381
+ public void addYvertPrice (AddCatalogPriceDbDto dto ) {
382
+ addCatalogPrice (addYvertPriceSql , dto );
383
+ }
384
+
385
+ @ Override
386
+ public void addGibbonsPrice (AddCatalogPriceDbDto dto ) {
387
+ addCatalogPrice (addGibbonsPriceSql , dto );
388
+ }
389
+
390
+ @ Override
391
+ public void addSolovyovPrice (AddCatalogPriceDbDto dto ) {
392
+ addCatalogPrice (addSolovyovPriceSql , dto );
393
+ }
394
+
395
+ @ Override
396
+ public void addZagorskiPrice (AddCatalogPriceDbDto dto ) {
397
+ addCatalogPrice (addZagorskiPriceSql , dto );
398
+ }
399
+
400
+ private void addCatalogPrice (String query , AddCatalogPriceDbDto dto ) {
401
+ Map <String , Object > params = new HashMap <>();
402
+ params .put ("series_id" , dto .getSeriesId ());
403
+ params .put ("price" , dto .getPrice ());
404
+ params .put ("updated_at" , dto .getUpdatedAt ());
405
+ params .put ("updated_by" , dto .getUpdatedBy ());
406
+
407
+ int affected = jdbcTemplate .update (query , params );
408
+
409
+ // @todo #1340 Update series: handle refuse to update an existing price gracefully
410
+ Validate .validState (
411
+ affected == 1 ,
412
+ "Unexpected number of affected rows after updating series: %d" ,
413
+ affected
414
+ );
415
+ }
416
+
352
417
}
0 commit comments