|
|
@@ -40,6 +40,7 @@ import com.store.goods.service.IGoodsDescService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 控制器
|
|
|
@@ -74,6 +75,28 @@ public class GoodsDescController extends BladeController {
|
|
|
return R.data(detail);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @GetMapping("app/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入goodsDesc")
|
|
|
+ public R<GoodsDesc> appDetail(GoodsDesc goodsDesc) {
|
|
|
+ GoodsDesc detail = goodsDescService.getOne(Condition.getQueryWrapper(goodsDesc));
|
|
|
+ LambdaQueryWrapper<GoodsItems> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ itemsLambdaQueryWrapper
|
|
|
+ .eq(GoodsItems::getGoodsStatus,1)
|
|
|
+ .eq(GoodsItems::getIsDeleted,0)
|
|
|
+ .eq(GoodsItems::getPid,detail.getId())
|
|
|
+ .eq(GoodsItems::getTenantId, AuthUtil.getTenantId());
|
|
|
+ List<GoodsItems> itemsList = goodsItemsService.list(itemsLambdaQueryWrapper);
|
|
|
+ detail.setItemsList(itemsList);
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 分页
|
|
|
*/
|
|
|
@@ -147,11 +170,15 @@ public class GoodsDescController extends BladeController {
|
|
|
@ApiParam(value = "0:下架 1:上架", required = true) @RequestParam int flag)
|
|
|
{
|
|
|
List<Long> longs = Func.toLongList(ids);
|
|
|
+
|
|
|
if(CollectionUtils.isEmpty(longs))
|
|
|
{
|
|
|
throw new SecurityException("传入ids不能为空");
|
|
|
}
|
|
|
- goodsDescService.batchOperationGoods(longs,flag);
|
|
|
+ LambdaQueryWrapper<GoodsItems> lambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.in(GoodsItems::getPid,longs).eq(GoodsItems::getIsDeleted,0);
|
|
|
+ List<Long> collect = goodsItemsService.list(lambdaQueryWrapper).stream().map(GoodsItems::getId).collect(Collectors.toList());
|
|
|
+ goodsDescService.batchOperationGoods(collect,flag);
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|