diff --git a/src/main/java/io/github/talelin/latticy/controller/v1/CategoryController.java b/src/main/java/io/github/talelin/latticy/controller/v1/CategoryController.java index 91b8971607c0af7a297cd20fc28c157a9899b00a..8c92fd3856c1f20d93d04a8bbc323dfdc26b239f 100644 --- a/src/main/java/io/github/talelin/latticy/controller/v1/CategoryController.java +++ b/src/main/java/io/github/talelin/latticy/controller/v1/CategoryController.java @@ -38,14 +38,14 @@ public class CategoryController { @GetMapping("/page") @PermissionMeta(value = "品类列表查询", mount = false) @GroupRequired - private PageResponseVO getCategoryPage(CategoryPageDTO categoryPageDTO) { + public PageResponseVO getCategoryPage(CategoryPageDTO categoryPageDTO) { return PageUtil.build(categoryService.getCategoryPage(categoryPageDTO)); } @PostMapping("") @GroupRequired @PermissionMeta(value = "新增品类", mount = false) - private CreatedVO createCategory(@RequestBody CategoryDTO categoryDTO) { + public CreatedVO createCategory(@RequestBody CategoryDTO categoryDTO) { categoryService.createCategory(categoryDTO); return new CreatedVO(); } @@ -53,7 +53,7 @@ public class CategoryController { @PutMapping("/{id}") @GroupRequired @PermissionMeta(value = "修改品类", mount = false) - private UpdatedVO updateCategory(@PathVariable @Positive(message = "{category.id}") Integer id, @RequestBody UpdateCategoryDTO categoryDTO) { + public UpdatedVO updateCategory(@PathVariable @Positive(message = "{category.id}") Integer id, @RequestBody UpdateCategoryDTO categoryDTO) { categoryService.updateCategory(id, categoryDTO); return new UpdatedVO(); } @@ -61,14 +61,14 @@ public class CategoryController { @DeleteMapping("/{id}") @GroupRequired @PermissionMeta(value = "删除品类", mount = false) - private DeletedVO deleteCategory(@PathVariable @Positive(message = "{category.id}") Integer id) { + public DeletedVO deleteCategory(@PathVariable @Positive(message = "{category.id}") Integer id) { categoryService.deleteCategory(id); return new DeletedVO(); } @GetMapping("/getCategoryTree") @PermissionMeta(value = "查询树形结构", mount = false) - private List getCategoryTree() { + public List getCategoryTree() { return categoryService.getCategoryTree(); } } diff --git a/src/main/java/io/github/talelin/latticy/dto/category/UpdateCategoryDTO.java b/src/main/java/io/github/talelin/latticy/dto/category/UpdateCategoryDTO.java index fdb1c23a0b977bbf20ea368a5a8e512dddb91d21..859bd57ce70a22f5a1e6aaa7994175eb3e2055b6 100644 --- a/src/main/java/io/github/talelin/latticy/dto/category/UpdateCategoryDTO.java +++ b/src/main/java/io/github/talelin/latticy/dto/category/UpdateCategoryDTO.java @@ -2,6 +2,7 @@ package io.github.talelin.latticy.dto.category; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -17,11 +18,13 @@ public class UpdateCategoryDTO implements Serializable { /** * 品类名称 */ + @NotBlank(message = "{category.category-name}") private String categoryName; /** * 品类英文名称 */ + @NotBlank(message = "{category.category-english-name}") private String categoryEnglishName; }