| | |
| | | } |
| | | |
| | | /** |
| | | * 查询商品分类--所有一级分类 |
| | | * xzx_score_goods_category商品分类 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/viewGoodsCategoryList.json") |
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = ViewGoodsCategoryListVo.class)}) |
| | | @ApiOperation(value = "商品分类管理--所有一级分类", notes = "test: 仅0有正确返回") |
| | | public JsonResult<List<ViewGoodsCategoryListVo>> viewGoodsCategoryList(@RequestBody ViewGoodsCategoryListDto viewGoodsCategoryListDto) { |
| | | List<ViewGoodsCategoryListVo> result = goodsService.viewGoodsCategoryList(viewGoodsCategoryListDto); |
| | | return JsonResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * 添加商品分类 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/addGoodsCategory.json") |
| | |
| | | if(!parentId.equals(scoreGoodsCategory.getParentId())){ |
| | | scoreGoodsCategory.setParentId(parentId); |
| | | } |
| | | if(parentId.equals(id)){ |
| | | return JsonResult.failMessage("父类不能为自己!"); |
| | | } |
| | | |
| | | GoodsCategoryModel goodsCategoryModel = new GoodsCategoryModel(); |
| | | goodsCategoryModel.setName(name); |
| | | goodsCategoryModel.setCategoryIden(categoryIden); |
| | | goodsCategoryModel.setParentId(parentId); |
| | | List<QueryGoodsCategoryListVo> maps = scoreGoodsCategoryMapper.queryGoodsCategoryList(goodsCategoryModel); |
| | | if(CollUtil.isNotEmpty(maps)){ |
| | | if(CollUtil.isNotEmpty(maps) && maps.size() > 1){ |
| | | return JsonResult.failMessage("分类不能重复添加!"); |
| | | } |
| | | goodsCategoryModel.setId(id); |