首页商品排行排名
This commit is contained in:
parent
0ad9234279
commit
510b6a22ca
|
|
@ -16,7 +16,8 @@ import java.util.List;
|
||||||
public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail, Integer> {
|
public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail, Integer> {
|
||||||
|
|
||||||
@Query(value = "SELECT" +
|
@Query(value = "SELECT" +
|
||||||
" product.product_id as productId, product.product_name as productName, SUM(product.num),sum(product.amount) as productNum" +
|
" row_number() over ( ORDER BY num ) AS productId, product.product_name as productName, SUM(product.num)AS num," +
|
||||||
|
" sum(product.amount) as productNum" +
|
||||||
" FROM" +
|
" FROM" +
|
||||||
" tb_shop_user_duty_detail AS product" +
|
" tb_shop_user_duty_detail AS product" +
|
||||||
" LEFT JOIN tb_shop_user_duty AS user ON product.duty_id = USER.id " +
|
" LEFT JOIN tb_shop_user_duty AS user ON product.duty_id = USER.id " +
|
||||||
|
|
|
||||||
|
|
@ -189,10 +189,10 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
throw new BadRequestException("日期有误");
|
throw new BadRequestException("日期有误");
|
||||||
}
|
}
|
||||||
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage,currentSize);
|
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage,currentSize);
|
||||||
List<ProductVO> list = new ArrayList<>();
|
List<ProductExtVO> list = new ArrayList<>();
|
||||||
for (Object[] o :objects) {
|
for (Object[] o :objects) {
|
||||||
ProductVO productVO = new ProductVO();
|
ProductExtVO productVO = new ProductExtVO();
|
||||||
productVO.setProductId((Integer) o[0]);
|
productVO.setProductId((BigInteger) o[0]);
|
||||||
productVO.setProductName((String) o[1]);
|
productVO.setProductName((String) o[1]);
|
||||||
productVO.setProductNum((BigDecimal)o[2]);
|
productVO.setProductNum((BigDecimal)o[2]);
|
||||||
productVO.setAmount((BigDecimal)o[3]);
|
productVO.setAmount((BigDecimal)o[3]);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.ysk.cashier.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductExtVO {
|
||||||
|
|
||||||
|
private BigInteger productId;
|
||||||
|
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
private BigDecimal productNum;
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
public ProductExtVO() {
|
||||||
|
this.productId = productId;
|
||||||
|
this.productName = productName;
|
||||||
|
this.productNum = productNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue