|  | @@ -61,9 +61,9 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  	 * 获取分类信息
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	@GetMapping("/info/{categoryId}")
 | 
	
		
			
				|  |  | -	public ResponseEntity<Category> info(@PathVariable("categoryId") Long categoryId){
 | 
	
		
			
				|  |  | +	public R<Category> info(@PathVariable("categoryId") Long categoryId){
 | 
	
		
			
				|  |  |  		Category category = categoryService.getById(categoryId);
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok(category);
 | 
	
		
			
				|  |  | +		return R.SUCCESS(category);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
	
		
			
				|  | @@ -72,12 +72,12 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  	@SysLog("保存分类")
 | 
	
		
			
				|  |  |  	@PostMapping
 | 
	
		
			
				|  |  |  	@PreAuthorize("@pms.hasPermission('prod:category:save')")
 | 
	
		
			
				|  |  | -	public ResponseEntity<Void> save(@RequestBody Category category){
 | 
	
		
			
				|  |  | +	public R<Void> save(@RequestBody Category category){
 | 
	
		
			
				|  |  |  		category.setShopId(Constant.PLATFORM_SHOP_ID);
 | 
	
		
			
				|  |  |  		category.setRecTime(new Date());
 | 
	
		
			
				|  |  |  		category.setGrade(getGradeByParentId(category.getParentId()));
 | 
	
		
			
				|  |  |  		categoryService.saveCategroy(category);
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok().build();
 | 
	
		
			
				|  |  | +		return R.SUCCESS();
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -87,18 +87,18 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  	@SysLog("更新分类")
 | 
	
		
			
				|  |  |  	@PutMapping
 | 
	
		
			
				|  |  |  	@PreAuthorize("@pms.hasPermission('prod:category:update')")
 | 
	
		
			
				|  |  | -	public ResponseEntity<String> update(@RequestBody Category category){
 | 
	
		
			
				|  |  | +	public R<String> update(@RequestBody Category category){
 | 
	
		
			
				|  |  |  //		category.setShopId(Constant.PLATFORM_SHOP_ID);
 | 
	
		
			
				|  |  |  		Category categoryDB = categoryService.getById(category.getCategoryId());
 | 
	
		
			
				|  |  |  		if (Objects.equals(categoryDB.getParentId(), Constant.CATEGORY_ID) && !Objects.equals(category.getParentId(), Constant.CATEGORY_ID)){
 | 
	
		
			
				|  |  | -			return ResponseEntity.badRequest().body("一级分类不能改为二级分类");
 | 
	
		
			
				|  |  | +			return R.fail("一级分类不能改为二级分类");
 | 
	
		
			
				|  |  |  		}else if(Objects.equals(category.getParentId(), Constant.CATEGORY_ID) && !Objects.equals(categoryDB.getParentId(), Constant.CATEGORY_ID)){
 | 
	
		
			
				|  |  | -			return ResponseEntity.badRequest().body("二级分类不能改为一级分类");
 | 
	
		
			
				|  |  | +			return R.fail("二级分类不能改为一级分类");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		category.setGrade(getGradeByParentId(category.getParentId()));
 | 
	
		
			
				|  |  |  		category.setOldCategoryName(categoryDB.getCategoryName());
 | 
	
		
			
				|  |  |  		categoryService.updateCategroy(category);
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok().build();
 | 
	
		
			
				|  |  | +		return R.SUCCESS();
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
	
		
			
				|  | @@ -107,24 +107,24 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  	@SysLog("删除分类")
 | 
	
		
			
				|  |  |  	@DeleteMapping("/{categoryId}")
 | 
	
		
			
				|  |  |  	@PreAuthorize("@pms.hasPermission('prod:category:delete')")
 | 
	
		
			
				|  |  | -	public ResponseEntity<String> delete(@PathVariable("categoryId") Long categoryId){
 | 
	
		
			
				|  |  | +	public R<String> delete(@PathVariable("categoryId") Long categoryId){
 | 
	
		
			
				|  |  |  		if (categoryService.count(new LambdaQueryWrapper<Category>().eq(Category::getParentId,categoryId)) >0) {
 | 
	
		
			
				|  |  | -			return ResponseEntity.badRequest().body("请删除子分类,再删除该分类");
 | 
	
		
			
				|  |  | +			return R.fail("请删除子分类,再删除该分类");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		int categoryProdCount = productService.count(new LambdaQueryWrapper<Product>().eq(Product::getCategoryId, categoryId).ne(Product::getStatus, -1));
 | 
	
		
			
				|  |  |  		if (categoryProdCount>0){
 | 
	
		
			
				|  |  | -			return ResponseEntity.badRequest().body("该分类下还有商品,请先删除该分类下的商品");
 | 
	
		
			
				|  |  | +			return R.fail("该分类下还有商品,请先删除该分类下的商品");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		Category category = categoryService.getById(categoryId);
 | 
	
		
			
				|  |  |  		categoryService.deleteCategroy(category);
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok().build();
 | 
	
		
			
				|  |  | +		return R.SUCCESS();
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 所有的
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	@GetMapping("/listCategory")
 | 
	
		
			
				|  |  | -	public ResponseEntity<IPage<Category>> listCategory(@RequestParam Integer maxGrade,
 | 
	
		
			
				|  |  | +	public R<IPage<Category>> listCategory(@RequestParam Integer maxGrade,
 | 
	
		
			
				|  |  |  													   @RequestParam(value = "shopId", required = false) String shopId,
 | 
	
		
			
				|  |  |  													   @RequestParam(value = "categoryName", required = false) String categoryName,
 | 
	
		
			
				|  |  |  													   @RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
 | 
	
	
		
			
				|  | @@ -148,13 +148,13 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  //														.le(Category::getGrade, maxGrade)
 | 
	
		
			
				|  |  |  ////														.eq(Category::getShopId, Constant.PLATFORM_SHOP_ID)
 | 
	
		
			
				|  |  |  //														.orderByAsc(Category::getSeq)));
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok(page);
 | 
	
		
			
				|  |  | +		return R.SUCCESS(page);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@PostMapping("/listCategoryNew")
 | 
	
		
			
				|  |  |  	@ApiOperation("分类查询")
 | 
	
		
			
				|  |  | -	public ResponseEntity<IPage<ListCategoryVO>> listCategoryNew(@RequestBody ListCategoryDTO listCategoryDTO){
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok(categoryService.listCategory(listCategoryDTO));
 | 
	
		
			
				|  |  | +	public R<IPage<ListCategoryVO>> listCategoryNew(@RequestBody ListCategoryDTO listCategoryDTO){
 | 
	
		
			
				|  |  | +		return R.SUCCESS(categoryService.listCategory(listCategoryDTO));
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //	/**
 | 
	
	
		
			
				|  | @@ -183,9 +183,9 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  	 * 平台的分类
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	@GetMapping("/platformCategory")
 | 
	
		
			
				|  |  | -	public ResponseEntity<List<Category>> platformCategory(@RequestParam Integer maxGrade){
 | 
	
		
			
				|  |  | +	public R<List<Category>> platformCategory(@RequestParam Integer maxGrade){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok(categoryService.list(new LambdaQueryWrapper<Category>()
 | 
	
		
			
				|  |  | +		return R.SUCCESS(categoryService.list(new LambdaQueryWrapper<Category>()
 | 
	
		
			
				|  |  |  				.le(Category::getGrade, maxGrade)
 | 
	
		
			
				|  |  |  				.eq(Category::getShopId, Constant.PLATFORM_SHOP_ID)
 | 
	
		
			
				|  |  |  				.orderByAsc(Category::getSeq)));
 | 
	
	
		
			
				|  | @@ -193,10 +193,10 @@ public class CategoryController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@ApiOperation("按名称模糊匹配店铺")
 | 
	
		
			
				|  |  |  	@GetMapping("/getShopByName")
 | 
	
		
			
				|  |  | -	public ResponseEntity<List<ShopDetail>> getShopByName(@RequestParam(value = "shopName", required = false) String shopName) {
 | 
	
		
			
				|  |  | +	public R<List<ShopDetail>> getShopByName(@RequestParam(value = "shopName", required = false) String shopName) {
 | 
	
		
			
				|  |  |  		List<ShopDetail> list = shopDetailService.list(new LambdaQueryWrapper<ShopDetail>()
 | 
	
		
			
				|  |  |  				.like(StringUtils.isNotEmpty(shopName), ShopDetail::getShopName, shopName));
 | 
	
		
			
				|  |  | -		return ResponseEntity.ok(list);
 | 
	
		
			
				|  |  | +		return R.SUCCESS(list);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |