| | |
| | | goodsTypeService.removeById(byId); |
| | | return R.ok("删除成功"); |
| | | } |
| | | @GetMapping("/listAll") |
| | | @PostMapping("/listAll") |
| | | @ApiOperation(value = "列表查询", tags = {"后台-商品管理"}) |
| | | |
| | | public R<PageInfo<TGoods>> listAll(@RequestBody GoodsTypeQuery query){ |
| | | QueryWrapper<TGoods> wrapper = new QueryWrapper<>(); |
| | | if (StringUtils.hasLength(query.getName())){ |
| | |
| | | } |
| | | wrapper.orderByDesc("id"); |
| | | List<TGoods> list = goodsService.list(wrapper); |
| | | for (TGoods tGoods : list) { |
| | | long goodsId = orderService.count(new QueryWrapper<TOrder>().eq("goodsId", tGoods.getId())); |
| | | tGoods.setInventory(goodsId); |
| | | } |
| | | PageInfo<TGoods> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | res.setRecords(list); |
| | | return R.ok(res); |
| | |
| | | BeanUtils.copyProperties(byId,tGoodsVO); |
| | | long goodsId = orderService.count(new QueryWrapper<TOrder>().eq("goodsId", id)); |
| | | tGoodsVO.setInventory(goodsId); |
| | | tGoodsVO.setIntegral(byId.getIntegral()); |
| | | return R.ok(tGoodsVO); |
| | | } |
| | | @PostMapping("/getGoodsTypeList") |
| | | @ApiOperation(value = "获取商品类型列表", tags = {"后台-商品管理"}) |
| | | public R<List<TGoodsType>> getGoodsInfo() { |
| | | List<TGoodsType> res = goodsTypeService.list(new QueryWrapper<TGoodsType>() |
| | | .ne("isDelete", 1)); |
| | | List<TGoodsType> res = goodsTypeService.list(new QueryWrapper<TGoodsType>()); |
| | | return R.ok(res); |
| | | } |
| | | |