Skip to content

Commit 0c41cb7

Browse files
committed
Remove query
1 parent 0a7b1c8 commit 0c41cb7

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/main/java/app/repository/WareTransactionDetailRepository.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import app.enums.WareTransactionType;
44
import app.model.WareTransactionDetail;
5-
import app.projection.StockProjection;
65
import org.springframework.data.jpa.repository.JpaRepository;
76
import org.springframework.data.jpa.repository.Query;
87
import org.springframework.data.repository.query.Param;
98

10-
import java.time.LocalDateTime;
119
import java.util.List;
1210
import java.util.Optional;
1311

@@ -26,21 +24,4 @@ Optional<Long> findTotalQuantityByProductAndShelfAndWareTransactionType(
2624
@Param("shelfId") Long shelfId,
2725
@Param("wareTransactionType") WareTransactionType wareTransactionType);
2826

29-
30-
@Query("SELECT NEW app.projection.StockProjection(" +
31-
"wh.description, " +
32-
"shelf.code, " +
33-
"product.code, " +
34-
"SUM(CASE WHEN tx.wareTransactionType='IMPORT' " +
35-
"THEN detail.quantity " +
36-
"ELSE -detail.quantity END)) " +
37-
"FROM WareTransactionDetail detail " +
38-
"INNER JOIN WareTransaction tx ON detail.wareTransaction.id=tx.id " +
39-
"INNER JOIN Product product ON detail.product.id=product.id " +
40-
"INNER JOIN Shelf shelf ON detail.shelf.id=shelf.id " +
41-
"INNER JOIN Warehouse wh ON shelf.warehouse.id=wh.id " +
42-
"WHERE product.code=:productCode AND tx.transactionDate<=:date " +
43-
"GROUP BY wh.description, shelf.code ")
44-
List<StockProjection> findStockByProductAndDate(@Param("productCode") String productCode, @Param("date") LocalDateTime date);
45-
4627
}

0 commit comments

Comments
 (0)