|
|
@@ -0,0 +1,71 @@
|
|
|
+package com.fs.app.controller;
|
|
|
+
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.fs.saler.domain.FsProductInfo;
|
|
|
+import com.fs.saler.param.ProductInfoListPageParam;
|
|
|
+import com.fs.saler.service.FsProductInfoService;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import java.util.List;
|
|
|
+@Api("商品信息")
|
|
|
+@RestController
|
|
|
+@RequestMapping(value="/app/serviceGoods")
|
|
|
+public class FsServiceGoodsController {
|
|
|
+ @Autowired
|
|
|
+ private FsProductInfoService fsProductInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询商品列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查看商品列表")
|
|
|
+ @PostMapping("/listPage")
|
|
|
+ public R listPage(@RequestBody ProductInfoListPageParam param) {
|
|
|
+ PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
+ List<FsProductInfo> list = fsProductInfoService.getAll(param);
|
|
|
+ PageInfo<FsProductInfo> pageInfo = new PageInfo<>(list);
|
|
|
+ return R.ok().put("data", pageInfo);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 查看商品详情
|
|
|
+ */
|
|
|
+ @ApiOperation("查看商品详情")
|
|
|
+ @PostMapping("/findById")
|
|
|
+ public R findById(@RequestBody ProductInfoListPageParam param) {
|
|
|
+ FsProductInfo productInfo = fsProductInfoService.getById(param.getId());
|
|
|
+ return R.ok().put("data", productInfo);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增商品
|
|
|
+ */
|
|
|
+ @ApiOperation("新增商品")
|
|
|
+ @PostMapping("/save")
|
|
|
+ public R save(@RequestBody FsProductInfo productInfo) {
|
|
|
+ boolean result = fsProductInfoService.save(productInfo);
|
|
|
+ return result ? R.ok() : R.error("新增商品失败");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 更新商品信息
|
|
|
+ */
|
|
|
+ @ApiOperation("更新商品信息")
|
|
|
+ @PostMapping("/updateById")
|
|
|
+ public R updateById(@RequestBody FsProductInfo productInfo) {
|
|
|
+ boolean result = fsProductInfoService.update(productInfo);
|
|
|
+ return result ? R.ok() : R.error("更新商品信息失败");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 删除商品
|
|
|
+ */
|
|
|
+ @ApiOperation("删除商品")
|
|
|
+ @PostMapping("/deleteById")
|
|
|
+ public R deleteById(@RequestBody ProductInfoListPageParam param) {
|
|
|
+ boolean result = fsProductInfoService.removeById(param.getId());
|
|
|
+ return result ? R.ok() : R.error("删除商品失败");
|
|
|
+ }
|
|
|
+}
|