|
@@ -1,11 +1,13 @@
|
|
|
package com.macro.mall.portal.controller;
|
|
|
|
|
|
+import com.macro.mall.common.api.CommonPage;
|
|
|
import com.macro.mall.common.api.CommonResult;
|
|
|
import com.macro.mall.portal.domain.MemberProductCollection;
|
|
|
import com.macro.mall.portal.service.MemberCollectionService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -17,16 +19,16 @@ import java.util.List;
|
|
|
*/
|
|
|
@Controller
|
|
|
@Api(tags = "MemberCollectionController", description = "会员收藏管理")
|
|
|
-@RequestMapping("/member/collection")
|
|
|
-public class MemberCollectionController {
|
|
|
+@RequestMapping("/member/productCollection")
|
|
|
+public class MemberProductCollectionController {
|
|
|
@Autowired
|
|
|
private MemberCollectionService memberCollectionService;
|
|
|
|
|
|
@ApiOperation("添加商品收藏")
|
|
|
- @RequestMapping(value = "/addProduct", method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public CommonResult addProduct(@RequestBody MemberProductCollection productCollection) {
|
|
|
- int count = memberCollectionService.addProduct(productCollection);
|
|
|
+ public CommonResult add(@RequestBody MemberProductCollection productCollection) {
|
|
|
+ int count = memberCollectionService.add(productCollection);
|
|
|
if (count > 0) {
|
|
|
return CommonResult.success(count);
|
|
|
} else {
|
|
@@ -35,10 +37,10 @@ public class MemberCollectionController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation("删除收藏商品")
|
|
|
- @RequestMapping(value = "/deleteProduct", method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public CommonResult deleteProduct(Long memberId, Long productId) {
|
|
|
- int count = memberCollectionService.deleteProduct(memberId, productId);
|
|
|
+ public CommonResult delete(Long productId) {
|
|
|
+ int count = memberCollectionService.delete(productId);
|
|
|
if (count > 0) {
|
|
|
return CommonResult.success(count);
|
|
|
} else {
|
|
@@ -47,10 +49,11 @@ public class MemberCollectionController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation("显示关注列表")
|
|
|
- @RequestMapping(value = "/listProduct/{memberId}", method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public CommonResult<List<MemberProductCollection>> listProduct(@PathVariable Long memberId) {
|
|
|
- List<MemberProductCollection> memberProductCollectionList = memberCollectionService.listProduct(memberId);
|
|
|
- return CommonResult.success(memberProductCollectionList);
|
|
|
+ public CommonResult<CommonPage<MemberProductCollection>> list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
|
|
|
+ Page<MemberProductCollection> page = memberCollectionService.list(pageNum,pageSize);
|
|
|
+ return CommonResult.success(CommonPage.restPage(page));
|
|
|
}
|
|
|
}
|