| | |
| | | @DeleteMapping("/deleteShop") |
| | | @ApiOperation(value = "删除门店", tags = {"管理后台-门店管理"}) |
| | | public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){ |
| | | List<Goods> list1 = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getAppointStore, 1).eq(Goods::getStatus, 2)); |
| | | if(list1.size() > 0){ |
| | | Set<Integer> collect1 = list1.stream().map(Goods::getId).collect(Collectors.toSet()); |
| | | long count = goodsShopService.count(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, id).in(GoodsShop::getGoodsId, collect1)); |
| | | if(0 < count){ |
| | | return R.fail("门店已被商品使用,不能删除"); |
| | | } |
| | | } |
| | | Shop shop = shopService.getById(id); |
| | | shop.setDelFlag(1); |
| | | shopService.updateById(shop); |
| | |
| | | userShop.setUserId(userid); |
| | | List<UserShop> data = userShopClient.getUserShop(userShop).getData(); |
| | | List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getId, collect).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>() |
| | | .in(!CollectionUtils.isEmpty(collect),Shop::getId, collect) |
| | | .eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | List<VerifiableShopVo> list = new ArrayList<>(); |
| | | for (Shop shop : shops) { |
| | | VerifiableShopVo vo = new VerifiableShopVo(); |