商品修改不能改库存,首页商品排行

This commit is contained in:
liuyingfang 2024-03-15 14:26:09 +08:00
parent b65bc317bd
commit 0ad9234279
6 changed files with 14 additions and 14 deletions

View File

@ -43,8 +43,8 @@ public class SummaryController {
@GetMapping("/dateProduct")
private Object shopSummaryProduct(@RequestParam Integer shopId,@RequestParam Integer day,
@RequestParam Integer page){
return summaryService.selectSummaryProduct(shopId,day,page);
@RequestParam Integer page, @RequestParam Integer size){
return summaryService.selectSummaryProduct(shopId,day,page,size);
}
@GetMapping("/datePayType")
private Object shopSummaryPayType(@RequestParam Integer shopId,@RequestParam Integer day){

View File

@ -23,9 +23,9 @@ public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDu
"WHERE user.shop_id = :shopId" +
" AND user.login_time BETWEEN :startTime AND :endTime" +
" GROUP BY product.product_id" +
" Limit :currentPage,5", nativeQuery = true)
" 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("currentPage") Integer currentPage, @Param("currentSize")Integer currentSize);
@Query(value = "SELECT\n" +

View File

@ -51,10 +51,10 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
@Modifying
@Query("update FROM TbProductSku sku set sku.costPrice=:costPrice,sku.coverImg =:coverImg, " +
"sku.firstShared=:firstShared,sku.memberPrice = :memberPrice,sku.originPrice = :originPrice, " +
"sku.salePrice=:salePrice,sku.specSnap =:specSnap,sku.stockNumber = :stockNumber " +
"sku.salePrice=:salePrice,sku.specSnap =:specSnap " +
"WHERE sku.barCode = :barCode and sku.id =:id")
Integer updateByBarCode(@Param("barCode") String barCode, @Param("costPrice")BigDecimal costPrice, @Param("coverImg")String coverImg,
@Param("firstShared")BigDecimal firstShared,@Param("memberPrice")BigDecimal memberPrice,@Param("originPrice") BigDecimal originPrice,
@Param("salePrice")BigDecimal salePrice,@Param("specSnap") String specSnap,@Param("stockNumber") Double stockNumber,@Param("id") Integer id);
@Param("salePrice")BigDecimal salePrice,@Param("specSnap") String specSnap,@Param("id") Integer id);
}

View File

@ -17,7 +17,7 @@ public interface SummaryService {
Map<String,Object> selectSummaryToday(Integer shopId);
Map<String,Object> selectSummaryAmount(Integer shopId, Integer day);
Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer page);
Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer page,Integer size);
Map<String,Object> selectSummaryPayType(Integer shopId, Integer day);
}

View File

@ -170,9 +170,9 @@ public class SummaryServiceImpl implements SummaryService {
}
@Override
public Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer currentPage){
public Map<String,Object> selectSummaryProduct(Integer shopId, Integer day,Integer currentPage, Integer currentSize){
//根据时间商品排行
currentPage = (currentPage - 1) * 5;
currentPage = (currentPage - 1) * currentSize;
HashMap<String, Object> map = new HashMap<>();
Date startTime ;
Date endTime ;
@ -188,7 +188,7 @@ public class SummaryServiceImpl implements SummaryService {
}else {
throw new BadRequestException("日期有误");
}
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage);
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime,currentPage,currentSize);
List<ProductVO> list = new ArrayList<>();
for (Object[] o :objects) {
ProductVO productVO = new ProductVO();
@ -202,10 +202,10 @@ public class SummaryServiceImpl implements SummaryService {
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
//分页数据
Tuple tuple1 = shopUserDutyDetailRepository.searchCount(shopId, startTime, endTime);
map.put("productCount",tuple.get(0, BigDecimal.class));
map.put("productSum",tuple.get(1, BigDecimal.class));
map.put("productCount",tuple == null? 0:tuple.get(0, BigDecimal.class));
map.put("productSum",tuple == null? 0:tuple.get(1, BigDecimal.class));
map.put("totalProduct",list);
map.put("total",tuple1.get(0, BigInteger.class));
map.put("total",tuple1 == null?0:tuple1.get(0, BigInteger.class));
return map;
}
@Override

View File

@ -324,7 +324,7 @@ public class TbProductServiceImpl implements TbProductService {
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
if (tbProductSku != null){
tbProductSkuRepository.updateByBarCode(sku.getBarCode(),sku.getCostPrice(),sku.getCoverImg(),sku.getFirstShared(),sku.getMemberPrice(),
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),sku.getStockNumber(),tbProductSku.getId());
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),tbProductSku.getId());
}else {
if ("sku".equals(save.getTypeEnum())) {
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));