|
|
@@ -0,0 +1,62 @@
|
|
|
+package com.cyksj.web.controller.manage.goods;
|
|
|
+
|
|
|
+import com.cyksj.dto.Result;
|
|
|
+import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.model.entity.GoodsDonCategory;
|
|
|
+import com.cyksj.service.mange.GoodsDonCategoryService;
|
|
|
+import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.SearchResult;
|
|
|
+import com.ejlchina.searcher.util.MapUtils;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/*
|
|
|
+ *项目名: netflix
|
|
|
+ *文件名: CmsGoodsDonCategoryController
|
|
|
+ *创建者: JavaZou
|
|
|
+ *创建时间:2023/8/11 13:40
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/manage/goods/category")
|
|
|
+public class CmsGoodsDonCategoryController {
|
|
|
+ private final GoodsDonCategoryService goodsDonCategoryService;
|
|
|
+
|
|
|
+ private final BeanSearcher beanSearcher;
|
|
|
+
|
|
|
+ private final HttpServletRequest request;
|
|
|
+
|
|
|
+ @PostMapping("/post")
|
|
|
+ public Result<String> saveGoodsDonCategory(@RequestBody @Validated GoodsDonCategory category) {
|
|
|
+ goodsDonCategoryService.saveOrUpdateGoods(category);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/put")
|
|
|
+ public Result<String> updateGoodsDonCategory(@RequestBody @Validated GoodsDonCategory category) {
|
|
|
+ goodsDonCategoryService.saveOrUpdateGoods(category);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/del/{id}")
|
|
|
+ public Result<String> del(@PathVariable Long id) {
|
|
|
+ goodsDonCategoryService.delById(id);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ public Result<SearchResult<GoodsDonCategory>> getCategory() {
|
|
|
+ SearchResult<GoodsDonCategory> search = beanSearcher.search(GoodsDonCategory.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get/all")
|
|
|
+ public Result<List<GoodsDonCategory>> getAll() {
|
|
|
+ List<GoodsDonCategory> search = beanSearcher.searchAll(GoodsDonCategory.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+}
|