From 0361b622e9301b5cf2bfea8ab1b9727f8bf9f738 Mon Sep 17 00:00:00 2001 From: ksenianeva <95441235+ksenianeva@users.noreply.github.com> Date: Tue, 16 May 2023 12:01:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A2=D1=80=D0=B5=D1=82=D1=8C=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.=20=D0=94=D0=BE?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20+?= =?UTF-8?q?=20=D1=81=D0=BE=D0=BF=D1=83=D1=82=D1=81=D1=82=D0=B2=D1=83=D1=8E?= =?UTF-8?q?=D1=89=D0=B8=D0=B5=20=D1=84=D0=B8=D0=BA=D1=81=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/lab/data.mv.db | Bin 77824 -> 90112 bytes .../lab/DataBase/Services/CartService.java | 9 +++--- .../Services/CountProductService.java | 10 +++++++ .../DataBase/Services/CustomerService.java | 2 ++ .../test/java/com/example/lab/DBTests.java | 26 ++++++++++++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/backend/lab/data.mv.db b/backend/lab/data.mv.db index cdafddd985c8297c5793b283da4b663e6008d923..93cbf332f5c1876d7db7c1477104d9ceaf6fbf67 100644 GIT binary patch literal 90112 zcmeHwYm6M(bzXJP45xOM+!vP=x!R?gvs{w18jkAL<5txG0k&t@!x_$#-91B&<7iON zT|(pxJseV`AwdgATEIy3OF-Z_Fk%~t6a$tmOOb)ZKrC4K>&K5s0gNDqVEr)=B!8Sh zKN2|S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rl$z!BgGa0EC4_Z$J{{~zk) zUg-a?0Y!_Zt1feaAKGCect2wP|31^+uUgk;SgbtB>*4=**oJvvj;DG$)pb-9>0&@4 zME(D*yW#(Ty6^{-|9|-$<^P9c2LJ!}IsZTB|L5@t?olj;eG%9VM&Qi(|5;3pARq$g z|L5^W;;~lt_07FKxJQRxWWxXdf1LlH^ZyHj^67K_e;VqE^Z)loHsZZ(ChPmqyY2fw zL*5cHTf#ko<(|Cs{%@jO!Uut_f9SQ$`TvI>&tT}41jg>l(VtQNf3TMlo=!NX`TyU+ z`TtXdX`GCblTiYf_Du^@lhb&-4>PeXw?F6aN}{QsQ)KS_lgWAP8EfU{Wq zmA5?qzq1$rzcYOPf2ZiU5YpsxPk-q^wnP6OZv25mzbwAp9Qq?l!X#IHhJUwBi2|J- zM*-@xtUD-h?4}O=Qb7Gr9r}SNvX>VU+#f<$2+5|-1dlLdR~G`7h7_2B;sG zC3Wn!Apb4z*6xg&_C+VY4M+n?W4;YYag)C2dy4E5kqtX8v8Z$Rc@`wXCJyYfrkZgV z63ds8FaxDzf0zGU_xUjDLg-tAXye!`>cSncUiOF>Z@h3GFk!|#{6z!%_ftn27IlGM zV3&Rf!I1FpzoV!N5NZJaasPh;1OLMj;0SO8I0762jsQo1Bft^39}wvEzYmpO@SqR< z{|yWL|DC(&|1Sm6320 getAllCountProducts(){ return em.createQuery("from CountProduct", CountProduct.class).getResultList(); } + + @Transactional + public List getFilteredCountProduct(Long customerId, int amount, int minSum){ + return em.createQuery("SELECT c FROM CountProduct c" + + " WHERE c.cart.customer.id = ?1 AND c.amount = ?2 AND c.product.price > ?3",CountProduct.class) + .setParameter(1, customerId) + .setParameter(2, amount) + .setParameter(3, minSum) + .getResultList(); + } } \ No newline at end of file diff --git a/backend/lab/src/main/java/com/example/lab/DataBase/Services/CustomerService.java b/backend/lab/src/main/java/com/example/lab/DataBase/Services/CustomerService.java index fd4e52c..e13c9d0 100644 --- a/backend/lab/src/main/java/com/example/lab/DataBase/Services/CustomerService.java +++ b/backend/lab/src/main/java/com/example/lab/DataBase/Services/CustomerService.java @@ -1,4 +1,6 @@ package com.example.lab.DataBase.Services; +import com.example.lab.DataBase.Models.Cart; +import com.example.lab.DataBase.Models.CountProduct; import jakarta.persistence.*; import jakarta.transaction.Transactional; import org.springframework.stereotype.Service; diff --git a/backend/lab/src/test/java/com/example/lab/DBTests.java b/backend/lab/src/test/java/com/example/lab/DBTests.java index af2b6e4..94e3f4b 100644 --- a/backend/lab/src/test/java/com/example/lab/DBTests.java +++ b/backend/lab/src/test/java/com/example/lab/DBTests.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.util.*; @SpringBootTest public class DBTests { @@ -107,6 +108,31 @@ public class DBTests { cleanAll(); } + @Test + void testCountProductService(){ + cleanAll(); + ProductCategory productCategory = productCategoryService + .addProductCategory("exampleCategory"); + Product product1 = productService + .addProduct("exampleProduct1", (float)50, productCategory); + Product product2 = productService + .addProduct("exampleProduct2", (float)500, productCategory); + Product product3 = productService + .addProduct("exampleProduct2", (float)200, productCategory); + Customer customer = customerService.addCustomer("Ivan", + "Ivanov", "cityExample"); + Cart cart = cartService.addCart(customer); + CountProduct countProduct = cartService.addProduct(cart.getId(), product1.getId()); + CountProduct countProduct2 = cartService.addProduct(cart.getId(), product2.getId()); + CountProduct countProduct3 = cartService.addProduct(cart.getId(), product3.getId()); + List expected = new ArrayList<>(); + countProduct2 = countProductService.incrementProduct(countProduct2.getProduct().getId(), countProduct2.getCart().getId()); + countProduct2 = countProductService.incrementProduct(countProduct2.getProduct().getId(), countProduct2.getCart().getId()); + expected.add(countProduct2); + Assertions.assertEquals(expected, countProductService.getFilteredCountProduct(customer.getId(), 3,100)); + cleanAll(); + } + public void cleanAll(){ countProductService.deleteAll(); productService.deleteAllProducts();