成员管理店铺id修改前端传值

main
cheney 10 months ago
parent f70a2c853e
commit e2dbddb3da
  1. 10
      nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java
  2. 2
      nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java

@ -126,7 +126,7 @@ public class ProductController {
@PostMapping("/save")
@ApiOperation(value = "保存商品信息")
public ServerResponseEntity<String> save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) {
productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
checkParam(productParam);
Product product = BeanUtil.copyProperties(productParam, Product.class);
product.setShopId(TokenUtils.getShopIdByJwtToken(request));
@ -144,7 +144,7 @@ public class ProductController {
@PostMapping("/update")
@ApiOperation(value = "修改商品信息")
public ServerResponseEntity<String> update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) {
productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request));
checkParam(productParam);
Product dbProduct = productService.getProductByProdId(productParam.getProdId());
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
@ -180,9 +180,9 @@ public class ProductController {
*/
public ServerResponseEntity<Void> delete(Integer prodId,HttpServletRequest request) {
Product dbProduct = productService.getProductByProdId(prodId);
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
throw new YamiShopBindException("无法获取非本店铺商品信息");
}
// if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) {
// throw new YamiShopBindException("无法获取非本店铺商品信息");
// }
List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId());
// 删除商品
productService.removeProductByProdId(prodId);

@ -106,7 +106,7 @@ public class ProductParam {
@ApiModelProperty(value = "商品详情")
private String content;
@ApiModelProperty(value = "店铺id",hidden = true)
@ApiModelProperty(value = "店铺id")
private Integer shopId;
/**

Loading…
Cancel
Save