| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.ylx.collect.controller;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.ylx.collect.domain.dto.CollectOperateDTO;
- import com.ylx.collect.domain.dto.CollectSearchDTO;
- import com.ylx.collect.domain.vo.CollectPageVO;
- import com.ylx.collect.service.CollectService;
- import com.ylx.common.core.domain.R;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.validation.annotation.Validated;
- 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 javax.annotation.Resource;
- @RestController
- @RequestMapping("/customer/collect")
- @Api(tags = {"用户端收藏商户"})
- @Slf4j
- @PreAuthorize("@customerAuth.isCustomer()")
- public class CustomerCollectController {
- @Resource
- private CollectService collectService;
- @ApiOperation("添加收藏")
- @PostMapping(value = "/add")
- public R<Boolean> addCollect(@Validated @RequestBody CollectOperateDTO dto) {
- boolean success = this.collectService.addCollect(dto);
- return R.ok(success);
- }
- @ApiOperation("我的收藏分页列表")
- @PostMapping(value = "/page")
- public R<Page<CollectPageVO>> page(@RequestBody CollectSearchDTO dto) {
- Page<CollectPageVO> resultPage = this.collectService.page(dto);
- return R.ok(resultPage);
- }
- @ApiOperation("取消收藏")
- @PostMapping(value = "/cancel")
- public R<Boolean> cancelCollect(@Validated @RequestBody CollectOperateDTO dto) {
- boolean success = this.collectService.cancelCollect(dto);
- return R.ok(success);
- }
- }
|