bug--普通商品浏览量
This commit is contained in:
@ -215,6 +215,7 @@ public class StoreProductController {
|
|||||||
@RequestParam(value = "",required=false) String longitude,
|
@RequestParam(value = "",required=false) String longitude,
|
||||||
@RequestParam(value = "",required=false) String from) {
|
@RequestParam(value = "",required=false) String from) {
|
||||||
long uid = LocalUser.getUser().getUid();
|
long uid = LocalUser.getUser().getUid();
|
||||||
|
storeProductService.incBrowseNum(id);
|
||||||
ProductVo productDTO = storeProductService.goodsDetail(id,uid,latitude,longitude);
|
ProductVo productDTO = storeProductService.goodsDetail(id,uid,latitude,longitude);
|
||||||
return ApiResult.ok(productDTO);
|
return ApiResult.ok(productDTO);
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,12 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
|
|||||||
*/
|
*/
|
||||||
ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude);
|
ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品浏览量
|
||||||
|
* @param productId
|
||||||
|
*/
|
||||||
|
void incBrowseNum(Long productId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品列表
|
* 商品列表
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
|
@ -10,7 +10,6 @@ package co.yixiang.modules.product.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@ -64,7 +63,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -365,6 +363,16 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
return productVo;
|
return productVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品浏览量
|
||||||
|
*
|
||||||
|
* @param productId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void incBrowseNum(Long productId) {
|
||||||
|
storeProductMapper.incBrowseNum(productId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品列表
|
* 商品列表
|
||||||
|
@ -87,4 +87,13 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
|
|||||||
@Update("update yx_store_seckill set stock=stock+#{num}, sales=sales-#{num}" +
|
@Update("update yx_store_seckill set stock=stock+#{num}, sales=sales-#{num}" +
|
||||||
" where id=#{activityId} and stock >= #{num}")
|
" where id=#{activityId} and stock >= #{num}")
|
||||||
void incSeckillStockIncSales(Integer num, Long productId, Long activityId);
|
void incSeckillStockIncSales(Integer num, Long productId, Long activityId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品浏览量
|
||||||
|
* @param productId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Update("update yx_store_product set browse=browse+1 " +
|
||||||
|
"where id=#{productId}")
|
||||||
|
int incBrowseNum(@Param("productId") Long productId);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user