|
@@ -0,0 +1,56 @@
|
|
|
+package com.cdf.controller.back;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.cdf.aop.SysLog;
|
|
|
+import com.cdf.common.PageInfo;
|
|
|
+import com.cdf.common.ResultCode;
|
|
|
+import com.cdf.common.ResultData;
|
|
|
+import com.cdf.entity.HotRelation;
|
|
|
+import com.cdf.entity.ShopCategory;
|
|
|
+import com.cdf.exception.BusinessException;
|
|
|
+import com.cdf.request.BaseRequest;
|
|
|
+import com.cdf.request.HotTypeRequest;
|
|
|
+import com.cdf.service.IHotRelationService;
|
|
|
+import com.cdf.service.IShopCategoryService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/back/category")
|
|
|
+public class ShopCategoryController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IShopCategoryService shopCategoryService;
|
|
|
+
|
|
|
+ @PostMapping("/saveOrUpdate")
|
|
|
+ @SysLog("店铺分类新增或修改")
|
|
|
+ public ResultData saveOrUpdate(@RequestBody ShopCategory shopCategory){
|
|
|
+ shopCategoryService.saveOrUpdate(shopCategory);
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @SysLog("店铺分类删除")
|
|
|
+ public ResultData delete(@RequestBody ShopCategory shopCategory){
|
|
|
+ if(shopCategory.getId() == null){
|
|
|
+ throw new BusinessException(ResultCode.PARAM_MISS);
|
|
|
+ }
|
|
|
+ shopCategoryService.removeById(shopCategory);
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+ @PostMapping("/list")
|
|
|
+ public ResultData list(@RequestBody BaseRequest param){
|
|
|
+ Page<ShopCategory> page = shopCategoryService.page(new Page<>(param.getPageNum(), param.getPageSize()));
|
|
|
+ return ResultData.ok(PageInfo.PageInfo(page));
|
|
|
+ }
|
|
|
+ @PostMapping("/allList")
|
|
|
+ public ResultData allList(){
|
|
|
+ List<ShopCategory> list = shopCategoryService.list();
|
|
|
+ return ResultData.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|