rk
11 小时以前 580f4d3c2ca9eee53eee95a4de2f6610b790780a
server/dmmall_web/src/main/java/com/doumee/api/web/ZanApi.java
@@ -1,34 +1,45 @@
package com.doumee.api.web;
import com.doumee.config.annotation.LoginRequired;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.business.model.Zan;
import com.doumee.service.business.ZanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 org.springframework.web.bind.annotation.*;
/**
 * @author 江蹄蹄
 * @date 2023/03/21 15:48
 */
@Api(tags = "用户点赞信息表")
//@RestController
@Trace(exclude = true)
@RestController
@RequestMapping("/web/zan")
@Slf4j
public class ZanApi extends ApiController{
    @PreventRepeat
    @ApiOperation("新建")
    @LoginRequired
    @ApiOperation("点赞")
    @PostMapping("/create")
    @RequiresPermissions("business:zan:create")
    public ApiResponse create(@RequestBody Zan zan) {
        return ApiResponse.success(zanService.create(zan,getMemberId()));
    }
    @LoginRequired
    @ApiOperation("取消点赞")
    @PostMapping("/cancel")
    public ApiResponse cancel(@RequestBody Zan zan) {
        zanService.deleteById(zan,getMemberId());
        return ApiResponse.success(null);
    }
}