| | |
| | | wrapper.or().apply("FIND_IN_SET('" + id + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数 |
| | | wrapper.eq("isDelete", 0); |
| | | List<TGoods> list = goodsService.list(wrapper); |
| | | if (!list.isEmpty()){ |
| | | if (!list.isEmpty()) { |
| | | return R.fail("当前商品分类被使用,无法删除!"); |
| | | } |
| | | TGoodsType byId = goodsTypeService.getById(id); |
| | |
| | | Long temp = 0L; |
| | | List<TOrder> list1 = orderService.list(new QueryWrapper<TOrder>().eq("goodsId", tGoods.getId())); |
| | | for (TOrder tOrder : list1) { |
| | | temp+=tOrder.getCount(); |
| | | temp += tOrder.getCount(); |
| | | } |
| | | tGoods.setInventory(temp); |
| | | // 剩余兑换数量 |
| | |
| | | @GetMapping("/exchangeRecord") |
| | | @ApiOperation(value = "学习端-兑换记录", tags = {"学习端-商城"}) |
| | | public R<List<ExchangeRecordVO>> exchangeRecord() { |
| | | LoginUserParent loginUserStudy = tokenService.getLoginUserStudy(); |
| | | if (null == loginUserStudy) { |
| | | return R.tokenError("登录失效!"); |
| | | } |
| | | List<ExchangeRecordVO> exchangeRecord = orderService.exchangeRecord(tokenService.getLoginUserStudy().getUserid()); |
| | | for (ExchangeRecordVO record : exchangeRecord) { |
| | | TGoods goods = goodsService.getById(record.getGoodsId()); |
| | |
| | | TUser byId1 = studyClient.getUserById(byId.getUserId()).getData(); |
| | | tGoodsVO.setUserName(byId1.getName()); |
| | | tGoodsVO.setPhone(byId1.getPhone()); |
| | | if (byId.getProvince()!=null && byId.getCity() != null){ |
| | | tGoodsVO.setConsigneeAddress(byId.getProvince()+byId.getCity()+tGoodsVO.getConsigneeAddress()); |
| | | if (byId.getProvince() != null && byId.getCity() != null) { |
| | | tGoodsVO.setConsigneeAddress(byId.getProvince() + byId.getCity() + tGoodsVO.getConsigneeAddress()); |
| | | } |
| | | return R.ok(tGoodsVO); |
| | | } |