首页商品排行排名排序

This commit is contained in:
liuyingfang
2024-03-15 15:44:09 +08:00
parent 69afcd0dfb
commit 85704cb18c

View File

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