he2802 %!s(int64=2) %!d(string=hai) anos
pai
achega
3c8c6dba8b

+ 8 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/goods/TopGoodsController.java

@@ -109,4 +109,12 @@ public class TopGoodsController extends BaseController {
         return AjaxResult.success(iGoodsService.selectDetail(goodsId));
     }
 
+    @ApiOperation("商品批量删除")
+    @PreAuthorize("@ss.hasPermi('system:store:edit')")
+    @Log(title = "商品批量删除", businessType = BusinessType.UPDATE)
+    @PostMapping("/batchRemove")
+    public AjaxResult<Void> batchRemove(@RequestBody GoodsEditBo bo) {
+        return toAjax(iGoodsService.batchRemove(bo) ? 1 : 0);
+    }
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsEditBo.java

@@ -246,4 +246,6 @@ public class GoodsEditBo {
     /** 关联使用类型 1积分商城 2会员卡 */
     @ApiModelProperty("关联使用类型 1积分商城 2会员卡,多个,拼接")
     private String useType;
+    @ApiModelProperty("商品ID")
+    private List<Long> goodsIds;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -12,6 +12,7 @@ import com.zhongzheng.modules.goods.vo.GoodsSpecTemplateVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.goods.vo.UserGoodsListVo;
 import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
+import com.zhongzheng.modules.top.mall.bo.TopStoreEditBo;
 
 import java.util.Collection;
 import java.util.List;
@@ -41,6 +42,8 @@ public interface IGoodsService extends IService<Goods> {
 
 	Long getExamNum(Long goodsId);
 
+	Boolean batchRemove(GoodsEditBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -69,6 +69,7 @@ import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysGoodsCopyRecordService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
+import com.zhongzheng.modules.top.mall.domain.TopStore;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserPhoneBo;
 import com.zhongzheng.modules.user.domain.School;
@@ -472,6 +473,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getExamNum(goodsId);
     }
 
+    @Override
+    public Boolean batchRemove(GoodsEditBo bo) {
+        for(Long id : bo.getGoodsIds()){
+            LambdaUpdateWrapper<Goods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+            objectLambdaUpdateWrapper.eq(Goods::getGoodsId, id);
+            objectLambdaUpdateWrapper.eq(Goods::getGoodsType, 7);
+            objectLambdaUpdateWrapper.set(Goods::getStatus, -1);
+            objectLambdaUpdateWrapper.set(Goods::getUpdateTime, DateUtils.getNowTime());
+            this.update(null, objectLambdaUpdateWrapper);
+        }
+        return true;
+    }
+
     @Override
     public List<GoodsVo> queryList(GoodsQueryBo bo) {
         LambdaQueryWrapper<Goods> lqw = Wrappers.lambdaQuery();