更新删除商品 和回收站删除商品的问题
This commit is contained in:
@@ -74,15 +74,16 @@ public class StoreProductController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品表
|
||||
* @param id Integer
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-27
|
||||
* 删除商品
|
||||
* @param id 商品id
|
||||
* @param type 删除类型 recycle 回收站 delete 物理删除
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id){
|
||||
if(storeProductService.deleteProduct(id)){
|
||||
public CommonResult<String> delete(@PathVariable Integer id,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "recycle")String type){
|
||||
if(storeProductService.deleteProduct(id, type)){
|
||||
// if(storeProductService.removeById(id)){
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
return CommonResult.success();
|
||||
|
||||
@@ -126,7 +126,7 @@ public interface StoreProductService extends IService<StoreProduct> {
|
||||
* @param productId 商品id
|
||||
* @return 删除结果
|
||||
*/
|
||||
boolean deleteProduct(Integer productId);
|
||||
boolean deleteProduct(Integer productId, String type);
|
||||
|
||||
/**
|
||||
* 恢复已删除商品
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -919,8 +920,13 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteProduct(Integer productId) {
|
||||
public boolean deleteProduct(Integer productId, String type) {
|
||||
LambdaUpdateWrapper<StoreProduct> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
if (StrUtil.isNotBlank(type) && "delete".equals(type)) {
|
||||
lambdaUpdateWrapper.eq(StoreProduct::getId, productId);
|
||||
int delete = dao.delete(lambdaUpdateWrapper);
|
||||
return delete > 0;
|
||||
}
|
||||
lambdaUpdateWrapper.eq(StoreProduct::getId, productId);
|
||||
lambdaUpdateWrapper.set(StoreProduct::getIsDel, true);
|
||||
return update(lambdaUpdateWrapper);
|
||||
|
||||
Reference in New Issue
Block a user