分类绑定品牌规范问题处理

This commit is contained in:
Chopper
2021-09-22 12:13:04 +08:00
parent 57a5c5a0f1
commit 50b52f07c6
6 changed files with 67 additions and 18 deletions

View File

@@ -97,7 +97,7 @@ public class BrandManagerController {
@ApiImplicitParam(name = "ids", value = "品牌ID", required = true, dataType = "String", allowMultiple = true, paramType = "path")
@DeleteMapping(value = "/delByIds/{ids}")
public ResultMessage<Object> delAllByIds(@PathVariable List<String> ids) {
brandService.removeByIds(ids);
brandService.deleteBrands(ids);
return ResultUtil.success(ResultCode.SUCCESS);
}

View File

@@ -46,14 +46,8 @@ public class CategoryBrandManagerController {
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path", dataType = "String"),
@ApiImplicitParam(name = "categoryBrands", value = "品牌id数组", required = true, paramType = "query", dataType = "String[]")
})
public ResultMessage<Object> saveCategoryBrand(@PathVariable String categoryId, @RequestParam String[] categoryBrands) {
//删除分类品牌绑定信息
this.categoryBrandService.remove(new QueryWrapper<CategoryBrand>().eq("category_id", categoryId));
//绑定品牌信息
for (String brandId : categoryBrands) {
CategoryBrand categoryBrand = new CategoryBrand(categoryId, brandId);
categoryBrandService.save(categoryBrand);
}
public ResultMessage<Object> saveCategoryBrand(@PathVariable String categoryId, @RequestParam List<String> categoryBrands) {
categoryBrandService.saveCategoryBrandList(categoryId,categoryBrands);
return ResultUtil.success();
}