商品销售排行排序

This commit is contained in:
liuyingfang 2024-03-15 17:16:37 +08:00
parent 325afd0aa0
commit b94e923f3d
1 changed files with 1 additions and 2 deletions

View File

@ -16,7 +16,7 @@ import java.util.List;
public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail, Integer> {
@Query(value = "SELECT" +
" row_number() over ( ORDER BY num DESC) AS productId, product.product_name as productName, SUM(product.num)AS num," +
" row_number() over ( ORDER BY SUM(product.num) DESC) AS productId, product.product_name as productName, SUM(product.num)AS num," +
" sum(product.amount) as productNum" +
" FROM" +
" tb_shop_user_duty_detail AS product" +
@ -24,7 +24,6 @@ public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDu
"WHERE user.shop_id = :shopId" +
" AND user.login_time BETWEEN :startTime AND :endTime" +
" GROUP BY product.product_id" +
" ORDER BY num DESC" +
" Limit :currentPage, :currentSize ", nativeQuery = true)
List<Object[]> searchByDutyId(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime
,@Param("currentPage") Integer currentPage, @Param("currentSize")Integer currentSize);