Skip to content

Commit

Permalink
Change Integer to Long in Product.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Sofiyan-coder committed Sep 26, 2024
1 parent 1805ef7 commit be9e493
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Product {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private Integer id;
private Long id;

@Basic
@Column(name = "name", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@RequiredArgsConstructor
@Getter
@Tag(name = "Product Admin", description = "Endpoints for managing products")
public class ProductAdminController extends CrudController<ProductAdminReq, ProductAdminRes, Integer> {
public class ProductAdminController extends CrudController<ProductAdminReq, ProductAdminRes, Long> {

private final ProductAdminService service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Service
@RequiredArgsConstructor
@Getter
public class ProductAdminService extends CrudServiceImp<ProductAdminReq, ProductAdminRes, Product, Integer> {
public class ProductAdminService extends CrudServiceImp<ProductAdminReq, ProductAdminRes, Product, Long> {

private final ProductRepository repository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.stereotype.Repository;

@Repository
public interface ProductRepository extends JpaRepository<Product, Integer> {
public interface ProductRepository extends JpaRepository<Product, Long> {

@Query(value = "SELECT p FROM Product p WHERE p.id NOT IN (SELECT phs.product.id FROM ProductHasShoppingList phs WHERE phs.shoppingList.id = :id AND phs.shoppingList.user = :user)")
Page<Product> findAllByIdNotInShoppingListIdAndUser(Integer id, User user, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class FindAllProductRes extends PagingAndSortingRes<FindAllProductRes.Pro
@Data
public static class Product {

private Integer id;
private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class FindAllShoppingListProductRes extends PagingAndSortingRes<FindAllSh
@Data
public static class Product {

private Integer id;
private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Data
public class ProductAdminRes {

private Integer id;
private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@Data
public class SaveShoppingListProductReq {

private Integer productId;
private Long productId;

private Integer shoppingListId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static class ShoppingList {
@NoArgsConstructor
public static class Product {

private Integer id;
private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class ProductHasShoppingListPK implements Serializable {

@Column(name = "product_id", nullable = false)
private Integer productId;
private Long productId;

@Column(name = "shopping_list_id", nullable = false)
private Integer shoppingListId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public interface ProductHasShoppingListRepository extends JpaRepository<ProductH
"SELECT p FROM ProductHasShoppingList p WHERE p.shoppingList.id = :shoppingListId AND p.shoppingList.user = :user AND p.product.id = :productId")
Optional<ProductHasShoppingList> findByShoppingListIdAndUserAndProductId(Integer shoppingListId,
User user,
Integer productId);
Long productId);

@Query(
"SELECT p FROM ProductHasShoppingList p WHERE p.shoppingList.id = :id AND p.shoppingList.user = :user AND p.product.id IN :productsId")
List<ProductHasShoppingList> findAllByShoppingListIdAndUserAndProductIdIn(Integer id,
User user,
List<Integer> productsId);
List<Long> productsId);

@Query(
"SELECT p FROM ProductHasShoppingList p WHERE p.shoppingList.id = :id AND p.shoppingList.user = :user AND p.product.id IN :productsId AND p.unitType.id IN :unitTypesId")
List<ProductHasShoppingList> findAllByShoppingListIdAndUserAndProductIdInAndUnitTypeIdIn(Integer id,
User user,
List<Integer> productsId,
List<Long> productsId,
List<Integer> unitTypesId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public FindByIdShoppingListRes findById(Integer id, User user) {
return response;
}

public FindByIdProductShoppingListRest findByIdProduct(Integer id, Integer productId, User user) {
public FindByIdProductShoppingListRest findByIdProduct(Integer id, Long productId, User user) {
Optional<ProductHasShoppingList> productShoppingListOptional = this.productHasShoppingListRepository.findByShoppingListIdAndUserAndProductId(
id,
user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
@Data
public class DeleteProductsShoppingListReq {

private List<Integer> productsId;
private List<Long> productsId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static class ProductShoppingList {
@Data
public static class Product {

private Integer id;
private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class ProductShoppingList {

private boolean selected;

private Integer productId;
private Long productId;

private Integer unitTypeId;

Expand Down

0 comments on commit be9e493

Please sign in to comment.